Skip to content

Support editing method this object in json/edit scriptlets, similar to AdGuard trusted-json-set jsonSource=this #4019

@piquark6046

Description

@piquark6046

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is NOT a YouTube, Facebook or Twitch report. These sites MUST be reported by clicking their respective links.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

AdGuard supports this with trusted-json-set + jsonSource=this.
uBO's edit-outbound-object edits only the return value.
For Array.prototype.find, this means uBO cannot modify the array before the predicate observes targeted properties.

AdguardTeam/Scriptlets#308

A specific URL where the issue occurs.

https://map.naver.com/p/search/%EA%B3%A0%EA%B9%83%EC%A7%91?c=15.00,0,0,0,dh

Steps to Reproduce

  1. Apply map.naver.com##+js(trusted-edit-outbound-object, Array.prototype.find, '$..[adClickLog, adDescription, adId, adImages]') or map.naver.com##+js(edit-outbound-object, Array.prototype.find, '$..[adClickLog, adDescription, adId, adImages]')
  2. Visit the provided URL.
  3. Check that .marker_icon_image_wrap img[src*="https://map.pstatic.net/resource/api/v2/image/maps/ad-marker/"] is visible in the main window.

Expected behavior

The advert icons are replaced by normal place icons if map.naver.com#%#//scriptlet('trusted-json-set', 'Array.prototype.find', '$..[adClickLog, adDescription, adId, adImages]', '$remove$', '', 'this') on AdGuard is applied.

Troubleshooting information

uBlock Origin: 1.71.0
Firefox: 152
filterset (summary):
 network: 170861
 cosmetic: 46059
 scriptlet: 33649
 html: 3451
listset (total-discarded, last-updated):
 added:
  KOR-1: 4765-101, 1h.8m
 default:
  user-filters: 0-0, never
  ublock-filters: 52424-70, 1h.8m
  ublock-badware: 10340-28, 1h.8m
  ublock-privacy: 4022-2, 1h.8m
  ublock-unbreak: 2827-1, 8m Δ
  ublock-quick-fixes: 481-13, 1h.8m
  easylist: 97063-127, 1h.8m
  easyprivacy: 55798-33, 1h.8m
  urlhaus-1: 24325-6, 1h.8m
  plowe-0: 3508-1022, 1h.8m
filterset (user): [empty]
userSettings:
 userFiltersTrusted: true
hiddenSettings: [none]
supportStats:
 allReadyAfter: 260 ms
 maxAssetCacheWait: 164 ms
 cacheBackend: indexedDB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions