1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 14:17:11 +02:00
Commit Graph

2982 Commits

Author SHA1 Message Date
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
9a809a8e7c
Fix comment 2023-10-15 11:06:40 -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
f15dff27fe
Minor code review 2023-10-10 13:30:18 -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
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
20d3c6a466
Fix detection of leading combinators
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2778#issuecomment-1722488224
2023-09-17 10:37:43 -04:00
Raymond Hill
7ef3408712
Fix regression in :is() operator
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2818
2023-09-16 09:45:46 -04:00
Raymond Hill
2571660161
Fix removal of :scope prefix in :has() operator
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2778#issuecomment-1705101771
2023-09-11 12:34:53 -04:00
Raymond Hill
77c3ad2812
Fix bad regression in cosmetic filtering
Related commit:
393fd90f9d
2023-08-20 13:14:36 -04:00
Raymond Hill
55d068aca3
Use Unicode version of hostnames in element picker
Related feedback:
https://www.reddit.com/r/uBlockOrigin/comments/15vfkm6/
2023-08-20 11:27:19 -04:00
Raymond Hill
393fd90f9d
Disallow trailing CSS universal selector unless properly separated
Related discussion:
https://www.reddit.com/r/uBlockOrigin/comments/15tzgud/ads_on_twitterx_again/jwn8bkj/
2023-08-20 10:41:43 -04:00
Raymond Hill
0ad456e905
[mv3] Rename uBOL-issues repo to uBOL-home
From now on, new uBOL releases will go into uBOL-home repo.
2023-08-19 11:26:33 -04:00
Raymond Hill
857abb380b
[mv3] Add support for converting ^responseheader() filters to DNR
Additionally, finalize versioning scheme for uBOL. Since most updates
will be simply related to update rulesets, the version will from now
on reflects the date at which the extension package was created:

  year.month.day.minutes

So for example:

  2023.8.19.690
2023-08-19 07:48:14 -04:00
Raymond Hill
dde246f202
Do not issue extraneous doc separators in logger 2023-08-17 09:28:29 -04:00
Raymond Hill
fbc7a0e0ae
Properly serialize CSS combinators according to position in selector
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2778

Regression from:
bb41d9594f

The regression occurred because the modified code made the assumption
that a leading combinator would never be preceded by whitespace, while
the parser didn't prevent this.

The parser has been fixed to ensure there is never a leading
whitespace in a selector.
2023-08-15 10:07:42 -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
bb41d9594f
[mv3] Use workaround to inject scriptlets in Firefox
Additionally:

Use `export UBO_VERSION=local` at the console to build MV3 extension using
current version of uBO code base. By default, the version is taken from
`./platform/mv3/ubo-version' and usually set to last stable release.
2023-08-11 13:22:25 -04:00
Raymond Hill
79ed0c76cb
Use non-normalized URL for reload/report operations
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2774
2023-08-10 12:10:19 -04:00
Raymond Hill
a3a2ac5ec0
Nothing can come after action operator in procedural cosmetic filters
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2760
2023-08-09 08:26:35 -04:00
Raymond Hill
96d7b278b4
Output scriplet errors to console in dev build 2023-08-08 10:29:54 -04:00
Raymond Hill
9ac18318af
Fix parsing cosmetic filter anchor when using AdGuard/ABP modifiers
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2765
2023-08-07 13:58:15 -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
223e230e49
Fix looking up clickable URLs in code viewer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2759
2023-07-29 10:51:15 -04:00
Viktor Szépe
c23a9ada33
Fix typos 2023-07-23 10:01:08 -04:00
Raymond Hill
e23ce99f34
Use , when normalizing list of selectors 2023-07-20 08:05:58 -04:00
Raymond Hill
9ead6ad5ac
Remove obsolete entry
Related commit:
- ee0649329c
2023-07-18 09:42:28 -04:00
Raymond Hill
cf43be53a6
Fix overly wide source link button
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2735
2023-07-17 09:17:33 -04:00
Raymond Hill
aa6baf9a29
Fix regression in handling of experimental header= filter option
Also completed fix for reverse lookup issues related to `header=`
filter option:
https://github.com/uBlockOrigin/uBlock-issues/issues/1932
2023-07-14 09:02:10 -04:00
Raymond Hill
0da7e12ea4
Only already normalized CSS selectors can be fast path-compiled
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2730

CSS selectors used in cosmetic filtering are normalized in order
to ignore non-functional differences. For instance:

    example.org##body      p
    example.org#@#body p

The first cosmetic filter should be excepted by the second one,
but this was not the case because the fast path use to compile
common CSS selectors was not causing normalization to take
place.

The fix is to ensure that the fast path used to compile most
common CSS selectors is taken only when in presence of already
normalized CSS selectors.
2023-07-13 18:02:10 -04:00
Raymond Hill
fbcd6cf29b
Add scriptlet alias for increased compatibility with AdGuard's lists
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2729#issuecomment-1632373662
2023-07-12 07:50:12 -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
4a83b80328
[mv3] Properly enforce generic cosmetic exception filters
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/58
2023-07-11 14:38:35 -04:00
Raymond Hill
4a570c151f
[mv3] Merge modifyHeaders rules where feasible 2023-07-10 13:13:20 -04:00
Raymond Hill
ff7c3d0ad6
Add permissions= handling to built-in benchmark 2023-07-10 12:00:02 -04:00
Raymond Hill
0f6400c160
[mv3] Add support for permissions= filter option
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714
2023-07-10 11:56:57 -04:00
Raymond Hill
de5241ab36
[mv3] Reject filters with unsupported modifier options
For example, filters with `permissions` option.
2023-07-09 09:26:50 -04:00
Raymond Hill
5ebdbf3e24
Add static network filter option: permissions
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714

Reference:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#permissions-modifier

Example:

    ||example.org^$permissions=browsing-topics=()

Difference with AdGuard's syntax: use `|` to separate permissions
policy directives instead of `\,` -- uBO will replace instances
of `|` with `, `:

    *$permissions=oversized-images=()|unsized-media=()

Eventually uBO will support AdGuard's syntax of using escaped
commas, but not for this first iteration.
2023-07-09 08:03:47 -04:00
Raymond Hill
5739562d10
Use browser.storage.local API for Firefox + private mode
But only if the indexedDB is being created.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2725
2023-07-06 19:58:05 -04:00
Raymond Hill
872eafa378
[mv3] Add support for highly generic cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/54
2023-07-06 15:45:45 -04:00
Raymond Hill
80b3f3c3c0
Fix regression in cloud storage import of "Filter lists" pane
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2721
2023-07-04 07:27:14 -04:00
Raymond Hill
60b21b1422
Prevent negative position when widget size is greater than viewport size
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2718
- https://github.com/uBlockOrigin/uBlock-issues/issues/2704
2023-07-03 07:14:52 -04:00
Raymond Hill
e52da39839
Fine tune network filter option anchor detection
The change allows to better parse AdGuard filters with `replace=`
option when the value to the `replace=` option contains dollar
sign character `$`. uBO will still reject these filters but will
better identify which dollar sign `$` is the real filter option
anchor.
2023-07-03 06:54:46 -04:00
Raymond Hill
622cda2cdf
Add visual hint when not all sublists are enabled
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2687
2023-07-03 06:49:09 -04:00
Raymond Hill
33b409dd5b
Add support for AdGuard's noop (_) network filter option
Reference:
- https://adguard.com/kb/general/ad-filtering/create-own-filters/#noop-modifier

uBO already supported the noop filter option `_` to allow filter
authors to resolve possible ambiguities arising when crafting network
filters with many options.

AdGuard extended the semantic of the `_` option to also resolve
readability issues by supporting multiple instances of the `_` option
in a single filter, and also by supporting any number of consecutive
`_` in a single noop filter option.
2023-06-30 16:09:21 -04:00
Raymond Hill
b44815f0c8
Ensure no negative value for top property of floating widget in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2704
2023-06-30 11:45:34 -04:00
Raymond Hill
194354cd5d
Add support for logical expressions to !#if directive
Reference:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#conditions-directive

This commit should make uBO fully compatible with the `!#if`
directives found throughout AdGuard's filter lists.

Additionally, added the new `!#else` directive for convenience
to filter list authors:

    !#if cap_html_filtering
    example.com##^script:has-text(fakeAd)
    !#else
    example.com##+js(rmnt, script, fakeAd)
    !#endif
2023-06-29 14:50:42 -04:00
Raymond Hill
9433b218f7
Remove obsolete code 2023-06-29 14:49:43 -04:00