1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 19:52:51 +02:00
Commit Graph

4494 Commits

Author SHA1 Message Date
Raymond Hill
0b9b5a4802
Enable dev console by default in dev build 2023-10-22 12:33:10 -04:00
Raymond Hill
8c283d4d38
Flush the registered scriptlet cache as needed only
Related commit:
e5b438257f
2023-10-22 12:31:33 -04:00
Raymond Hill
f1ce3b2191
Add warning against adding custom filters from untrusted sources
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7351138
2023-10-22 10:47:52 -04:00
Raymond Hill
e33c0f9d9c
Minor refactoring plus other minor changes
Added more evocative error messages to linter.

Made the content of _My filters_ trusted by default in
dev build.
2023-10-22 08:53:01 -04:00
Raymond Hill
64c1f8767c
Add ability to control trusted status of filter lists
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895

Changes:

The _content of the My filters_ pane is now considered untrusted by
default, and only uBO's own lists are now trusted by default.

It has been observed that too many people will readily copy-paste
filters from random sources. Copy-pasting filters which require trust
represents a security risk to users with no understanding of how the
filters work and their potential abuse.

Using a filter which requires trust in a filter list from an untrusted
source will cause the filter to be invalid, i.e. shown as an error.

A new advanced setting has been added to control which lists are
considered trustworthy: `trustedListPrefixes`, which is a space-
separated list of tokens. Examples of possible values:

- `ublock-`: trust only uBO lists, exclude everything else including
  content of _My filters_ (default value)

- `ublock- user-`: trust uBO lists and content of _My filters_

