1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-25 20:02:51 +01:00
Commit Graph

1404 Commits

Author SHA1 Message Date
Fanboynz
bdb99862ce
Add hide and hidden to set-cookie (#3918) 2024-06-14 14:32:11 -04:00
Raymond Hill
9072772f61
Improve trusted-replace-[fetch|xhr]-response scriptlets
Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/831#discussioncomment-9750621
2024-06-13 09:32:30 -04:00
Raymond Hill
91ee5bdeae
Improve prevent-addEventListener scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3061#issuecomment-2159662039
2024-06-11 07:44:43 -04:00
Raymond Hill
fa6740a059
Improve trusted-replace-outbound-text scriptlet
As per filter list maintainers feedback.
2024-06-05 08:40:02 -04:00
Raymond Hill
cc417a0cd4
Fix transition to AdGuard Dutch from EasyDutch
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3250

Related commit:
f1f63c940b
2024-06-03 10:46:08 -04:00
Raymond Hill
0e1e4b82c5
Improve trusted-set-cookie scriptlet
Replace placehoders instead of direct assignement

Related feedback:
https://github.com/uBlockOrigin/uAssets/pull/23877#issuecomment-2134417389
2024-05-28 09:18:09 -04:00
Raymond Hill
59ffc96e89
Fallback to requestAnimationFrame when requestIdleCallback is not available
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3237
2024-05-16 09:29:12 -04:00
Fanboynz
7f0b2f4a5e
Add Approved/disapproved (#3917) 2024-05-14 21:51:27 -04:00
Raymond Hill
ee67cd6284
Improve trusted-click-element scriptlet
Use `openOrClosedShadowRoot` to lookup shadow root.

Related issue:
https://github.com/AdguardTeam/AdguardFilters/issues/178995
2024-05-14 11:37:19 -04:00
Raymond Hill
ca7d2ad61d
Replace EasyDutch with AdGuard Dutch
Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/380#discussioncomment-9402570
2024-05-12 10:19:37 -04:00
Raymond Hill
f1f63c940b
Replace EasyDutch with AdGuard Dutch
Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/380#discussioncomment-9402570
2024-05-12 10:17:54 -04:00
Raymond Hill
509dba1441
Fix regression in previous commit
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/23652#issuecomment-2105555721

Related commit:
2ccc3135c1
2024-05-11 19:05:14 -04:00
Fanboynz
363ad6795c
Add accept/reject to local-storage (#3916) 2024-05-09 20:51:07 -04:00
Raymond Hill
4d8ee35ef7
Improve noeval-if scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/841#discussioncomment-9320245
2024-05-05 11:46:16 -04:00
Raymond Hill
2ccc3135c1
Improve trusted-set-local-storage-item scriptlet
Related discussion:
df1041c616 (commitcomment-141265533)
2024-05-05 06:54:46 -04:00
Raymond Hill
91dfcbef2a
Improve remove-[attr|class] scriptlets
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3215
2024-04-17 09:17:49 -04:00
Raymond Hill
931f44ae16
Improve logging in m3u-prune scriptlet
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/23042#issuecomment-2050238172
2024-04-11 15:44:07 -04:00
Raymond Hill
89fa666bc4
Improve set-cookie.fn scriptlet
As per browser behavior, space character does not require encoding.
2024-04-10 08:25:24 -04:00
Raymond Hill
277e90a4a7
Improve spoof-css scriptlet 2024-04-09 20:05:05 -04:00
Raymond Hill
c6e99f8490
Improve trusted-replace-outbound-text scriptlet
Add vararg `condition, [pattern]`.
2024-04-02 11:04:27 -04:00
Raymond Hill
21e1ee30ee
Add trusted-replace-outbound-text scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3157

Paremeters:
- `pattern`: a string or regex to match in the outbound text. If
  not provided or empty, the scriptlet will only log the outbound
  text without modifying it.
- `replacement`: the replacement string for the matched part.
2024-04-01 11:27:19 -04:00
Raymond Hill
49ff7cffb1
Improve [trusted-]set-cookie scriptlets
As per RFC 6265 the characters ", should be encoded but apparently
browsers don't care. Remove them from the set of characters which
presence trigger encoding.

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/3178#issuecomment-2029622321
2024-04-01 08:23:10 -04:00
Raymond Hill
7d321c0a11
Spin-off cookie notices/social widgets lists into own category
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3154
2024-03-29 10:23:07 -04:00
Raymond Hill
108f1556c2
Use hard tabs for assets.json 2024-03-26 13:59:12 -04:00
Raymond Hill
11a48561e0
Improve [trusted-]set-cookie scriptlets
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/3178
- https://github.com/uBlockOrigin/uBlock-issues/issues/2777
2024-03-23 11:00:45 -04:00
Raymond Hill
9fd80cf6dd
Improve spoof-css scriptlet 2024-03-20 09:31:17 -04:00
Raymond Hill
61e916901b
Add concept of "preferred" lists
Preferred lists will be visually listed above other lists.
2024-03-19 11:51:03 -04:00
Raymond Hill
9146134874
Improve set-cookie scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3016
2024-03-15 12:29:22 -04:00
Raymond Hill
65b6753c69
Simpler to use an extra property than to use a new assets.json 2024-03-14 10:20:25 -04:00
Raymond Hill
e7a0f8c781
Improve json-prune-related scriptlets
New special properties:
- `[-]`: remove an array entry if part right of `[-]` matches the
  inspected item.
- `{-}`: remove a property if part right of `{-}` mmatches the
  inspected item.

This is useful to remove entries which have unspecified names.
2024-03-12 13:21:16 -04:00
Raymond Hill
633135745f
Need new assets.son file for next release
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3154
2024-03-11 18:41:18 -04:00
Raymond Hill
b95a1e987f
Use hard tabs 2024-03-05 09:03:51 -05:00
Raymond Hill
21a76e32a1
Add "Social widgets", "Cookie notices" sections in "Filter lists" pane
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3154
2024-03-03 15:29:38 -05:00
Raymond Hill
603239970d
Improve spoof-css scriptlet 2024-03-02 08:11:29 -05:00
Raymond Hill
e527a8f9af
Support logging details of calls to json-prune-fetch-response
Example:

    example.com##+js(json-prune-fetch-response)

This will output to the logger details of all fetch() with a
Response.json() call.

Related discussion:
https://github.com/uBlockOrigin/uAssets/discussions/22556
2024-02-19 10:59:12 -05:00
Raymond Hill
33749d2d3f
Use requestIdleCallback() in href-sanitizer scriptlet
Instead of requestAnimationFrame().
2024-02-17 12:53:57 -05:00
Raymond Hill
4832821715
Minor code review 2024-02-15 10:05:10 -05:00
Raymond Hill
84481fcd98
Fix typo in log message 2024-02-15 09:47:15 -05:00
Raymond Hill
ebb110fb3e
Fix logging code in trusted-replace-argument scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/859#discussioncomment-8368839
2024-02-14 11:41:58 -05:00
Raymond Hill
50ebfb9932
Mind that attribute names are case-insensitive
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3121
2024-02-14 08:37:01 -05:00
Raymond Hill
b22b3d729b
Improve prevent-addEventListener scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/3061#issuecomment-1899042062
2024-02-14 08:23:16 -05:00
Raymond Hill
068b625bef
In set-attr, restrict on... attributes to empty string only
As per feedback from https://github.com/distinctmondaylilac

Related commit:
https://github.com/gorhill/uBlock/commit/3037ae5f04

Additionally, added logging ability to the scriptlet.
2024-02-13 19:41:25 -05:00
Raymond Hill
6551cab525
Improve loggger output of prevent-fetch scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3115
2024-02-13 16:12:11 -05:00
Raymond Hill
3037ae5f04
Ignore event handler-related attributes in set-attr scriptlet
As suggested by https://github.com/distinctmondaylilac in internal
email to ubo-security:

> As a sidenote, it may be worth considering if `set-attr` should
> be able to set event handler attributes. It could potentially
> be used to copy the contents of e.g. onclick to other event handlers,
> resulting in self-clicking buttons.
2024-02-13 14:59:00 -05:00
Raymond Hill
9b40b2150a
Fix argument list lookup in trusted-replace-argument scriptlet 2024-02-02 12:46:59 -05:00
Raymond Hill
b4da81f8d4
Improve logging information in prevent-window-open scriptlet 2024-02-02 09:36:08 -05:00
Raymond Hill
605c830312
Review/fix content of assets.json 2024-02-01 18:22:48 -05:00
Raymond Hill
12a9245164
Remove outdated, unused scriptlet
Related commit:
2b2e0fcb14
2024-01-31 11:31:24 -05:00
Raymond Hill
1db54c47e1
Fix the logging of all prevent-xhr calls
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3096#discussioncomment-8309729
2024-01-30 20:52:07 -05:00
Raymond Hill
1e614a7b10
Remove duplicate URL
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3099
2024-01-29 09:04:27 -05:00
Raymond Hill
7282d953b6
Fix last commit
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3096#discussioncomment-8272470

Related commit:
6cfba082f9
2024-01-28 18:54:37 -05:00
Raymond Hill
6cfba082f9
Add more output to logger re. scriptlets 2024-01-28 10:58:41 -05:00
Raymond Hill
55879e6014
Add more output to logger re. scriptlets 2024-01-28 10:27:46 -05:00
Raymond Hill
6c54731a72
Add remove-cache-storage-item scriptlet
Usage:

...##+js(remove-cache-storage-item, cacheNamePattern[, urlPattern])

`cacheNamePattern`: the name of the cache to target. Plain string
  or regex.

`urlPattern`: the URL of the resource to remove. Plain string
  or regex. If no pattern is provided, the whole cache is removed.

Reference:
https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage
2024-01-27 18:17:28 -05:00
Raymond Hill
8be8ac57a7
Bring back ability to log all calls to JSON.parse
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3096
2024-01-27 06:43:36 -05:00
Raymond Hill
302d2f5670
Fix type
Related issue:
https://github.com/uBlockOrigin/uAssets/pull/22228
2024-01-26 22:38:31 -05:00
Raymond Hill
34da372d7a
Ensure scriptlet logging information make it to destination
Avoid race conditions between isolated world-side broadcast channel
and main-side broadcast channel, so as to not lose logging
information if the isolated world-side is not yet ready to
receive through its broadcast channel.

Additionally, added new scriptlet: `trusted-replace-argument`.

[...]##+js(trusted-replace-argument, fn, argpos, argval [,condition, pattern])

Where:

- `fn` is the function we want to proxy through an `apply` handler.
  This can also be a class, in which case the scriptlet will proxy
  through `construct` handler. At the moment, `fn` must exist at the
  time the scriptlet executes.

- `argpos` is the 0-based position of the argument we want to change

- `argval` is the value we want to have for the argument -- the value
  is interpreted the same way the value for `set-constant` is
  interpreted.

- `condition, pattern` is a vararg which tells the scriptlet to act
  only if `pattern` is found in the argument to overwrite.

Example of usage:

    alliptvlinks.com##+js(trusted-replace-argument, MutationObserver, 0, noopFunc)
2024-01-26 12:18:30 -05:00
Raymond Hill
49a6dc868f
Fix verbose mode not applying to newly injected scriptlets
Related commit:
869a653fdf
2024-01-25 13:30:41 -05:00
Raymond Hill
869a653fdf
Output scriptlet logging information to the logger
This commit brings the following changes to the logger:

All logging output generated by injected scriptlets are now sent to
the logger, the developer console will no longer be used to log
scriptlet logging information.

When the logger is not opened, the scriplets will not output any
logging information.

The goal with this new approach is to allow filter authors to
more easily assess the working of scriptlets without having to
go through scriptlet parameters to enable logging.

Consequently all the previous ways to tell scriptlets to log
information are now obsolete: if the logger is opened, the
scriptlets will log information to the logger.

Another benefit of this approach is that the dev tools do not
need to be open to obtain scriptlets logging information.

Accordingly, new filter expressions have been added to the logger:
"info" and "error". Selecting the "scriptlet" expression will also
keep the logging information from scriptlets.

A new button has been added to the logger (not yet i18n-ed): a
"volume" icon, which allows to enable verbose mode. When verbose
mode is enabled, the scriptlets may choose to output more
information regarding their inner working.

The entries in the logger will automatically expand on mouse hover.
This allows to scroll through entries which text does not fit into
a single row.

Clicking anywhere on an entry in the logger will open the detailed
view when applicable.

Generic information/errors will now be rendered regardless of which
tab is currently selected in the logger (similar to how tabless
entries are already being rendered).
2024-01-25 12:20:38 -05:00
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