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

1671 Commits

Author SHA1 Message Date
Raymond Hill
5777b672a4
Import translation work from https://crowdin.com/project/ublock 2022-10-10 10:46:19 -04:00
Raymond Hill
0bfffb80c4
Fix spurious warning
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2243
2022-10-05 07:28:01 -04:00
Raymond Hill
2a40e67577
[mv3] Various fixes and code review
Fixed trusted sites not being excluded from declarative
scripting.

Assign "uBOL_"-prefixed name to anonymous scripting functions
so that they can be easily found in performance profiler results
in dev tools.

Imrpove spread of chunks of filters across declarative scripting
files.
2022-09-30 14:55:36 -04:00
Raymond Hill
1a9a19a91f
[mv3] Open options page at first install
To be sure first time users are properly informed about the
possibility to enable broad permissions for better filtering.
2022-09-30 09:18:52 -04:00
Raymond Hill
28aee736a5
[mv3] Add support for removeparam= filter option
Consequently, AdGuard URL Tracking Protection (AUTP) has been
added to the set of available filter lists.

However, removeparam= equivalent DNR rules can only be enforced
when granting uBOL broad permissions. If broad permissions are
not granted, removeparam= equivalent DNR rules are ignored.

Exception removeparam= filters are not supported, and these are
present in AUTP and meant to unbreak some websites which are
known to break as a result of removing query parameters.

This is issue might be mitigated in the future by making the
conversion from filters to DNR rules more complicated but this
can never replace the accuracy of uBO's filtering engine being
able to fully enforce arbitrary exception removeparam= filters.

Also, it is not possible to translate regex-based removeparam=
values to DNR rules, so these are dropped at conversion time.

As with other filters to DNR rules conversion, the converter
coallesce many distinct removeparam= filters into fewer DNR
rules.
2022-09-29 19:51:33 -04:00
Raymond Hill
b5e2ca8826
Import translation work from https://crowdin.com/project/ublock 2022-09-28 10:40:55 -04:00
Raymond Hill
a20273c582
[mv3] Don't wait on fullfilled promise when registring scriptlets
This can interfere with user interface responsiveness when
registring all scriptlets in broad-permissions mode.
2022-09-28 10:20:57 -04:00
Raymond Hill
a47484bc33
[mv3] Fix reflecting proper state when denied 2022-09-27 20:19:59 -04:00
Raymond Hill
61e9a6e9c9
Import translation work from https://crowdin.com/project/ublock 2022-09-27 20:00:06 -04:00
Raymond Hill
f652cc9855
[mv3] Add ability to grant/revoke permissions on all sites 2022-09-27 19:51:38 -04:00
Raymond Hill
d4b7169421
Fix bad rules making it into the final ruleset files 2022-09-27 10:57:43 -04:00
Raymond Hill
51c2e22c7a
[mv3] Fix procedural operator matches-media()
The failure was caused by the fact that there is no
window.matchMedia() API available in Nodejs. The validation
is now done using cssTree.
2022-09-27 07:46:24 -04:00
Raymond Hill
e29e760b43
Use higher resolution favicons
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2287
2022-09-26 10:18:24 -04:00
Raymond Hill
f19fd391de
[mv3] Fix bad call in nostif 2022-09-24 18:43:15 -04:00
Raymond Hill
ffc46534ac
[mv3] Skip some regional lists for the time being 2022-09-24 18:36:28 -04:00
Raymond Hill
4755a6094e
[mv3] Add support for more scriplets: abort-on-property-write, no-settimeout-if 2022-09-24 18:22:44 -04:00
Raymond Hill
07178e6416
Fix typo 2022-09-24 14:10:29 -04:00
Raymond Hill
a7b5f5127f
[mv3] Do not include lists with empty ruleset 2022-09-24 12:23:01 -04:00
Raymond Hill
f638da41d6
Import translation work from https://crowdin.com/project/ublock 2022-09-24 12:14:02 -04:00
Raymond Hill
966a157d19
[mv3] Add support for procedural cosmetic filtering 2022-09-24 11:33:04 -04:00
Raymond Hill
a71b71e4c8
New cosmetic filter parser using CSSTree library
The new parser no longer uses the browser DOM to validate
that a cosmetic filter is valid or not, this is now done
through a JS library, CSSTree.

