Commit Graph

11396 Commits

Author SHA1 Message Date
Raymond Hill 2e4525fe3c
Add new static network filter option: `urltransform`
The `urltransform` option allows to redirect a non-blocked network
request to another URL. There are restrictions on its usage:

- require a trusted source -- thus uBO-maintained lists or user
  filters
- the `urltransform` value must start with a `/`

If at least one of these conditions is not fulfilled, the filter
will be invalid and rejected.

The requirement to start with `/` is to enforce that only the path
part of a URL can be modified, thus ensuring the network request
is redirected to the same scheme and authority (as defined at
https://en.wikipedia.org/wiki/Uniform_Resource_Identifier#Syntax).

Usage example (redirect requests for CSS resources to a non-existing
resource, for demonstration purpose):

    ||iana.org^$css,urltransform=/notfound.css

Name of this option is inspired from DNR API:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/declarativeNetRequest/URLTransform

This commit required to bring the concept of "trusted source" to
the static network filtering engine.
2023-10-16 09:47:29 -04:00
Raymond Hill bee64ebd90
Support pane: mark lists as obsolete only when update button is clicked
Lists older than 2 hours were unconditionally marked as obsolete when
opening the _Support_ pane. Those lists will now be marked as obsolete
only when the _Update now_ button in the _Support_ pane is pressed, i.e.
when launching an update cycle.

Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/781#discussioncomment-7287323
2023-10-16 07:33:38 -04:00
Raymond Hill b1530e2659
Fix #2874 as suggested 2023-10-15 20:16:44 -04:00
Raymond Hill 763e9eb2a8
Make Firefox dev build auto-update 2023-10-15 16:51:30 -04:00
Raymond Hill 99fb888328
New revision for dev build 2023-10-15 16:41:08 -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 906c6072d6
Make Firefox dev build auto-update 2023-10-15 13:46:14 -04:00
Raymond Hill 349825ac08
New revision for dev build 2023-10-15 13:35:06 -04:00
Raymond Hill c96a673338
Bring `header=` filter option out of experimental status
Related commits:
- bde3164eb4
- 5db8d05975

Reference documentation:
https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#header

Compatible with AdGuard's `header=` option:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#header-modifier

Partially compatible with ABP's `header=` option: Not compatible if
a header value is specified, as ABP requires `=` as separator between
the header name and header value, whereas uBO and AdGuard require `:`
as separator. If no header value is present, the option becomes compatible
with ABP's syntax.
https://gitlab.com/adblockinc/ext/adblockplus/adblockplusui/-/issues/898
2023-10-15 13:17:13 -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 9a809a8e7c
Fix comment 2023-10-15 11:06:40 -04:00
Raymond Hill b41c4c25e3
Make Firefox dev build auto-update 2023-10-14 14:06:03 -04:00
Raymond Hill d25306f300
Modify `manifest.json` for other platforms
As per 0325dcdcb4
2023-10-14 13:55:46 -04:00
Raymond Hill 006f4ed68f
New revision for dev build 2023-10-14 13:52:39 -04:00
Raymond Hill 0325dcdcb4
Add ability to update lists through links with specifically crafted URLs
As per discussion with uBO volunteers.

Volunteers offering support for uBO will be able to craft links with
specially formed URLs, which once clicked will cause uBO to automatically
force an update of specified filter lists.

The URL must be crafted as shown in the example below:

https://ublockorigin.github.io/uAssets/update-lists.html?listkeys=ublock-filters,easylist

Where the `listkeys` parameter is a comma-separated list of tokens
corresponding to filter lists. If a token does not match an enabled
filter list, it will be ignored.

The ability to update filter lists through a specially crafted link
is available only on uBO's own support sites:

- https://github.com/uBlockOrigin/
- https://reddit.com/r/uBlockOrigin/
- https://ublockorigin.github.io/

Additionally, a visual cue has been added in the "Filter lists" pane
to easily spot the filter lists which have been recently updated, where
"recently" is currently defined as less than an hour ago.
2023-10-14 13:41:49 -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 70f247d7f5
Make Firefox dev build auto-update 2023-10-13 22:05:56 -04:00
Raymond Hill 657d34c371
New revision for dev build 2023-10-13 21:54:08 -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 be60ac33c2
Make Firefox dev build auto-update 2023-10-13 21:36:11 -04:00
Raymond Hill 9bd85d4142
New revision for dev build 2023-10-13 21:25:26 -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 fb42411efb
Add `browser_specific_settings.gecko_android` to Firefox manifests
Reference:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings
2023-10-11 12:32:38 -04:00
Raymond Hill f15dff27fe
Minor code review 2023-10-10 13:30:18 -04:00
Raymond Hill 3a5606125d
Import translation work from https://crowdin.com/project/ublock 2023-10-10 10:42:14 -04:00
Raymond Hill e376712ee1
Make Firefox dev build auto-update 2023-10-10 10:36:38 -04:00
Raymond Hill 72f33ea1dc
New revision for dev build 2023-10-10 10:24:48 -04:00
Raymond Hill 437453233d
Support restoring from `application/json` file
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2853
2023-10-10 10:16:55 -04:00
Raymond Hill 0a18f75897
Fix dumping of CFE internals when no cosmetic filters present 2023-10-09 11:12:10 -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 92ca156c56
Make Firefox dev build auto-update 2023-10-07 12:35:49 -04:00
Raymond Hill 078bb7b102
New revision for dev build 2023-10-07 12:28:54 -04:00
Raymond Hill 02c7b32bef
Improve `google-ima.js` surrogate
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265
- https://github.com/uBlockOrigin/uAssets/issues/19981
2023-10-07 12:27:03 -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 67f1d7de66
Make Firefox dev build auto-update 2023-10-05 11:36:20 -04:00
Raymond Hill d94ee8d6e1
New revision for dev build 2023-10-05 11:28:41 -04:00
Raymond Hill bd71d131a8
Catch unhandled exceptions
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/77
2023-10-05 11:25:28 -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 7416340144
Prune rules with invalid regex-based filter for all realms
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/77
2023-10-03 10:51:47 -04:00
Raymond Hill 1268f7733e
Make Firefox dev build auto-update 2023-10-02 09:06:17 -04:00
Raymond Hill 50140f3da7
New revision for dev build 2023-10-02 08:59:26 -04:00
Raymond Hill 4cac9d185b
Reduce race conditions in scriptlet injection on Firefox
This is done by taking advantage through Firefox-specific
contentScripts.register() API:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/contentScripts
2023-10-02 08:42:03 -04:00
Raymond Hill f580cb414d
Make Firefox dev build auto-update 2023-09-29 13:00:48 -04:00
Raymond Hill 34f18acca5
New revision for dev build 2023-09-29 12:53:29 -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 c20cfd41a9
Make Firefox dev build auto-update 2023-09-28 10:15:47 -04:00
Raymond Hill 2ca4b73f95
New revision for dev build 2023-09-28 10:09:52 -04:00