Support editing method `this` object in json/edit scriptlets, similar to AdGuard `trusted-json-set` `jsonSource=this`
### Prerequisites
- [x] 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](https://github.com/uBlockOrigin/uAssets/issues).
- [x] This is **NOT** a [_YouTube_](https://www.github.com/uBlockOrigin/uAssets/issues/30157), [_Facebook_](https://www.github.com/uBlockOrigin/uAssets/issues/3367) or [_Twitch_](https://www.github.com/uBlockOrigin/uAssets/issues/5184) report. _These sites MUST be reported by clicking their **respective links**_.
- [x] This is not a support issue or a question. For support, questions, or help, visit [/r/uBlockOrigin](https://www.reddit.com/r/uBlockOrigin/).
- [x] I performed a [cursory search of the issue tracker](https://github.com/uBlockOrigin/uBlock-issues/issues?q=is%3Aissue) to avoid opening a duplicate issue.
- [x] The issue is not present after disabling uBO in the browser.
- [x] I checked the [documentation](https://github.com/gorhill/uBlock/wiki) to understand that the issue I am reporting is not normal behavior.
### I tried to reproduce the issue when...
- [x] uBO is the only extension.
- [x] uBO uses default lists and settings.
- [x] 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.
https://github.com/AdguardTeam/Scriptlets/issues/308
### A specific URL where the issue occurs.
```yaml
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
```text
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
```
22 条评论