This means filter list authors will have to be more careful
to ensure that a cosmetic filter is really valid, as there is
no more guarantee that a cosmetic filter which works for a
given browser/version will still work properly on another
browser, or different version of the same browser.

This change has become necessary because of many reasons,
one of them being the flakiness of the previous parser as
exposed by many issues lately:

- https://github.com/uBlockOrigin/uBlock-issues/issues/2262
- https://github.com/uBlockOrigin/uBlock-issues/issues/2228

The new parser introduces breaking changes, there was no way
to do otherwise. Some current procedural cosmetic filters will
be shown as invalid with this change. This occurs because the
CSSTree library gets confused with some syntax which was
previously allowed by the previous parser because it was more
permissive.

Mainly the issue is with the arguments passed to some procedural
cosmetic filters, and these issues can be solved as follow:

Use quotes around the argument. You can use either single or
double-quotes, whichever is most convenient. If your argument
contains a single quote, use double-quotes, and vice versa.

Additionally, try to escape a quote inside an argument using
backslash. THis may work, but if not, use quotes around the
argument.

When the parser encounter quotes around an argument, it will
discard them before trying to process the argument, same with
escaped quotes inside the argument. Examples:

Breakage:

    ...##^script:has-text(toscr')

Fix:

    ...##^script:has-text(toscr\')

Breakage:

    ...##:xpath(//*[contains(text(),"VPN")]):upward(2)

Fix:

    ...##:xpath('//*[contains(text(),"VPN")]'):upward(2)

There are not many filters which break in the default set of
filter lists, so this should be workable for default lists.

Unfortunately those fixes will break the filter for previous
versions of uBO since these to not deal with quoted argument.
In such case, it may be necessary to keep the previous filter,
which will be discarded as broken on newer version of uBO.

THis was a necessary change as the old parser was becoming
more and more flaky after being constantly patched for new
cases arising, The new parser should be far more robust and
stay robist through expanding procedural cosmetic filter
syntax.

Additionally, in the MV3 version, filters are pre-compiled
using a Nodejs script, i.e. outside the browser, so validating
cosmetic filters using a live DOM no longer made sense.

This new parser will have to be tested throughly before stable
release.
2022-09-23 16:03:13 -04:00
Raymond Hill
b2b7ffee87
[mv3] Add English description
This will be used as reference "detailed description" and
for Chrome Web Store et al. description.
2022-09-20 09:01:10 -04:00
Raymond Hill
cfeac10c95
[mv3] Add support for abort-on-property-read scriptlet 2022-09-20 08:49:52 -04:00
Raymond Hill
70a0de9d00
[mv3] Mind trusted-site directives when registering content scripts 2022-09-20 08:24:01 -04:00
Raymond Hill
f374c05753
[mv3] Stick to int32 instead of 8-char hex strings for file hashes 2022-09-19 20:21:10 -04:00
Raymond Hill
7116bf9a46
GitHub Actions stuff 2022-09-19 11:53:04 -04:00
Raymond Hill
adb5d503d9
[mv3] Add GitHub action to build mv3 separately form uBO 2022-09-19 11:08:34 -04:00
Raymond Hill
4bd02c0fb6
[mv3] Inject specific cosmetic filters through scriptlet injection
This solves the following remaining issues regarding specific cosmetic
filtering:
- High rate of false positives in last build
- High number of generated content css files in the package
2022-09-19 08:55:45 -04:00
Raymond Hill
89566bc397
[mv3] Further reduce the number of distinct generated scriptlets 2022-09-18 17:07:02 -04:00
Raymond Hill
154a71c658
Import translation work from https://crowdin.com/project/ublock 2022-09-18 09:36:13 -04:00
Raymond Hill
5ddd3aaac6
[mv3] More work toward improving declarative css/js injection 2022-09-18 09:31:44 -04:00
Raymond Hill
9058c3524e
[mv3] Fix improper usage of scripting.unregisterContentScripts()
THis was causing all registered css/scripts to be removed when revoking
permission for a single site.
2022-09-17 11:22:25 -04:00
Raymond Hill
10406f5f74
Import translation work from https://crowdin.com/project/ublock 2022-09-17 08:35:54 -04:00
Raymond Hill
e1b54514cc
[mv3] Add badge reflecting number of injectable content on current site
Additonally, general code review.
2022-09-17 08:26:41 -04:00
Raymond Hill
22d03906fb
[mv3] For the time being assemble defautl lists manually 2022-09-16 16:36:09 -04:00
Raymond Hill
46c461c568
Import translation work from https://crowdin.com/project/ublock 2022-09-16 16:06:32 -04:00
Raymond Hill
232c44eeb2
[mv3] Add scriptlet support; improve reliability of cosmetic filtering
First iteration of adding scriptlet support. As with cosmetic
filtering, scriptlet niijection occurs only on sites for which
uBO Lite was granted extended permissions.

