Commit Graph

148 Commits

Author SHA1 Message Date
Raymond Hill 07845196b7
Import translation work from https://crowdin.com/project/ublock 2023-05-17 10:25:27 -04:00
Raymond Hill d27b3471e1
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:21:59 -04:00
Raymond Hill 7f9c4ce45f
Import translation work from https://crowdin.com/project/ublock 2023-05-06 17:26:19 -04:00
Raymond Hill ad969ec153
Import translation work from https://crowdin.com/project/ublock 2023-04-27 08:52:32 -04:00
Raymond Hill ae474aae40
Remove languages with no translations, no activity 2023-04-25 14:21:46 -04:00
Raymond Hill 8616b395b2
Internally support no-filtering as default mode
Even though this cannot be set through the user interface.
2023-04-21 19:24:43 -04:00
Raymond Hill a5f735b585
Fix mv3 builds 2023-04-11 09:35:31 -04:00
Raymond Hill c5d62d9ae7
Import translation work from https://crowdin.com/project/ublock 2023-04-09 14:00:39 -04:00
Raymond Hill b408b9314c
Use more reliable way to check browser environment 2023-04-07 13:00:01 -04:00
Raymond Hill cbfd2ad942
Create a MVP version of uBOLite for Firefox
What does not work at the time of commit:

Cosmetic filtering does not work:

The content scripts responsible for cosmetic filtering fail when
trying to inject the stylesheets through document.adoptedStyleSheets,
with the following error message:

  XrayWrapper denied access to property Symbol.iterator
  (reason: object is not safely Xrayable).
  See https://developer.mozilla.org/en-US/docs/Xray_vision for more
  information. ... css-declarative.js:106:8

A possible solution is to inject those content scripts in the
MAIN world. However Firefox scripting API does not support MAIN
world injection at the moment.

Scriptlet-filtering does not work:

Because scriptlet code needs to be injected in the MAIN world,
and this is currently not supported by Firefox's scripting API,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1736575

There is no count badge on the toolbar icon in Firefox, as it
currently does not support the `DNR.setExtensionActionOptions`
method.

Other than the above issues, it does appear uBO is blocking
properly with no error reported in the dev console.

The adoptedStyleSheets issue though is worrisome, as the
cosmetic filtering content scripts were designed with ISOLATED
world injection in mind. Being forced to inject in MAIN world
(when available) make things a bit more complicated as uBO
has to ensure it's global variables do not leak into the page.
2023-04-07 10:19:43 -04:00
Raymond Hill ae1afe0381
Import translation work from https://crowdin.com/project/ublock 2023-04-02 12:13:44 -04:00
Raymond Hill 9519666fcc
Import translation work from https://crowdin.com/project/ublock 2023-04-01 16:49:15 -04:00
Raymond Hill c3df4ced0a
Import translation work from https://crowdin.com/project/ublock 2023-03-30 16:32:24 -04:00
Raymond Hill a8a46c4593
Normalize non-ASCII characters in `:matches-path()` argument
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2369
2023-03-26 15:37:15 -04:00
Raymond Hill 6d989744bb
Import translation work from https://crowdin.com/project/ublock 2023-03-21 12:12:17 -04:00
Raymond Hill 93ac6514bc
Import translation work from https://crowdin.com/project/ublock 2023-03-13 10:59:25 -04:00
Raymond Hill b690405c72
Import translation work from https://crowdin.com/project/ublock 2023-03-12 10:27:40 -04:00
Raymond Hill bed362d375
Import translation work from https://crowdin.com/project/ublock 2023-03-11 15:54:07 -05:00
Raymond Hill 426bf2d170
Import translation work from https://crowdin.com/project/ublock 2023-02-13 12:43:02 -05:00
Raymond Hill 8d684271b9
Import translation work from https://crowdin.com/project/ublock 2023-02-13 12:42:30 -05:00
Raymond Hill 7dc79b0605
Import translation work from https://crowdin.com/project/ublock 2023-01-31 14:36:00 -05:00
Raymond Hill 202567497d
Import translation work from https://crowdin.com/project/ublock 2023-01-25 10:04:51 -05:00
Raymond Hill 357a4c7bf5
Import translation work from https://crowdin.com/project/ublock 2022-12-26 10:36:09 -05:00
Raymond Hill bfed6059d4
Import translation work from https://crowdin.com/project/ublock 2022-12-22 11:10:56 -05:00
Raymond Hill 4552e2d56a
Do not use `a` element to access dashboard
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/13
2022-12-16 12:05:59 -05:00
Raymond Hill 74765d2cf1
Import translation work from https://crowdin.com/project/ublock 2022-12-16 10:55:32 -05:00
Raymond Hill b603e9e81e
Various code review related to extended filtering
Bring latest changes to procedural cosmetic filtering to uBOL.

