1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00
Commit Graph

4381 Commits

Author SHA1 Message Date
Raymond Hill
05ae51beb2
Minor code review of last commit
Related commit:
027c7a4fb5
2023-10-16 18:05:41 -04:00
Raymond Hill
027c7a4fb5
Support quoting scriptlet parameters with backticks
(In addition to in already supported single- and double-quote).

The parsing of (optionally) quoted arguments from an argument
list has been spinned off into a standalone helper in order to
be reused in other parts of the parser eventually.
2023-10-16 17:38:57 -04:00
Raymond Hill
c06f5e014f
Prevent redirecting when URL is not transformed
Related commit:
https://github.com/gorhill/uBlock/commit/2e4525fe3c
2023-10-16 11:14:12 -04:00
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
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
3a5606125d
Import translation work from https://crowdin.com/project/ublock 2023-10-10 10:42:14 -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
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
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
b95c90ba7c
Import translation work from https://crowdin.com/project/ublock 2023-09-22 09:36:01 -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
313a3121c9
Do not assume set viewport for popup panel when using portrait mode in descktop
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2814
2023-09-12 20:33:14 -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
ba8820fe31
Import translation work from https://crowdin.com/project/ublock 2023-09-08 09:19:26 -04:00
Raymond Hill
eccfd3b823
Position reload icon in logger as per feedback
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2782
2023-08-22 19:11:52 -04:00
Raymond Hill
3c7f35ed9c
Import translation work from https://crowdin.com/project/ublock 2023-08-22 10:50:04 -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
2bbad0c692
Make permissions= as a modifier in logger 2023-08-17 17:11:47 -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
7bcc340ab0
Add commented keywords to googlesyndication_adsbygoogle.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2773
2023-08-10 09:54:58 -04:00
Raymond Hill
3c609793fd
Improve fingerprint2.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2741
2023-08-09 09:28:05 -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
443c30f18c
Import translation work from https://crowdin.com/project/ublock 2023-08-07 10:46:39 -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
Raymond Hill
fdb6dc2cc2
Fix remnants of visible text in collapsed rows
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2632#discussioncomment-6517792
2023-07-24 07:40:10 -04:00
Viktor Szépe
c23a9ada33
Fix typos 2023-07-23 10:01:08 -04:00
Raymond Hill
c74fc6460e
Add visual hint for filtered out rows in firewall pane
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2632
2023-07-22 09:11:23 -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
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
ef42819b33
Import translation work from https://crowdin.com/project/ublock 2023-07-17 09:36:56 -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