1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-16 23:42:39 +01:00
Commit Graph

1395 Commits

Author SHA1 Message Date
Raymond Hill
45e62c939f
Add support for extraMatch in trusted-click-element scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/20744#issuecomment-1900710708

Reference documentation:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#-%EF%B8%8F-trusted-click-element

Except that in uBO's implementation, if a regex is given as value
to match, it will be tested against an assembled "key=value"
string.
2024-01-20 10:33:36 -05:00
Raymond Hill
588468821c
Add support for differential updates to Swedish list
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3079
2024-01-17 08:13:58 -05:00
Raymond Hill
534d877e95
Shield some code paths against potentially tampered global properties
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/21895#issuecomment-1887472623
2024-01-11 11:41:37 -05:00
Raymond Hill
060f9d68fc
Add elements vararg to prevent-addEventListener scriptlet
If present, `elements` vararg must be a valid CSS selector, which will
be used to apply the scriptlet to only elements matching the
selector.

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3061

Example of usage:

[...]##+js(aeld, click, return"undefined", elements, a.indirect)
2024-01-10 12:46:23 -05:00
Raymond Hill
e1ae17ed00
Improve prevent-fetch scriptlet
Related issue:
https://github.com/AdguardTeam/AdguardFilters/issues/153796
2024-01-01 10:24:47 -05:00
Raymond Hill
d7063a052f
Improve xml-prune scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/21532
2023-12-22 10:15:37 -05:00
Raymond Hill
d01ad24291
Improve no-xhr-if scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2518
2023-12-10 15:21:29 -05:00
Raymond Hill
f2dc195576
Fix URLs for EasyDutch 2023-12-10 13:48:51 -05:00
Raymond Hill
fddca0b7cb
Log all by default when needle is empty in aost scriptlet
As discussed with filter list maintainers.
2023-12-06 10:17:19 -05:00
Raymond Hill
a969a672e0
Change official description in source code top comment 2023-12-04 12:10:34 -05:00
Raymond Hill
941077a25c
Support shadow-piercing combinator >>> in trusted-click-element
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2971

Example usage:

...##+js(trusted-trusted-click-element, #cmpwrapper >>> .cmpboxbtnyes)

The substring before ` >>> ` must select an element with a non-null
shadow root, in which case the substring after ` >>> ` will be used
to find the element in the targeted shadow root. ` >>> ` can be used
recursively when multiple shadow root must be pierced.
2023-12-04 08:02:07 -05:00
Raymond Hill
6aeab2adbc
Improve prevent-fetch scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2526

Improvements:

Support fulfilling the response with the content of a
`web_accessible_resources` resource, using the syntax already
supported by `prevent-xhr`: `war:[name of resource]`

Support fulfilling the response with randomized text with length
specified using `length:min[-max]` directive.
2023-11-25 11:13:57 -05:00
Raymond Hill
f546b4f91d
Update KOR-1 URL as per request 2023-11-22 10:32:14 -05:00
Raymond Hill
a4f8ec6d54
Support AdGuard's emptyArr/emptyObj for increased compatibility
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2411
2023-11-17 09:28:23 -05:00
Raymond Hill
c292a90b90
Fix faulty as vararg in set-constant scriptlet 2023-11-16 13:18:39 -05:00
Raymond Hill
28d92d38f3
Use trusted- prefix for replace-node-text
The official name is `trusted-replace-node-text`.