Fix procedural filtering used in HTML filters.

Standardize quick hash algorithm used throughout to DJB2
(except that initialization step is skipped):
- http://www.cse.yorku.ca/~oz/hash.html#djb2
2022-12-13 10:23:51 -05:00
Raymond Hill 592295b978
Import translation work from https://crowdin.com/project/ublock 2022-12-11 10:23:11 -05:00
Raymond Hill 267151a732
Import translation work from https://crowdin.com/project/ublock 2022-12-07 10:42:47 -05:00
Raymond Hill ef4dfb3131
Import translation work from https://crowdin.com/project/ublock 2022-11-29 10:34:51 -05:00
Raymond Hill 5c82b85335
Use currentWindow, as suggested 2022-11-25 16:01:58 -05:00
Raymond Hill 96fdae726a
Be sure we query for the current window
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/14#issuecomment-1327181436
2022-11-25 09:22:45 -05:00
Raymond Hill 3e4f6f9986
Import translation work from https://crowdin.com/project/ublock 2022-11-23 12:43:55 -05:00
Raymond Hill 9fc0f2b0b5
Minor rephrasing as suggested 2022-11-23 12:17:05 -05:00
Raymond Hill 4c10637d05
Fix English text as per feedback from https://crowdin.com/project/ublock 2022-11-20 11:06:50 -05:00
Raymond Hill 86c8023163
Fix English typo as per feedback at https://crowdin.com/project/ublock 2022-11-19 11:05:01 -05:00
Raymond Hill 1052dc5001
Import translation work from https://crowdin.com/project/ublock 2022-11-13 11:36:31 -05:00
Raymond Hill feaa338678
Code maintenance: replace uDom.js with dom.js
`uDom` is old and crusty and `dom` is meant as replacement. The
goal of `dom` is to be simpler and mainly just convenience
methods for handling the DOM with vanilla JS -- this is not a
framework.

Additionally, removed keyboard shortcuts pane which was useful
only on very old versions of Firefox.
2022-11-12 09:51:22 -05:00
Raymond Hill 7d0714965f
[mv3] Fixed undue delay in 1st application of cosmetic procedural filters
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2261#discussioncomment-4105044
2022-11-10 15:34:02 -05:00
Raymond Hill 5b6fc43a2c
[mv3] Use Set instead of array to avoid spurious script updates
Spurious updates to registered content scripts would occur when
using some regional lists, for example DEU would cause spurious
updates to registered script `css-procedural`.
2022-11-10 12:46:25 -05:00
Raymond Hill c65114ee5e
Add support for Belarusian language 2022-11-06 17:04:56 -05:00
Raymond Hill e0e68a24d2
Import translation work from https://crowdin.com/project/ublock 2022-11-06 13:11:23 -05:00
Raymond Hill 6574ede152
[mv3] Do not merge rules with errors
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/10#issuecomment-1304822579
2022-11-06 11:21:02 -05:00
Raymond Hill 6f90596e3b
[mv3] Add support for csp= filters
Network filters with csp= option will now be enforced.

Caveat: DNR API does not have support for exception csp= rules,
so excepted csp= filters are currently rejected at conversion time.
2022-11-05 11:09:06 -04:00
Raymond Hill d4bd6f0251
[mv3] Inject scriptlets et al. in embedded frames
Not doing so prevented uBO Lite from properly defusing
many anti-blockers.
2022-10-29 10:02:09 -04:00
Raymond Hill ec43aaad94
Import translation work from https://crowdin.com/project/ublock 2022-10-27 20:19:46 -04:00
Raymond Hill 433adac6ff
[mv3] Add ability to handle entity-based CSS and scriptlet injection filters
This commit adds the ability to inject entity-based plain CSS
filters and also a set of the most commonly used entity-based
scriptlet injection filters.

