Commit Graph

306 Commits

Author SHA1 Message Date
Raymond Hill e785b99338
Improve `prevent-fetch` scriptlet
Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/848#discussioncomment-10027757

Added support for AdGuard's `responseType` parameter. Extended the
meaning of that 3rd parameter to also be a JSON string with
properties to set on the returned response instance. Currently
supported properties:

- `ok`, supported values: `false`, `true`
- `type, supported values: `"basic"`, `"cors"`, `"opaque"`

Reference:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-scriptlets.md#-%EF%B8%8F-prevent-fetch
2024-07-13 11:02:54 -04:00
Raymond Hill 66e3a1ad47
Improve `href-sanitizer` scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3297

Mind that the sanitized URL can have Unicode characters beyond
ASCII.
2024-07-10 12:43:36 -04:00
Raymond Hill 97d11c03c2
Add `trusted-suppress-native-method` scriptlet
Reference:
https://github.com/AdguardTeam/Scriptlets/blob/5a92d79489/wiki/about-trusted-scriptlets.md#trusted-suppress-native-method

This is a first draft version, see code comments for details.
2024-07-09 13:03:50 -04:00
Raymond Hill a3576ea651
Add support for `$currentISODate$` in `trusted-set-cookie` scriptlet
Related discussion:
https://github.com/uBlockOrigin/uAssets/discussions/20789#discussioncomment-9979107
2024-07-07 11:19:40 -04:00
Fanboynz 37d31a82d8
Add essential and nonessential to set-cookie (#3919) 2024-07-07 09:25:34 -04:00
Raymond Hill 8eb3b19c69
Improve logging in `prevent-addEventListener` scriptlet
Related feedback:
https://github.com/uBlockOrigin/uAssets/discussions/17907#discussioncomment-9871079
2024-06-25 09:08:46 -04:00
Raymond Hill b4d8750f44
Improve `set-cookie` scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/3178#issuecomment-2178502856
2024-06-19 08:48:54 -04:00
Raymond Hill cb0f65e035
Improve `trusted-replace-node-text` scriptlet
Related discussion:
https://github.com/uBlockOrigin/uAssets/discussions/24143
2024-06-18 10:03:54 -04:00
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 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 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 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 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 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 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 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 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