`replace-node-text` is demoted to alias. `trusted-rpnt` added
asan alias. Aliases not prefixed with `trusted-` are deprecated
and will be removed eventually.

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7567863
2023-11-14 13:53:29 -05:00
Raymond Hill
f3d6a21e7a
Add trusted-set-session-storage-item scriptlet
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/20630#issuecomment-1807390945
2023-11-13 10:36:55 -05:00
Raymond Hill
7c562d0c5c
Allow the use of quotes in set-cookie scriptlet
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/20630#issuecomment-1807260357
2023-11-12 19:26:05 -05:00
Raymond Hill
decafc5cbf
Allow the use of quotes in set-[local|session]-storage-item
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/20630#issuecomment-1807260357
2023-11-12 19:05:56 -05:00
Fanboynz
32fb93c525
Add a few more cookie names (#3907) 2023-11-12 12:51:58 -05:00
Raymond Hill
3db46c1728
Allow for support of more event types
Related commit:
ef311ddbec
2023-11-12 11:44:24 -05:00
Raymond Hill
b3c48fd1ad
Swap canonical name with alias 2023-11-12 10:39:43 -05:00
Raymond Hill
ef311ddbec
Add ability to trigger cookie removal on specific events
As discussed with filter list volunteers.

Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/834
2023-11-12 10:35:28 -05:00
Raymond Hill
f68683f988
Do not use implicit regex flag when pattern is regex
As discussed with filter list volunteers.
2023-11-10 12:31:30 -05:00
Raymond Hill
15e3f763a3
Mind exception filters for replace= option
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2952
2023-11-10 10:45:24 -05:00
Raymond Hill
7dd98258e9
Add stackToMatch vararg to trusted-prune-inbound-object.js
As discussed with filter list maintainers.
2023-11-09 19:57:51 -05:00
Raymond Hill
2bc7996d64
Remove country flag because occurrences below threshold
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/issues/2946
2023-11-09 07:10:25 -05:00
Raymond Hill
cd430386f5
Forgot to git-add this one in last commit 2023-11-07 13:48:32 -05:00
Raymond Hill
74a0af8af6
Replace flag with more relevant one
Related discussion:
https://github.com/EasyDutch-uBO/EasyDutch/issues/92
2023-11-07 13:47:04 -05:00
Raymond Hill
d8d42f2cc1
Synchronize changes in both versions of assets.json 2023-11-06 15:15:57 -05:00
Imre Kristoffer Eilertsen
0962366524
Added additional flags to regional lists (#3904) 2023-11-06 15:11:38 -05:00
Raymond Hill
7823d98070
Harden scriptlets which need to serialize function code into string
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2907
2023-11-06 09:10:21 -05:00
Raymond Hill
cdc3f66a6b
Reset g regexes before use in rmnt/rpnt scriptlets 2023-11-05 20:35:05 -05:00
jambohawk
971f36c78e
Update assets.json
I believe this is a typo?
2023-11-05 17:01:06 -06:00
Raymond Hill
eb93ce862d
Do not use @latest, there is no master branch at uAssetsCDN
Related documentation:
https://github.com/jsdelivr/jsdelivr#omit-the-version-completely-or-use-latest-to-load-the-latest-one-only-works-with-valid-semver-versions-not-recommended-for-production-usage
2023-11-05 17:23:07 -05:00
Fanboynz
4ab1c36ac9
Add t/f to set-cookie (#3905) 2023-11-05 16:07:58 -05:00
Raymond Hill
c5fa273723
Update EasyDutch list to new URLs
Related discussion:
https://github.com/uBlockOrigin/uAssets/discussions/20386
2023-10-31 14:57:50 -04:00
Raymond Hill
d05ff8ffeb
Add support for diff-patching filter lists
Related discussion:
https://github.com/ameshkov/diffupdates

The benefits of diff-patching filter lists is much shorter update
schedule and significantly less bandwidth consumed.

At the moment, only default filter lists are subject to be
diff-patched.

External filter lists can make their lists diff-patchable by
following the specification link above.

Only filter lists fetched by the auto-updater are candidate for
diff-patching.

Forcing a manual update of the filter lists will prevent the
diff-patcher from kicking in until one or more lists are
auto-updated.

Some back-of-the-envelop calculations regarding the load on free
CDN solutions used by uBO to distribute its own filter lists:

Currently, for each CDN (with lists updating after days):
~560 M req/month, ~78 TB/month

With diff-patching lists on a 6-hour schedule:
~390 M req/month, 1 TB/month

Those estimates were done according to statistics shown by
jsDelivr, which is one of 4 CDNs picked randomly when a list
updates:
https://www.jsdelivr.com/package/gh/uBlockOrigin/uAssetsCDN?tab=stats
2023-10-30 12:30:46 -04:00
Raymond Hill
c9aeb6a43b
Use minified version of badware list in package 2023-10-30 00:35:30 -04:00
Raymond Hill
c378d55dfb
Minor 2023-10-29 23:44:43 -04:00
Fanboynz
d51b393fdb
Add additional set-cookie names (#3902) 2023-10-29 11:01:32 -04:00
Raymond Hill
5244ad5baf
Do not use bind as a way to access native calls 2023-10-29 10:22:54 -04:00
Raymond Hill
fc40393c81
Improve trusted-prune-inbound-object scriptlet
Trap incoming argument only if it matches the properties to
prune and matches. If there is no match, the inbound object
is passed through untouched.
2023-10-28 07:35:38 -04:00
Raymond Hill
ed4b31931a
Prepare to ship minified lists in package 2023-10-26 13:38:24 -04:00
Raymond Hill
d32204f984
Match type exactly in prevent-addEventListener scriptlet
Unless `type` is a regex of course.

Related feedback:
https://github.com/uBlockOrigin/uAssets/discussions/17907#discussioncomment-7362212
2023-10-23 21:15:00 -04:00
Raymond Hill
82c59b4b6e
Add domain vararg to trusted-set-cookie
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2893
2023-10-22 18:19:18 -04:00
Raymond Hill
86f0d6dd97
Add trusted-prune-outbound-object.js scriptlet
Essentially a complement of `trusted-prune-inbound-object.js` added in
1c9da227d7

To perform object pruning on any object returned synchronously by
any given call.

The arguments for `trusted-prune-outbound-object` in order are:

- The name of the property to trap. Must be a function, and must
  exist when the scriptlet tries to install the trap.

- The properties to prune (as with `json-prune`)

- The properties which must all be present for pruning to occur
  (as with `json-prune`)

The scriptlets `json-prune.js` and `evaldata-prune.js` essentially
perform the same function, and will eventually be rewritten to
internally delegate to generic `trusted-prune-outbound-object.js`.
2023-10-22 12:35:49 -04:00
Raymond Hill
1c9da227d7
Add trusted-prune-inbound-object scriptlet
As per discussion with filter list maintainers.

To perform object pruning for any given call which has an object
as argument (hence "inbound").

Since `json-prune-stringify` scriptlet is a specific form of
pruning inbound objects, it has been removed.

The arguments for `trusted-prune-inbound-object` in order are:

- The name of the property to trap. Must be a function, and must
  exist when the scriptlet tries to install the trap.

- The position of the object to prune in the argument list when
  the trapped function is called. The position is 1-based and
  must be an integer greater than 0.

- The properties to prune (as with `json-prune`)

- The properties which must all be present for pruning to occur
  (as with `json-prune`)

- Varargs:
  - `, dontOverwrite, 1`: do not modify the target inbound object

Examples:

Remove `title` and `name` properties before passing the object to
`JSON.stringify` call:

  example.org##+js(trusted-prune-inbound-object, JSON.stringify, 1, title name)

Remove `status` property before passing the object to `Object.keys`
call but do not modify caller's instance of the object:

  example.org##+js(trusted-prune-inbound-object, Object.keys, 1, status, , dontOverwrite, 1)
2023-10-21 09:31:50 -04:00
Raymond Hill
607bba6eaf
Add dontOverwrite vararg to (trusted-)set-cookie scriptlet
When the vararg `, dontOverwrite, 1` is present, the scriptlet will
not modify the cookie if it already exists.

Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/19976#issuecomment-1773466740
2023-10-20 21:38:54 -04:00
peace2000
eb66129fbf
Add "on" and "off" values to set-cookie (#3898)
* Add "on" and "off" values to set-cookie

Used on praxisplan.at.

0cd4612e18

* Update scriptlets.js
2023-10-20 20:43:52 -04:00
Raymond Hill
41d91ed080
Fine tune set-local-storage-item as per feedback
Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/20194
- https://github.com/gorhill/uBlock/pull/3898
2023-10-20 20:10:35 -04:00
Raymond Hill
f0cd93335e
Revert "Turns out delay does apply to first element"
This reverts commit 906c6eb430.
2023-10-19 17:23:05 -04:00
Raymond Hill
906c6eb430
Turns out delay does apply to first element
Regarding `trusted-click-element`, and as per documentation
and code:
- https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-scriptlets
- https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/trusted-click-element.js
2023-10-19 14:08:57 -04:00
Raymond Hill
e873fd5378
Add cdn.statically.io as CDN for ublock-quick-fixes (dev build) 2023-10-18 11:38:00 -04:00
Raymond Hill
4dc396ff05
Fix typos in comments 2023-10-18 09:50:58 -04:00
Raymond Hill
9d3acd91b8
Support AdGuard's [trusted-]set-cookie-reload scriptlets
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2881
2023-10-18 09:48:08 -04:00
Raymond Hill
b0fe6d228a
Use @latest instead of @main for jsDelivr CDN 2023-10-17 23:25:06 -04:00
Raymond Hill
51359c6585
[experimental] Add json-stringify scriptlet
Will be evaluated this current dev cycle and as a result
might be removed before next stable.

Other changes to increase code consistency.
2023-10-17 17:33:49 -04:00
Raymond Hill
f122ce7320
Add logging ability to trusted-click-element
If the vararg `, log, 1` is present, the scriptlet will log to
the console it's execution steps. Works only in dev build.
2023-10-16 19:53:48 -04:00
Raymond Hill
5a24fad8ad
Make fine-tuned json-prune-[...] scriptlets the default behavior
As discussed with filter list maintainers.
2023-10-16 19:36:16 -04:00
Raymond Hill
7c660b2aad
Remove stray tab 2023-10-15 16:40:35 -04:00
Raymond Hill
c0d80ac510
Fine tune trusted-click-element scriptlet 2023-10-15 16:14:44 -04:00
Raymond Hill
7af88b025d
Add trusted-click-element scriptlet
Implemented as per AdGuard API documentation:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-click-element

The current implementation in uBO does not support the `extraMatch`
argument. If the extraMatch argument is not empty, the scriptlet
will abort and do nothing.

As for the rest, it complies with the documentation.
2023-10-15 11:08:15 -04:00
Raymond Hill
17d30343c5
Use safe Array.from() in no-xhr-if scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/20063
2023-10-14 08:03:29 -04:00
Raymond Hill
e5c1b63315
Fix overzealous matching in (remove|replace)-node-text scriptlets
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2868
2023-10-13 21:51:13 -04:00
Raymond Hill
6f74df942d
Fix no-xhr-if scriptlet for Firefox
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/20063#issuecomment-1762157408
2023-10-13 21:24:21 -04:00
Raymond Hill
780383faef
Use safe versions of Math.floor/Math.random in scriptlets
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/78
2023-10-09 09:45:26 -04:00
Raymond Hill
ad75b1bdba
Remove unreferenced dependencies
Related commit:
d4918c1d0a
2023-10-07 13:48:28 -04:00
Raymond Hill
d4918c1d0a
Add version vararg to [...]-fetch-response scriptlets
If the `version` vararg is present and set to `2`, and if a
fetch Request argument is present, it will be cloned before
being matched to `propsToMatch` properties.

Additionally, created a `.fn` version of `[...]-fetch-response`
scriptlets to avoid redundant code in final injected scriptlets.
2023-10-07 11:49:17 -04:00
Raymond Hill
6b211f622c
Add stackToMatch vararg to json-prune-related scriptlets
As per discussion with filter list maintainers.
2023-10-05 11:24:35 -04:00
Raymond Hill
d3b95c1c68
Add site-specific scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/19903
2023-09-29 12:51:44 -04:00
Raymond Hill
1ff3878a49
Add prevent-canvas scriptlet
Prevent usage of specific or all (default) canvas APIs.

Syntax

```text
example.com##+js(prevent-canvas [, contextType])
```

- `contextType`: A specific type of canvas API to prevent (default to all
  APIs). Can be a string or regex which will be matched against the type
  used in getContext() call. Prepend with `!` to test for no-match.

Examples

1. Prevent `example.com` from accessing all canvas APIs

```adblock
example.com##+js(prevent-canvas)
```

2. Prevent access to any flavor of WebGL API, everywhere

```adblock
*##+js(prevent-canvas, /webgl/)
```

3. Prevent `example.com` from accessing any flavor of canvas API except `2d`

```adblock
example.com##+js(prevent-canvas, !2d)
```

References

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
2023-09-28 11:26:45 -04:00
Raymond Hill
4e2aa3e384
Add scriptlet aliases for compatibility with AdGuard lists
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2828
2023-09-28 10:07:03 -04:00
Raymond Hill
c3cd596175
Remove unmaintained urlhaus PUP filter list
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2844
2023-09-28 09:49:07 -04:00
Raymond Hill
402e2ebf57
Use AG version of urlhaus list
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/7636#issuecomment-1735697402
2023-09-26 16:20:01 -04:00
Raymond Hill
cce3f3efc1
Minor code review of scriptlets 2023-09-22 09:33:02 -04:00
Daylin Cooper
ce959164bb
Fix XHR hook partial response handling. 2023-09-18 23:39:17 -07:00
Raymond Hill
98e1b264de
Update scriptlets
Allow smaller multipliers in nano-sib/nano-stb
https://github.com/uBlockOrigin/uBlock-issues/issues/2808

Remove adfly-defuser, which is now unused.
2023-09-14 11:13:58 -04:00
Raymond Hill
d5fb3c08a1
Remove broken content link for ROU list 2023-09-10 16:10:04 -04:00
Raymond Hill
b2d8c9a0ba
Drop cdn.statically.io for quick-fixes for the time being 2023-09-08 09:35:19 -04:00
Raymond Hill
14d60ac5d3
Fix json-prune-xhr-response as per feedback
Related commit:
abe41034f6
2023-09-06 13:04:43 -04:00
Raymond Hill
abe41034f6
Change approach to ...-xhr-response scriptlets
Related commit:
3152896d42
2023-09-05 14:11:33 -04:00
Raymond Hill
3152896d42
Add json-prune-xhr-response and trusted-replace-xhr-response scriptlets
As discussed with filter list maintainers.

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2743
2023-09-04 14:54:57 -04:00
Raymond Hill
2282215e1c
Use globalThis instead of self in scriptlet helper
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2768
2023-08-25 07:28:50 -04:00
Raymond Hill
4fc8eef1c1
Fix typo in last commit 2023-08-23 09:45:58 -04:00
Raymond Hill
749cec0f09
Add json-prune-fetch-response scriptlet
As per request from filter list maintainers.

Usage:

  ...##+js(json-prune-fetch-response, prune paths [, needle paths [, ...varargs ]])

See `json-prune` scriptlet for usage.

Possible variable arguments:

  ..., log, [match | nomatch | all]
  ..., propsToMatch, [see prevent-xhr]
2023-08-23 08:49:22 -04:00
Raymond Hill
f407c28a00
Re-factor extra args for set-constant scriptlet
To prepare for better compatibility with AdGuard's own `set-constant`
scriptlet.

The 3rd position parameter which dictates how to set the value has
been converted into a vararg paramater, as follow:

  ..., as, function
  ..., as, callback
  ..., as, resolved
  ..., as, rejected

Similarly, the parameter used to dictate when the scriptlet
should become effective is now to be used as a vararg:

  ..., runAt, load

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2783

Ideally, AdGuard would support its `stack` parameter as a
vararg, to be discussed.
2023-08-22 10:12:08 -04:00
Raymond Hill
4b83101ab9
Fix/improve xml-prune scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/14849#issuecomment-1257094491
2023-08-20 08:36:16 -04:00
Raymond Hill
b699691e40
Minor code review of scriptlets 2023-08-19 19:21:22 -04:00
Raymond Hill
62f2a3e68d
Fix broken mapping between scriptlet aliases and canonical name
Related commit:
bf591d93fb
2023-08-14 13:09:19 -04:00
Raymond Hill
bf591d93fb
Imrpove no-xhr-if scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2773

The `randomize` paramater introduced in https://github.com/gorhill/uBlock/commit/418087de9c
is now named `directive`, and beside the `true` value which is meant
to respond with a random 10-character string, it can now take the
following value:

  war:[web_accessible_resource name]

In order to mock the XHR response with a web accessible resource. For
example:

  piquark6046.github.io##+js(no-xhr-if, adsbygoogle.js, war:googlesyndication_adsbygoogle.js)

Will cause the XHR performed by the webpage to resolve to the content
of `/web_accessible_resources/googlesyndication_adsbygoogle.js`.

Should the resource not exist, the empty string will be returned.
2023-08-14 10:03:50 -04:00
Raymond Hill
418087de9c
Improve no-xhr-if scriptlet
Now support AdGuard's `randomize` parameter. If `true`,
the scriplet will generate a random 10-character string
to be returned as the response.

Reference:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#prevent-xhr

AdGuard's `prevent-xhr` also support `length:n-m` form,
but since I do not see it being used, for now it's not
supported in uBO's `no-xhr-if`.

Additionally, the scriptlet will now honor `responseType` and
return the proper response type accordingly.
2023-08-13 13:23:41 -04:00
Raymond Hill
ef865bea19
Add more info to logged output 2023-08-09 11:18:04 -04:00
Raymond Hill
cfac880cf5
Improve logging abilities of object-prune.fn 2023-08-09 11:05:53 -04:00
Raymond Hill
b4ffd16db6
Fix/improve logging in json-prune scriptlet 2023-08-09 08:02:45 -04:00
Raymond Hill
2c04b5a982
Add ability to distinguish trapped entry point in json-prune 2023-08-08 12:30:42 -04:00
Raymond Hill
4f082a96bc
Support negated pattern for *[pP]ropsToMatch values in scriptlets 2023-08-08 12:20:03 -04:00
Raymond Hill
f8394ff2d5
Add variable argument fetchPropsToMatch to json-prune scriptlet
`fetchPropsToMatch` is an optional variable argument. If provided,
the scriplet will take effect only when the JSON data is obtained
through `Response.json()` and if there is a match with the value of
`fetchPropsToMatch` and the properties of the `Response` instance.

Examples of usage:

...##+js(json-prune, ads, , , fetchPropsToMatch, ?param=)
...##+js(json-prune, ads, , , fetchPropsToMatch, url:?param= method:get)

The optional variable argument `fetchPropsToMatch` acts as an additional
narrowing condition to fulfill before the JSON data is pruned.
2023-08-08 10:18:34 -04:00
Raymond Hill
8bf1ed954d
Move often-used scriptlet dependencies to safe-self 2023-08-08 07:41:21 -04:00
Raymond Hill
1762ea3950
Generate new Response when no match in trusted-replace-fetch-response scriptlet
Somehow, sending the original Response instance causes issues.
2023-08-07 13:06:54 -04:00
Raymond Hill
d28b715811
Fix broken trusted-replace-fetch-response when using propsToMatch 2023-08-07 10:37:47 -04:00
Raymond Hill
2c2fd5f21d
Improve trusted-replace-fetch-response as per feedback
Specifically, the variable argument `log` can take one of three
values to enable logging mechanism:

  ..., log, match => log only when there is a match
  ..., log, nomatch => log only when there is no match
  ..., log, all => log unconditionally
2023-08-06 11:19:10 -04:00
Raymond Hill
60fcdf8e71
Update main URL of urlhaus lists
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2766
2023-08-06 09:19:35 -04:00
Raymond Hill
7de61bb4d8
Fix broken "Phishing URL Blocklist" URL
Related feedback:
https://www.reddit.com/r/uBlockOrigin/comments/15iwvqi/
2023-08-05 12:38:10 -04:00
Raymond Hill
82a7d11f78
Add trusted-replace-fetch-response scriptlet
This scriplet requires a trusted source.

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2742

See AdGuard's documentation for usage:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-trusted-scriptlets.md#trusted-replace-fetch-response
2023-08-05 11:55:47 -04:00
Raymond Hill
64b849ab0b
Harden spoof-css scriptlet 2023-08-02 11:36:54 -04:00
Raymond Hill
84cc69aa10
Support negated pattern for stack test in scriptlets
Prepend pattern with `!` to test for unmatched patterns in
stack trace. This applies to sctiplet parameters which purpose
is to test against the stack, i.e. `aost` and `json-prune`.

Additionally, dropped support for JSON notation in favor of
optional variable arguments notation.

Related discussion:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/789#discussioncomment-6520330
2023-07-31 09:38:04 -04:00
Raymond Hill
81b2fcee5d
Fine tune logging capabilities of json-prune scriptlet
This extends logging capabilities of `json-prune` scriptlet as
follow:

  ...##+js(json-prune, a, b, stackNeedle, log, [logneedle], logstack, 1)

Whereas before, the only way to log `json-prune` usage was to skip
providing the property chain:

  ...##+js(json-prune, , b)

Where `b` was the expression to filter out logging output.

With the extended logging capabilities, the logging output can
be filtered out with `logneedle`, which can be a regex literal.

Additionally, to log the stack trace the `stackNeedle` argument
must be set to non-empty string. You can use `/.^/` to log the
stack trace without matching it.
2023-07-29 10:22:52 -04:00
Raymond Hill
bc74ea82af
Deploy changes in assets.dev.json to assets.json
Related commit:
- https://github.com/gorhill/uBlock/commit/f6954430d197
2023-07-28 11:16:59 -04:00
Raymond Hill
4649ae4d78
Add stackNeedle argument to json-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2757
2023-07-27 09:41:56 -04:00
Raymond Hill
6d7674e69f
Improve logic to detect XMLDocument response in xml-prune
Related discussion:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/792#discussioncomment-6561841

Additionally, added extra parameter `..., logdoc, 1` to allow dumping whole
document being worked on to the console.
2023-07-27 08:39:28 -04:00
Raymond Hill
ba31d3c898
Convert abort-current-script to variable paramater list
Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/19154
2023-07-25 09:22:47 -04:00
Raymond Hill
334a7440f3
Improve xml-prune scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/792#discussioncomment-6536598
2023-07-25 09:06:54 -04:00
Raymond Hill
fa489fdb87
Improve remove-class behavior
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2750
2023-07-24 07:33:33 -04:00
Viktor Szépe
c23a9ada33
Fix typos 2023-07-23 10:01:08 -04:00
Raymond Hill
8ddad9e39b
Add $currentISODate$ to trusted-set-local-storage-item scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/19120#issuecomment-1646524557

Additionally, improve logging in `m3u-prune` scriptlet.
2023-07-22 07:57:47 -04:00
peace2000
da8fe2f950
Add 'deny' as valid value for set-cookie (#3897)
AG added it as well.

6f36f888bb
2023-07-22 06:31:27 -04:00
Raymond Hill
03d0d8d4ce
Eliminate case-sensitivity from values in set-cookie scriptlet
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18762#discussioncomment-6338716

Additionally, add `allow` as valid value.
2023-07-20 07:53:14 -04:00
Raymond Hill
ee0649329c
Remove obsolete web_accessible_resources
Add removed resource as an alias of `no-window-open-if.js`.

Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/19002#issuecomment-1638367659
2023-07-18 09:39:06 -04:00
Raymond Hill
ec06981965
Improve compatibility with AdGuard's scriptlets
Related:
https://testcases.agrd.dev/Filters/scriptlet-rules/test-scriptlet-rules.html
2023-07-11 18:25:21 -04:00
Raymond Hill
6e78ee096a
Fix handling of empty strings for set/set-attr scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2729
2023-07-11 15:10:27 -04:00
Raymond Hill
786d9b2212
Add set-attr scriptlet
Reference:
- https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/set-attr.js

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2347
2023-07-06 08:51:31 -04:00
Raymond Hill
fea6f7f311
Do not bail too early when trapping properties in acs scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2130#issuecomment-1621684566
2023-07-05 10:00:31 -04:00
Raymond Hill
083a318090
Add set-session-storage-item scriptlet
Reference:
- https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/set-session-storage-item.js
2023-07-04 07:13:22 -04:00
Raymond Hill
1f57822c33
Add Accept/Reject as valid values for set-cookie scriptlet
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18762
2023-07-01 10:25:19 -04:00
Raymond Hill
e0b4b3d830
Add alias for scriptlet to increase compatibility with AdGuard filter lists 2023-07-01 10:20:23 -04:00
Raymond Hill
b283d6aa33
Add support to remove values in set-local-storage-item scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2697#discussioncomment-6278359

When using the special value `$remove$`, the scriptlet will remove
the item from the local storage.
2023-06-30 09:03:17 -04:00
Raymond Hill
fd036a51ee
Add compatibility with AdGuard's #%#//scriptlet(...) syntax
Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/332

Additionally, uBO's own scriplet syntax now also accept quoting
the parameters with either `'` or `"`. This can be used to avoid
having to escape commas when they are present in a parameter.
2023-06-28 19:35:22 -04:00
Raymond Hill
e0b3b44080
Skip regex-testing context when no context provided
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18725

Testing the context was causing the deprecated static property
RegExp.$1 to be clobbered, causing webpage breakage because this
property was subsequently used used by the caller.
2023-06-28 18:12:17 -04:00
Raymond Hill
ea4afc0610
Minor code review of set-local-storage-item scriptlet 2023-06-23 08:23:08 -04:00
Raymond Hill
f6954430d1
Add support for sublist at any tree depth in "Filter lists" pane 2023-06-21 09:11:21 -04:00
Raymond Hill
9607cba1f6
Group EasyList cookies and uBO cookies as sublists of EasyList/uBO cookies 2023-06-20 13:44:08 -04:00
Raymond Hill
2271834e5c
Revert "Combine EasyList and uBO cookie-related lists"
This reverts commit 13fdf25170.
2023-06-20 12:36:28 -04:00
Raymond Hill
13fdf25170
Combine EasyList and uBO cookie-related lists 2023-06-20 12:01:50 -04:00
Raymond Hill
9443ba80a0
Add set-local-storage-item/trusted-set-local-storage-item scriptlets
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2697
2023-06-20 10:59:48 -04:00
Raymond Hill
7901a00bd7
Fix handling of path in set-cookie scriptlet
As per feedback from filter list volunteers.
2023-06-18 15:13:54 -04:00
Raymond Hill
bd7318da3c
Fix m3u-prune scriptlet
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/14cbznu/foxcom_ssai_workaround/
2023-06-18 14:29:11 -04:00
Raymond Hill
0bd4b600cf
Rework nowoif scriptlet
New official name: `no-window-open-if`.

The pattern will now be matched against all arguments passed
to `window.open()`: all the arguments are joined as a single
space-spearated string, and the result is used as the target
for matching the pattern.

To enable logging, used the extra parameters approach, i.e.
`log, 1`, which should come after the positional arguments
`pattern`, `delay`, and `decoy`.
2023-06-17 11:53:08 -04:00
Raymond Hill
112e41b9d5
Fine tune new set-cookie/trusted-set-cookie scriptlet
Added support for extra parameter `reload, 1`. If present,
the scriplet will force a reload of the webpage if the cookie
being set was not already set.

As per feedback from filter list maintainers.
2023-06-16 11:32:12 -04:00
Raymond Hill
5d596b644d
Remove stray whitespaces 2023-06-15 20:00:57 -04:00
Raymond Hill
eaea26b5e9
Add trusted-set-cookie scriptlet
This new scriptlet is only valid when used in a trusted lists.

Implementation follows:
https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/trusted-set-cookie.js
2023-06-15 19:57:10 -04:00
Raymond Hill
27a54c0845
Add set-cookie scriptlet
This new scriptlet is only valid when used in a trusted lists.

Implementation follows:
https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/set-cookie.js#L16
2023-06-15 11:08:35 -04:00
Raymond Hill
103bdb63c5
Use hard tabs 2023-06-09 08:02:29 -04:00
Raymond Hill
5e46978b8c
Update contentURL of NLD
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/17919
2023-06-09 07:59:43 -04:00
Raymond Hill
257cfad90d
Update assets.json for uBO 1.50.0
This may cause some list namesw to not be rendered in a quirky
way in Chromium-based browsers due to country flags emojis not
being available, but this will fixed once people move to
uBO 1.50.0.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645

References:
- https://en.wikipedia.org/wiki/Regional_indicator_symbol
2023-06-07 10:31:46 -04:00
Raymond Hill
f8c4b8e52d
Add support to remove attributes in xml-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18244
2023-06-05 08:51:20 -04:00
Raymond Hill
f3b720d532
Improve href-sanitizer scriptlet 2023-05-30 09:13:46 -04:00
Raymond Hill
56e1d92dbd
Fix/improve scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2678
- https://github.com/uBlockOrigin/uAssets/issues/18278
2023-05-30 08:38:35 -04:00
Raymond Hill
2a3a796d33
Minor fix 2023-05-29 15:05:50 -04:00
Raymond Hill
a1a3477b07
Fix oversight in last commit 2023-05-29 14:54:13 -04:00