Since the scripting API is not compatible with entity patterns,
the entity-related content scripts are injected in all documents
and the entity-matching is done by the content script themselves.

Given this, entity-based content scripts are enabled only when
working in the Complete filtering mode, there won't be any
entity-based filters injected in lower modes.

Also, since there is no way to reasonably have access to the
Public Suffix List in the content scripts, the entity-matching
algorithm is an approximation, though I expect false positives
to be rare (time will tell). In the event of such false
positive, simply falling back to Optimal mode will fix the
issue.

The following issues have been fixed at the same time:

Fixed the no-filtering mode related rules having lower priority
then redirect rules, i.e. redirect rules would still be applied
despite disabling all filtering on a site.

Fixed improper detection of changes to the generic-related CSS
content script, potentially causing undue delays when for example
trying to access the popup panel while working in Complete mode.
The scripting MV3 can be quite slow when registering/updating
large content scripts, so uBOL does its best to call the API only
if really needed, but there had been a regression in the recent
builds preventing uBO from properly detecting unchanged content
script parameters.
2022-10-20 15:48:06 -04:00
Raymond Hill 2e9cc65bea
Import translation work from https://crowdin.com/project/ublock 2022-10-18 16:19:21 -04:00
Raymond Hill b4c63f6ae5
[mv3] Handle permissions being revoked while uBOL is disabled 2022-10-18 08:48:31 -04:00
Raymond Hill 614e65a6a5
Import translation work from https://crowdin.com/project/ublock 2022-10-17 08:24:54 -04:00
Raymond Hill fa21f97b68
[mv3] Use navigator.languages instead of i18n.getAcceptLanguages
Related issue:
- https://github.com/w3c/webextensions/issues/107
2022-10-17 08:13:48 -04:00
Raymond Hill 985ea24e82
[mv3] Add support for redirect= filters
This adds support for `redirect=` filters. As with `removeparam=`
filters, `redirect=` filters can only be enforced when the
default filtering mode is set to Optimal or Complete, since these
filters require broad host permissions to be enforced by the DNR
engine.

`redirect-rule=` filters are not supported since there is no
corresponding DNR syntax.

Additionally, fixed the dropping of whole network filters even though
those filters are still useful despite not being completely
enforceable -- for example a filter with a single (unsupported) domain
using entity syntax in its `domain=` option should not be wholly
dropped when there are other valid domains in the list.
2022-10-16 12:05:24 -04:00
Raymond Hill 1db3748ab1
[mv3] General code review
Re-arranged resources in a more tidy way. General code review of
various code paths.
2022-10-15 13:05:20 -04:00
Raymond Hill af47189da4
Import translation work from https://crowdin.com/project/ublock 2022-10-13 08:24:39 -04:00
Raymond Hill 2ced5d2fb6
Import translation work from https://crowdin.com/project/ublock 2022-10-11 17:06:03 -04:00
Raymond Hill 556c3a143f
Add nosiif and nowoif scriptlets
The addition of those scriptlets will help uBOL to properly
filter more anti-blocker mechanisms on various site and also prevents
popups on many sites.

Also, fixed properly injecting scriptlets in embedded frames -- it
turns out I misunderstood the `allFrames` settings in the `scripting`
API.
2022-10-11 10:46:10 -04:00
Raymond Hill 042dc99594
Import translation work from https://crowdin.com/project/ublock 2022-10-11 08:52:17 -04:00
Raymond Hill 73fbdea860
Import translation work from https://crowdin.com/project/ublock 2022-10-10 12:38:01 -04:00
Raymond Hill 8eb28a446c
[mv3] Introduce per-site filtering modes in lieu of per-site toggle switch 2022-10-10 12:28:24 -04:00
Raymond Hill 5777b672a4
Import translation work from https://crowdin.com/project/ublock 2022-10-10 10:46:19 -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 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 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 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 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 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 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 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