- `-`: trust no list, essentially disabling all filters requiring
  trust (admins or people who don't trust us may want to use this)

One can also decide to trust lists maintained elsewhere. For example,
for stock AdGuard lists add ` adguard-`. To trust stock EasyList lists,
add ` easylist-`.

To trust a specific regional stock list, look-up its token in
assets.json and add to `trustedListPrefixes`.

The matching is made with String.startsWith(), hence why `ublock-`
matches all uBO's own filter lists.

This also allows to trust imported lists, for example add
` https://filters.adtidy.org/extension/ublock/filters/` to trust all
non-stock AdGuard lists.

Add the complete URL of a given imported list to trust only that one
list.

URLs not starting with `https://` or `file:///` will be rejected,
i.e. `http://example.org` will be ignored.

Invalid URLs are rejected.
2023-10-21 19:29:10 -04:00
Raymond Hill
e5b438257f
Ensure scriptlet cache is reset when filtering profile changes
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2896

TODO: Eventually, distinguish between filtering profile increasing
or decreasing so as to avoid flushing caches when increasing
filtering, which should not affect the scriptlets cache.
2023-10-21 14:25:26 -04:00
Raymond Hill
287f7711aa
Import translation work from https://crowdin.com/project/ublock 2023-10-21 08:19:28 -04:00
Raymond Hill
9d3acd91b8
Support AdGuard's [trusted-]set-cookie-reload scriptlets
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2881
2023-10-18 09:48:08 -04:00
Raymond Hill
5bd40b34cd
Support pairing doc with urltransform
Related feedback:
2e4525fe3c (commitcomment-130203742)
2023-10-18 09:06:28 -04:00
Raymond Hill
74a4772e41
Fix comment 2023-10-18 08:55:09 -04:00
Raymond Hill
b98ee0f442
Minor code review 2023-10-17 23:11:06 -04:00
Raymond Hill
f34855b859
Do not consider same-creation time to be a stale status
Related commit:
7daf31336a
2023-10-17 12:30:06 -04:00
Raymond Hill
7daf31336a
Ignore assets older than cached version when fetching from CDNs
As discussed with filter list volunteers.

https://github.com/uBlockOrigin/uBlock-discussions/discussions/781#discussioncomment-7283981
2023-10-17 12:08:10 -04:00
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
Raymond Hill
cdf385f5f4
Add missing (deprecated) method to google ima
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265#issuecomment-1637094149
2023-07-16 11:23:31 -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
44b281e517
Import translation work from https://crowdin.com/project/ublock 2023-07-01 10:33:02 -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
5d6e103186
Add "tabless" filter expression for logger output
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2711
2023-06-29 15:12:22 -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
Raymond Hill
7867c25128
Add resource aliases for increased compatibility with AdGuard lists 2023-06-29 14:48:43 -04:00
Raymond Hill
c350e23b2d
Fix regression in parameters-passing in scriptlets 2023-06-29 09:05:48 -04:00
Raymond Hill
de6b1d361d
Fix typo in new getScriptletArgs() method
Additionally, bring mv3 build up to date with latest changes
to scriptlet framework.
2023-06-28 20:05:59 -04:00
Raymond Hill
fd036a51ee
Add compatibility with AdGuard's #%#//scriptlet(...) syntax
Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/332

Additionally, uBO's own scriplet syntax now also accept quoting
the parameters with either `'` or `"`. This can be used to avoid
having to escape commas when they are present in a parameter.
2023-06-28 19:35:22 -04:00
Raymond Hill
8b7a5264de
Fix syntax highlighter throwing with invalid patterns
The syntax highlighter could throw with some invalid static
network filter patterns. This was caused by the syntax
highlighter still drilling down the pattern parts after
having told codemirror to style the whole pattern as an
error, thus causing the codemirror stream position to go
backward.
2023-06-28 08:38:47 -04:00
Raymond Hill
7184f93cb0
Return empty array instead of undefined
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18649
2023-06-23 20:42:58 -04:00
Raymond Hill
7ba85472d7
[mv3] Properly distinguish trust level when compiling scriptlets
Since in uBOL filter lists from various sources are combined into
a single list, there must be a way to turn on/off trust level
inside the resulting combined filter list so as to be able to
validate the trust level of filters requiring trust.

This commit adds new parser directives understood only by MV3
compiler to turn on/off trust flag internally.
2023-06-23 08:27:07 -04:00
Raymond Hill
e50b391105
Prevent creating report until filter lists are updated
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2582#discussioncomment-6187066
2023-06-22 14:36:12 -04:00
Raymond Hill
f6954430d1
Add support for sublist at any tree depth in "Filter lists" pane 2023-06-21 09:11:21 -04:00
Raymond Hill
0bd4b600cf
Rework nowoif scriptlet
New official name: `no-window-open-if`.

The pattern will now be matched against all arguments passed
to `window.open()`: all the arguments are joined as a single
space-spearated string, and the result is used as the target
for matching the pattern.

To enable logging, used the extra parameters approach, i.e.
`log, 1`, which should come after the positional arguments
`pattern`, `delay`, and `decoy`.
2023-06-17 11:53:08 -04:00
Raymond Hill
683888108c
Import translation work from https://crowdin.com/project/ublock 2023-06-16 11:38:31 -04:00
Raymond Hill
9f2bfecd27
Be more flexible when converting procedural to declarative
Allows for the selector part to come after :media-matches().
2023-06-16 09:55:17 -04:00
Raymond Hill
07fae6a0d1
Fix procedural to declarative conversion 2023-06-16 09:34:35 -04:00
Raymond Hill
e5bd7556d9
Can't have whitespace in network filter pattern
Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/17538#discussioncomment-6137462
2023-06-15 09:12:06 -04:00
Raymond Hill
d590390431
[mv3] Properly compiled complex generic cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/47
2023-06-14 10:19:48 -04:00
Raymond Hill
a2b51a8f91
Import translation work from https://crowdin.com/project/ublock 2023-06-14 09:26:28 -04:00
Raymond Hill
d1525691f4
Remove unimportant information from troubleshooting information
This was added back then for the purpose of investigating the
following issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2604

No longer needed.
2023-06-11 09:58:12 -04:00
Raymond Hill
aa507924f3
Inform when filter lists are reloaded in logger
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2041#issuecomment-1585685791
2023-06-10 11:54:24 -04:00
Raymond Hill
2f0132c414
Import translation work from https://crowdin.com/project/ublock 2023-06-09 10:41:29 -04:00
Raymond Hill
500d4ebe39
Import translation work from https://crowdin.com/project/ublock 2023-06-06 13:54:30 -04:00
Raymond Hill
b163097399
[mv3] Extend scriplet filtering support to all scriptlets
Source code of scriplets is now fetched directly from uBO
project, so there is no longer the need to keep duplicate
versions of scriplet code.

All scriplet filters are now supported.
2023-06-02 17:04:15 -04:00
Raymond Hill
cb9a91d43c
Fix comment 2023-06-01 08:56:42 -04:00
Raymond Hill
40141e2dfc
Fix assembling of scriptlets for isolated world 2023-06-01 08:48:27 -04:00
Raymond Hill
c642541cc4
Minor fine tuning 2023-05-29 07:34:54 -04:00
Raymond Hill
fa9fdc0922
Import translation work from https://crowdin.com/project/ublock 2023-05-28 12:47:41 -04:00
Raymond Hill
695b93f970
Add support for world/dependencies to external scriplets
To let community better experiment with potential candidate scriptlets
for inclusion in uBO itself.
2023-05-28 12:42:47 -04:00
Raymond Hill
d776edf06b
Fix linter incorrectly reporting header= option
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13thksi/filter_blocking_rule_based_on_post_methods_value/jlvhuoy/
2023-05-27 19:02:23 -04:00
Raymond Hill
ea15cef524
[mv3] Also log salvaged rules using entity-based domains
Some filters with entity-based domain option can be salvaged
when there are non-entity-based domain option, but since we are
throwing away the entity-based entries, we are only partially
converting to DNR. This commit will log a warning about this
in log.txt. Before this commit, only non-salvageable filters
were logged.
2023-05-26 13:18:20 -04:00
Raymond Hill
1ff31e0ccd
Expand "uBlock filters" by default 2023-05-24 20:12:28 -04:00
Raymond Hill
3e082c44ca
Import translation work from https://crowdin.com/project/ublock 2023-05-24 15:36:04 -04:00
Raymond Hill
c622298793
Minor CSS tuning 2023-05-23 12:06:19 -04:00
Raymond Hill
947d45be2f
Include imported lists in request to update
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2582#discussioncomment-5969939
2023-05-23 12:04:47 -04:00
Raymond Hill
d74c73e452
Import translation work from https://crowdin.com/project/ublock 2023-05-23 09:28:36 -04:00
Raymond Hill
f18071fd26
Flags: w40 => h48, probably better for UHD displays 2023-05-23 09:24:30 -04:00
Raymond Hill
1a863a877d
Support injecting scriptlet in MAIN or ISOLATED world
This reflects the _world_ of the MV3 scripting API:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld

MAIN: page's world
ISOLATED: extension's content script world

Some scriptlets are best executed in either world, so this
commit allows to pick in which world a scriptlet should execute
(default to MAIN).

For instance, the new sed.js scriptlet will now execute in
the ISOLATED world.
2023-05-22 20:19:00 -04:00
Raymond Hill
23ec2541ef
Prefix lists with ccTLDs instead of 3-letter country codes
ccTLDs are more relatable websites loaded in the browser.
2023-05-21 21:08:29 -04:00
Raymond Hill
41876336db
Add trusted-source support for privileged scriptlets
At the moment, the only filter lists deemed from a "trusted source"
are uBO-specific filter lists (i.e. "uBlock filters -- ..."), and
the user's own filters from "My filters".

A new scriptlet which can only be used by filter lists from trusted
sources has been introduced: `sed.js`.

The new `sed.js` scriptlet provides the ability to perform
text-level substitutions. Usage:

    example.org##+js(sed, nodeName, pattern, replacement, ...)

`nodeName`

The name of the node for which the text content must be substituted.
Valid node names can be found at:
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName

`pattern`

A string or regex to find in the text content of the node as the target of
substitution.

`replacement`

The replacement text. Can be omitted if the goal is to delete the text which
matches the pattern. Cannot be omitted if extra pairs of parameters have to be
used (see below).

Optionally, extra pairs of parameters to modify the behavior of the scriptlet:

`condition, pattern`

A string or regex which must be found in the text content of the node
in order for the substitution to occur.

`sedCount, n`

This will cause the scriptlet to stop after n instances of substitution. Since
a mutation oberver is used by the scriptlet, it's advised to stop it whenever
it becomes pointless. Default to zero, which means the scriptlet never stops.

`tryCount, n`

This will cause the scriptlet to stop after n instances of mutation observer
run (regardless of whether a substitution occurred). Default to zero, which
means the scriptlet never stops.

`log, 1`

This will cause the scriptlet to output information at the console, useful as
a debugging tool for filter authors. The logging ability is supported only
in the dev build of uBO.

Examples of usage:

    example.com##+js(sed, script, /devtoolsDetector\.launch\(\)\;/, , sedCount, 1)

    example.com##+js(sed, #text, /^Advertisement$/)
2023-05-21 14:16:56 -04:00
Raymond Hill
2c7d91ba57
Minor change to regex 2023-05-21 09:45:46 -04:00
Raymond Hill
e50d6ee6ed
Fix sorting of lists in "Filter lists" pane
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645#issuecomment-1556090600
2023-05-21 09:42:30 -04:00
Raymond Hill
d506b28a48
Patch Unicode country flags with image-based flags
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645
2023-05-20 21:35:52 -04:00
Raymond Hill
437889e309
Import translation work from https://crowdin.com/project/ublock 2023-05-20 17:31:01 -04:00
Raymond Hill
ae52ca43c2
Import translation work from https://crowdin.com/project/ublock 2023-05-19 13:06:38 -04:00
Raymond Hill
0442718efd
Render List stats below on mobile 2023-05-17 15:45:31 -04:00
Raymond Hill
df5437a54f
Revert "Render List stats below on mobile"
This reverts commit 9ea39886b6.
2023-05-17 15:44:11 -04:00
Raymond Hill
03a1009b07
As per feedback on https://crowdin.com/project/ublock 2023-05-17 10:27:10 -04:00
Raymond Hill
07845196b7
Import translation work from https://crowdin.com/project/ublock 2023-05-17 10:25:27 -04:00
Raymond Hill
14637923fc
Fix remaining quirks in "Filter lists" pane
Do not sticky unchecked lists in search mode.

Propagate default status of a sublist upward to its parent
entry.
2023-05-17 10:05:19 -04:00
Raymond Hill
d6eacd8cf6
In search-mode, select only search-matched descendants
Context: "Filter lists" pane.
2023-05-17 09:21:14 -04:00
Raymond Hill
d515146d36
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:25:25 -04:00
Raymond Hill
af04821d7a
Rename "Malware domains" section to "Malware, security" 2023-05-16 12:23:41 -04:00
Raymond Hill
d27b3471e1
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:21:59 -04:00
Raymond Hill
9ea39886b6
Render List stats below on mobile 2023-05-16 12:10:40 -04:00
Raymond Hill
5ba3055bc7
Fix class name 2023-05-14 20:18:32 -04:00
Raymond Hill
5c5ccc78bc
Import translation work from https://crowdin.com/project/ublock 2023-05-14 10:07:36 -04:00
Raymond Hill
0b63a4c281
Minor code review 2023-05-14 10:05:42 -04:00
Raymond Hill
7bc06fec8c
Code maintenance: remove now unused ABP-related code path 2023-05-14 09:41:35 -04:00
Raymond Hill
a3a80e3b3f
Do not bail out when content-disposition is inline
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2656
2023-05-14 09:06:21 -04:00
Raymond Hill
1a9a8aae0c
Fix improperly unselecting imported lists
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13enzvv/

When assessing which default lists to disable/enable after
updating from 1.48.x to 1.49.x, uBO has to ignore imported
lists, as these do not have a `off` property -- the
non-existence of this property was used to determine whether
a list was default or not. There needs to be an extra test for
whether the list is imported or not.
2023-05-11 11:46:31 -04:00
Raymond Hill
fc7b2898d2
Make list-search i18n aware where possible 2023-05-09 16:56:33 -04:00
Raymond Hill
578fc21bd9
Report injected scriptlets in troubleshooting information
This requires to rewrite portions of scriptlet filtering
code.
2023-05-09 12:44:14 -04:00
Raymond Hill
fd821e3473
Force all dev builds to use assets.dev.json 2023-05-08 08:23:19 -04:00
Raymond Hill
f6839f5a57
Keep reflecting search matches after applying changes 2023-05-08 07:08:45 -04:00
Raymond Hill
9808423845
Bring back list-per-group counts
Regression from:
- cbc0cbadaa
2023-05-07 19:07:21 -04:00
Raymond Hill
56092189d1
Fix rendering issue of row-filter icon in popup panel
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2640
2023-05-07 10:42:30 -04:00