At the moment, only three scriptlets are supported:
- abort-current-script
- json-prune
- set-constant

More will be added in the future.
2022-09-16 15:56:35 -04:00
Raymond Hill
34aab95107
[mv3] Add support for specific cosmetic filtering
Specific plain CSS cosmetic filters are now supported.

Cosmetic filtering will occur only after the user explicitly
grant uBO extended permissions for a given site, so that it
can inject CSS on the site.

A new button in the popup panel allows a user to grant/revoke
extended permissions to/from uBO Lite for the current site.

More capabilities will be carefully added for when extended
permissions are granted on a site, so specific cosmetic
filtering through plain CSS is the first implemented capability.

Generic and procedural cosmetic filtering is not implemented.

The current implementation for plain CSS cosmetic filters is
through declarative content injection, which does not require
the service worker to be alive, the browser takes care to
inject the cosmetic filters.

However declarative CSS injection does not support user
styles, so the injected cosmetic filters are "weak". I consider
this is a browser issue, since user styles are supported by
Chromium, there is just no way in the API to specify user
styles for the injected content.

Also:
- Fixed dark theme issues
- Added Steven Black's hosts file

Keep in mind all this is very experimental and implementation
details in this release may (will) greatly change in the future.
2022-09-15 13:14:08 -04:00
Raymond Hill
b343cdc374
Import translation work from https://crowdin.com/project/ublock 2022-09-15 12:53:56 -04:00
Raymond Hill
43a20f08a8
Import translation work from https://crowdin.com/project/ublock 2022-09-15 12:19:31 -04:00
Raymond Hill
be4537ef44
Use translated strings in manifest 2022-09-14 09:32:59 -04:00
Raymond Hill
76835ebcac
Reword description 2022-09-14 09:31:58 -04:00
Raymond Hill
6098f96a5d
Import translation work from https://crowdin.com/project/ublock 2022-09-13 18:00:25 -04:00
Raymond Hill
5de156a0ed
Add missing translatable strings 2022-09-13 17:58:48 -04:00
Raymond Hill
3435e9886e
Import translation work from https://crowdin.com/project/ublock 2022-09-13 17:58:12 -04:00
Raymond Hill
e31637af78
[mv3] Add ability to enable/disable filter lists 2022-09-13 17:44:24 -04:00
Raymond Hill
93e5133783
Rename to less controversial name 2022-09-11 17:41:24 -04:00
Raymond Hill
c583a2e4b0
Fire tune build steps for mv3 version 2022-09-10 14:20:07 -04:00
Raymond Hill
1258414f37
Report ruleset stats in popup panel 2022-09-08 10:04:08 -04:00
Raymond Hill
41d66a78ba
Report per-ruleset stats for filters-to-rules conversion 2022-09-07 13:45:55 -04:00
Raymond Hill
224410a6f5
Add per-site on/off switch to mv3 experimental version 2022-09-07 10:15:36 -04:00
Raymond Hill
e420b75b91
Nodejs 16 does not support fetch() 2022-09-06 15:05:01 -04:00
Raymond Hill
a559f5f271
Add experimental mv3 version
This create a separate Chromium extension, named
"uBO Minus (MV3)".

This experimental mv3 version supports only the blocking of
network requests through the declarativeNetRequest API, so as
to abide by the stated MV3 philosophy of not requiring broad
"read/modify data" permission. Accordingly, the extension
should not trigger the warning at installation time:

    Read and change all your data on all websites

The consequences of being permission-less are the following:

- No cosmetic filtering (##)
- No scriptlet injection (##+js)
- No redirect= filters
- No csp= filters
- No removeparam= filters

At this point there is no popup panel or options pages.

The default filterset correspond to the default filterset of
uBO proper:

Listset for 'default':
  https://ublockorigin.github.io/uAssets/filters/badware.txt
  https://ublockorigin.github.io/uAssets/filters/filters.txt
  https://ublockorigin.github.io/uAssets/filters/filters-2020.txt
  https://ublockorigin.github.io/uAssets/filters/filters-2021.txt
  https://ublockorigin.github.io/uAssets/filters/filters-2022.txt
  https://ublockorigin.github.io/uAssets/filters/privacy.txt
  https://ublockorigin.github.io/uAssets/filters/quick-fixes.txt
  https://ublockorigin.github.io/uAssets/filters/resource-abuse.txt
  https://ublockorigin.github.io/uAssets/filters/unbreak.txt
  https://easylist.to/easylist/easylist.txt
  https://easylist.to/easylist/easyprivacy.txt
  https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-online.txt
  https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext

The result of the conversion of the filters in all these
filter lists is as follow:

Ruleset size for 'default': 22245
  Good: 21408
  Maybe good (regexes): 127
  redirect-rule= (discarded): 458
  csp= (discarded): 85
  removeparams= (discarded): 22
  Unsupported: 145

The fact that the number of DNR rules are far lower than the
number of network filters reported in uBO comes from the fact
that lists-to-rulesets converter does its best to coallesce
filters into minimal set of rules. Notably, the DNR's
requestDomains condition property allows to create a single
DNR rule out of all pure hostname-based filters.

Regex-based rules are dynamically added at launch time since
they must be validated as valid DNR regexes through
isRegexSupported() API call.

At this point I consider being permission-less the limiting
factor: if broad "read/modify data" permission is to be used,
than there is not much point for an MV3 version over MV2, just
use the MV2 version if you want to benefit all the features
which can't be implemented without broad "read/modify data"
permission.

To locally build the MV3 extension:

    make mv3

Then load the resulting extension directory in the browser
using the "Load unpacked" button.

From now on there will be a uBlock0.mv3.zip package available
in each release.
2022-09-06 13:47:52 -04:00
Raymond Hill
0c9ab84846
Fix redundant calls to extract image data
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2243#issuecomment-1236194011
2022-09-04 10:40:26 -04:00
Raymond Hill
2ff0abfb89
Fix popup panel for Thunderbird
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2144
2022-06-18 11:18:27 -04:00
Raymond Hill
127ea05a9e
Replace responsive with intab for better remdering og panel in a tab
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2116#issuecomment-1143634719
2022-06-04 11:12:45 -04:00
Raymond Hill
1c090f0fae
Use string template 2022-06-03 12:27:51 -04:00
u-RraaLL
614b8328e9
Update popup url
Fix broken functionality caused by the removal of the classic popup.
2022-05-21 09:42:08 +02:00
Raymond Hill
78a15b648f
Do not block root document at launch in Chromium-based browsers
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2063
2022-03-30 12:15:44 -04:00
Raymond Hill
c71c42650e
New npm package version 2022-03-14 12:09:00 -04:00
Raymond Hill
ad1800fbca
Add command to toggle cosmetic filtering
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2000
2022-02-22 08:44:09 -05:00
Raymond Hill
26048a11bc
Merge branch 'letsblockit-subscriber' of https://github.com/xvello/uBlock 2022-02-19 08:57:47 -05:00
Raymond Hill
60072e7996
Minor code review
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1992
2022-02-18 06:52:34 -05:00
Raymond Hill
e1e2ba3d5d
Use unspoofable Messenger.origin to determine privilege level of ports
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1992
2022-02-17 18:05:01 -05:00
Raymond Hill
3154ed1bac
Remove test for whether Chromium version is less than 66
The test is no longer needed given that the minimum supported
version is Chromium 66.
2022-02-17 09:07:56 -05:00
Xavier Vello
c8d1834018 Add letsblock.it as valid location for subscription links 2022-02-16 16:28:13 +01:00
Raymond Hill
2933016d4b
Rework behavior of "Suspend network activity until ..."
The setting will default to the natural capability of the browser:

- Checked for Firefox
- Unchecked for Chromium-based browsers

For Chromium-based browser, if checked, network requests will be
redirected to an empty resources instead of blocking the
connection.

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1973
- https://www.reddit.com/r/uBlockOrigin/comments/squo8n/latest_update_blocks_network_connections_at/
2022-02-13 09:24:57 -05:00
Raymond Hill
a2d83afe66
Further narrow when unconditionally calling webRTCIPHandlingPolicy.clear()
The enabled cached state probably exists in the browser only
when the setting was originally enabled -- so we need to clear
it only in such case.
2022-02-06 09:00:25 -05:00
Raymond Hill
00b257caa7
Unconditionally call webRTCIPHandlingPolicy.clear() at launch
On Chromium-based browsers only.

Related issue/feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1928
- https://www.reddit.com/r/uBlockOrigin/comments/sl7p74/
2022-02-05 12:04:08 -05:00
Raymond Hill
b4911e2d7c
Raise minimum versions of browsers
For the following reasons:

- Support for CSS `gap`, so as to remove the need to
  fall back onto classic popup panel, and thus making
  it possible to fully remove long-ago deprecated
  classic panel (announced in 1.27.0)[1]:
  https://developer.mozilla.org/en-US/docs/Web/CSS/gap

- Support for dynamic import:
  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

Firefox's minimum version is raised to 68 because it's
the oldest ESR version supporting the features above.
From now on, minimum version of Firefox will always be
an ESR one.

---

[1] https://github.com/gorhill/uBlock/releases/tag/1.27.0
2022-01-28 12:02:56 -05:00
Raymond Hill
250cf96aae
Fix regression causing regex-based filters to be case sensitive
Related feedback:
- https://github.com/AdguardTeam/AdguardFilters/issues/88067#issuecomment-1019518277

Regression commit:
- 725e6931f5
2022-01-23 12:32:11 -05:00
Raymond Hill
0bc0af9d8d
Add test to detect case of improper deserialization
Related commit:
- 8f461072f5
2022-01-12 09:03:38 -05:00
Raymond Hill
eddb9ec160
Raised guessed Firefox version to 91 (latest ESR) 2022-01-09 12:41:29 -05:00
Raymond Hill
d38c19cabf
Improve test for presence of browser as extensions API
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1914

The issue affected only Chromium-based browsers.
2022-01-01 11:07:17 -05:00
Raymond Hill
925c8d5d0c
Add setting to control suspension on network activity at launch
Related discussion:
- a0a9497b4a (commitcomment-62560291)

The new setting, when disabled (enabled by default), allows a user
to prevent uBO from waiting for all filter lists to be loaded
before allowing network activity at launch. The setting is enabled
by default, meaning uBO waits for all filter lists to be loaded in
memory before unsuspending network activity. Some users may find
this behavior undesirable, hence the new setting.

This gives the option to potentially speed up page load at launch,
at the cost of potentially not properly filtering network requests
as per filter lists/rules.

For platforms not supporting the suspension of network activity,
the setting will merely prevent whatever mechanism exists on the
platform to mitigate improper filtering of network requests at
launch. For example, in Chromium-based browsers, unchecking the
new setting will prevent the browser from re-loading tabs for
which there was network activity while in "suspended" state at
launch.
2021-12-30 09:24:38 -05:00
Raymond Hill
eab2e03f2b
New revision for dev build 2021-12-27 19:12:29 -05:00
Raymond Hill
0992a5b821
Add test for https://github.com/gorhill/uBlock/commit/d66cd1116c0e 2021-12-25 09:10:48 -05:00
Raymond Hill
e2be049774
New revision for release candidate
Aiming for a pre-holiday release.
2021-12-18 13:47:38 -05:00
Raymond Hill
26e62eb29b
New revision for dev build 2021-12-16 09:39:44 -05:00
Raymond Hill
89e67887ee
Create synthetic event for new windows created from external application
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/10323#issuecomment-993592288

Synthesize a onCreatedNavigationTarget event for new browser windows
created as a result of an external application triggering a navigation
event.
2021-12-14 11:23:46 -05:00
Raymond Hill
7de2359ccb
New revision for dev build 2021-12-13 12:56:56 -05:00
Raymond Hill
685a9779e5
New revision for dev build 2021-12-12 11:33:15 -05:00
Raymond Hill
25fc118337
New revision for dev build 2021-12-11 09:54:43 -05:00
Raymond Hill
ca1ec1461b
Narrow usage of webRTCIPHandlingPolicy to only firefox
In addition of `mobile`, just in case -- some people are
using mobile version of chromium out there.
2021-12-11 07:37:18 -05:00
Raymond Hill
1cfcb1623f
New revision for dev build 2021-12-10 08:29:33 -05:00
Raymond Hill
62231b73e5
New revision for dev build 2021-12-06 12:08:58 -05:00
Raymond Hill
3004c8832a
Fix dig-snfe modifiers to properly detect changes in results 2021-12-06 08:01:05 -05:00
Raymond Hill
190bbf627b
New revision for dev build 2021-12-06 07:07:22 -05:00
Raymond Hill
d3fe0ccfe0
Fix regression with csp=, deprecate queryprune, etc
Fixed serious regression in previous dev build in applying
`csp=` filters. Reported internally by uBO team.

Promote usage of `removeparam` in code instead of `queryprune`,
which is to be deprecated.

Removed test against previously tested hostname in
FilterHostnameDict since as per various benchmark, the
test does not really help.

Remove serialization API in Node.js code as the API is now
present in SNFE itself.
2021-12-06 07:01:39 -05:00
Raymond Hill
ae124065af
New revision for dev build 2021-12-05 09:12:55 -05:00
Raymond Hill
4b68f28e08
New revision for dev build 2021-12-04 17:10:51 -05:00
Raymond Hill
b98836ab8e
Fix NPM package documentation 2021-12-04 12:40:43 -05:00
Raymond Hill
82f31e7863
Bump npm package version number 2021-12-04 12:34:36 -05:00
Raymond Hill
b1a338681b
Shield against possible case of invalid attribute name
Not sure this can really happen, but if ever Math.random() would
return `0.9999999999999999`, the attribute name would start with
`{`, i.e. an invalid attribute name.
2021-10-26 08:55:05 -04:00
Raymond Hill
318469b005
Remove unused function 2021-10-22 08:34:04 -04:00
Raymond Hill
18ae79cdf2
Remove unused code path as per current minimum browser version 2021-10-17 13:50:43 -04:00
Raymond Hill
e4d75fa025
Ignore unused tabs.onUpdated() events 2021-10-17 12:55:31 -04:00
Raymond Hill
b0038eac28
Remove unused code path
Versions of Firefox 54 and lower are no longer supported.
2021-10-13 11:17:21 -04:00
Raymond Hill
c4b7ee80ea
Further work on JS modules
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664
2021-10-07 14:41:29 -04:00
Raymond Hill
6464002088
Give precedence to negated types in case of ambiguity
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/7639#issuecomment-933525018
2021-10-06 09:44:15 -04:00