1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-03 02:37:21 +02:00
Commit Graph

1934 Commits

Author SHA1 Message Date
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
6a817b8258
Revert back to EasyList Cookie Notices 2023-06-21 10:08:28 -04:00
Raymond Hill
49b3ce58bb
Import translation work from https://crowdin.com/project/ublock 2023-06-19 10:17:36 -04:00
Raymond Hill
3b70d0e134
[mv3] Drop useless property in generated content scripts 2023-06-18 14:34:43 -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
a2b51a8f91
Import translation work from https://crowdin.com/project/ublock 2023-06-14 09:26:28 -04:00
Raymond Hill
2f991bf70b
[mv3] Fix various minor quirks
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/46

Also, patch Unicode flags in popup panel.
2023-06-14 09:07:34 -04:00
Raymond Hill
f22a531043
Import translation work from https://crowdin.com/project/ublock 2023-06-13 12:03:08 -04:00
Raymond Hill
d19e62a595
[mv3] Add support for admin configurations
See `managed_storage.json` for available settings. Currently
only `noFiltering` setting is availale.

`noFiltering` is an array of strings, each being a domain for
which no filtering should occur.

Related discussion:
- https://github.com/uBlockOrigin/uBOL-issues/discussions/35
2023-06-13 11:40:41 -04:00
Raymond Hill
0541ddbcfd
[mv3] Allows for revisions distinct from filter lists revisions 2023-06-11 10:29:05 -04:00
Raymond Hill
30c9004f0c
[mv3] First non-experimental version 2023-06-11 10:27:05 -04:00
Raymond Hill
4cd798f8fa
Import translation work from https://crowdin.com/project/ublock 2023-06-11 10:22:41 -04:00
Raymond Hill
01a4909ede
[mv3] No longer experimental 2023-06-11 10:20:46 -04:00
Raymond Hill
24bdcfd0dc
[mv3] No longer experimental 2023-06-11 10:17:41 -04:00
Raymond Hill
b37a250ef0
Add reference for country flag-related stuff 2023-06-11 10:16:55 -04:00
Raymond Hill
cdb50f4d9d
Import translation work from https://crowdin.com/project/ublock 2023-06-11 10:09:35 -04:00
Raymond Hill
4ddfb3f278
[mv3] Add more specific purposed annoyances-related lists
Import country flag-related code from uBO.

Switch to AdGuard annoyance-related lists, as this solves
https://github.com/uBlockOrigin/uBOL-issues/issues/5#issuecomment-1583192594
2023-06-11 09:20:10 -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
1ad7410077
[mv3] Fine tune various portions of code 2023-06-06 13:42:22 -04:00
Raymond Hill
f282b43550
[mv3] Move hostname label to top of popup panel
Related commit in uBO:
- b8cfa382e8

Additionally, render internationalized domain names in pretty Unicode
instead of ugly punycode.
2023-06-06 09:04:21 -04:00
Raymond Hill
5874312b35
[mv3] Avoid String.replace() to safely replace templates
String.replace() has side effects which are unwelcomed when
replacing template scriplets with code.
2023-06-05 20:17:50 -04:00
Raymond Hill
7e712246a9
[mv3] Let the scriplet sort out targeted sites when too many targets
This is too avoid `matches` property with too many hostnames at
registerContentScripts() time. Threshold has been arbitrarily
set at 100.
2023-06-05 12:14:37 -04:00
Raymond Hill
6d9bef28ff
[mv3] Fix issue with updateContentScripts API and other fixes
Avoid using updateContentScripts() as it suffers from an unexpected
behavior, causing injected content scripts to lose proper order
at injection time. The order in which content scripts are injected
is key for uBOL content scripts. Potential out of order injection
was causing cosmetic filtering to be broken.

Use actual storage API to persist data across service worker
wake-ups and browser launches. uBOL was trying to avoid using
storage API, at the cost of somewhat hacky code (using DNR API
to persist settings).

Make use of session storage if available, to speed up
initialization of waking up the service worker (which at this
point is necessary to properly implement cosmetic filtering).
2023-06-05 09:15:59 -04:00
Raymond Hill
6dbbb95b04
[mv3] Mitigation: Inject CSS user styles to enforce cosmetic filtering
Related issues:
- https://github.com/uBlockOrigin/uBOL-issues/issues/5#issuecomment-1575425913
- https://github.com/w3c/webextensions/issues/403

Currently, there is no other way to inject CSS user styles than to
wake up the service worker, so that it can inject the CSS styles
itself using the `scripting.insertCSS()` method.

If ever the MV3 API supports injecting CSS user styles directly
from a content script, uBOL will be back to be fully declarative.

At this point the service worker is very lightweight since the
filtering is completely  declarative, so this is not too much of
an issue performance-wise except for the fact that waking up the
service worker for the sole purpose of injecting CSS user styles
and nothing else introduces a pointless overhead.

Hopefully the MV3 API will mature to address such inefficiency.
2023-06-04 11:32:55 -04:00
Raymond Hill
72726a4759
[mv3] Refactor content scripts related to specific cosmetic filtering
Specifically, avoid long list of hostnames for the `matches`
property[1] when registering the content scripts, as this was causing
whole browser freeze for long seconds in Chromium-based browsers
(reason unknown).

The content scripts themselves will sort out which cosmetic filters to
apply on which websites.

This change makes it now possible to support annoyances-related lists,
and thus two lists have been added:
- EasyList -- Annoyances
- EasyList -- Cookies

Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/5

These annoyances-related lists contains many thousands of specific
cosmetic filters and as a result, before the above change this was
causing long seconds of whole browser freeze when simply modifying
the blocking mode of a specific site via the slider in the popup
panel.

It is now virtually instantaneous, at the cost of injecting larger
cosmetic filtering-related content scripts (which typically should
be garbage-collected within single-digit milliseconds).

Also, added support for entity-based cosmetic filters. (They were
previously discarded).

---

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/RegisteredContentScript
2023-06-03 22:08:42 -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
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
9134c11cf8
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/2668
Use document.append() only when there are no elements in
the DOM, as a document instance can't have more than one
direct child.
2023-05-23 21:49:42 -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
56f67631d6
Fix regression in handling mode changes 2023-05-20 17:21:14 -04:00
Raymond Hill
eb2d6d1374
Bring scriptlets up to date 2023-05-19 15:36:01 -04:00
Raymond Hill
13a4f869d2
Fix sticky blocking mode
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/42

Take into account that subdomains inherit the blocking mode
of their parent domain when toggling blocking mode of specific
hostnames.
2023-05-19 15:08:23 -04:00
Raymond Hill
07845196b7
Import translation work from https://crowdin.com/project/ublock 2023-05-17 10:25:27 -04:00
Raymond Hill
d5dec1d3c4
Return string when storage.sync.get() promise fails
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2660
2023-05-16 19:26:46 -04:00
Raymond Hill
d27b3471e1
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:21:59 -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
ad8b7b2f12
Fix filter list paths 2023-05-07 09:19:01 -04:00
Raymond Hill
7f9c4ce45f
Import translation work from https://crowdin.com/project/ublock 2023-05-06 17:26:19 -04:00
Raymond Hill
bedb733e67
Fix thunderbird manifest 2023-04-27 21:50:44 -04:00
Raymond Hill
ad969ec153
Import translation work from https://crowdin.com/project/ublock 2023-04-27 08:52:32 -04:00
Raymond Hill
348f75af7f
Reverse usage of browser.alarms
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2604

Related commit:
- bec6cad2c0
2023-04-26 08:00:13 -04:00
Raymond Hill
1ffdb7d948
Various minor code review 2023-04-25 21:15:11 -04:00
Raymond Hill
ae474aae40
Remove languages with no translations, no activity 2023-04-25 14:21:46 -04:00
Raymond Hill
bf53737db4
Import translation work from https://crowdin.com/project/ublock 2023-04-24 09:47:59 -04:00
Raymond Hill
a2725cb987
Import translation work from https://crowdin.com/project/ublock 2023-04-22 19:34:26 -04:00
Raymond Hill
98d4d24f9b
Mind rejected promises from vAPI.storage API
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2604
2023-04-22 19:29:54 -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
c97d0ab062
Forcefully clear unprocessed-request status after a minute
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2589#issuecomment-1507084473
2023-04-13 11:41:52 -04:00
Raymond Hill
0575567d2a
Time when main listener was installed is enough 2023-04-12 18:24:30 -04:00
Raymond Hill
86477dd4e5
Move faster test first 2023-04-12 18:08:11 -04:00
Raymond Hill
bacf5d1661
Better integrate suspend-network with unprocessed-request
Also added additional safeguard against sticky unprocessed-request
status: all unprocessed-request statuses will be cleared after a
minute elapsed following intialization. The idea is that if the
user hasn't care to force a reload of the page, then it's assumed
to be by choice and uBO should stop informing about the status.
2023-04-12 16:10:00 -04:00
Raymond Hill
a1619a118d
Minor code review 2023-04-12 12:13:31 -04:00
Raymond Hill
b47ecb6bfa
Do not clobber rightful onBeforeSuspendableRequest listener 2023-04-12 11:22:45 -04:00
Raymond Hill
bc54179edd
More aggressively clear the unprocessed-request status
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2589
2023-04-12 10:55:00 -04:00
Raymond Hill
f0eadae3ba
Clear unprocessed status of removed tabs 2023-04-11 22:38:43 -04:00
Raymond Hill
8083e06b30
Revert 09b3695205 (re. browser.alarms)
Relates issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2591

THe issue was simply that I had forgotten to add the `alarms`
permission to the manifest.
2023-04-11 18:06:57 -04:00
Raymond Hill
a5f735b585
Fix mv3 builds 2023-04-11 09:35:31 -04:00
Raymond Hill
47287caf1f
Use valid Gecko version 2023-04-11 08:42:28 -04:00
Raymond Hill
09b3695205
Provide fallback API for platforms not supporting alarms API
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2591
2023-04-11 08:40:18 -04:00
Raymond Hill
bf5f343548
Replace toolbar icon tooltip with message section in panel
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2585

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/126rn4f/yellow_toolbar_icon_exclamation_mark_badge/jfns0pc/
2023-04-10 17:10:00 -04:00
Raymond Hill
63d0f124ba
Replace requestIdleCallback() with new vAPI.defer utility
Related commit:
- 91f9795023
2023-04-10 10:10:19 -04:00
Raymond Hill
3530b9dc89
Add informative tooltip re. unprocessed requests at launch
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2585
2023-04-09 14:02:01 -04:00
Raymond Hill
c5d62d9ae7
Import translation work from https://crowdin.com/project/ublock 2023-04-09 14:00:39 -04:00
Raymond Hill
91f9795023
Wrap usage of setTimeout in helper for background + auxiliary pages
This commit centralizes usage of setTimeout()/clearTimeout() in the
source code at one single location.
2023-04-09 13:38:16 -04:00
Raymond Hill
bec6cad2c0
Start using browser.alarms instead of setTimeout() where applicable
Related documentation:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Background_scripts#convert_to_non-persistent
2023-04-07 20:24:20 -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
6e8aeae283
Flush memory cache at key filtering profile changes
To reduce the need for hard reload after changes in filters,
rules.
2023-04-03 10:19:06 -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
0d5cb8cff5
Import translation work from https://crowdin.com/project/ublock 2023-03-31 08:49:00 -04:00
Raymond Hill
0b09155268
Clear unprocessed requests status on webNavigation reload event
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2564
2023-03-30 17:12:45 -04:00
Raymond Hill
c3df4ced0a
Import translation work from https://crowdin.com/project/ublock 2023-03-30 16:32:24 -04:00
Raymond Hill
1835e90125
Avoid using ! toolbar icon badge when inconsequential
uBO will now verify that at least one unprocessed network requests
at launch should have been blocked in order to warn users of
unprocessed network requests through the `!` toolbar icon badge.

For example, with default filter lists, there is nothing to block
on `wikipedia.org`, and hence in this case it's not useful to
present the user with the `!` badge.

Therefore uBO will not show the badge *only* when at least one
unprocessed network requests should have been blocked had uBO been
ready when it was fired by the browser.

Related commit:
- https://github.com/gorhill/uBlock/commit/769b8da664be
2023-03-30 12:30:44 -04:00
Raymond Hill
10f9559a52
Add 64px toolbar icon for 4K displays
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2477
2023-03-27 12:59:39 -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
2f42cf61ab
Properly handle potential exception from webext API
Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/16939#discussioncomment-5356808
2023-03-19 07:25:06 -04:00
Raymond Hill
60827c603d
Cached managed storage content for faster readiness
Related issue:
- https://github.com/uBlockOrigin/uAssets/discussions/16939
2023-03-18 17:23:13 -04:00
Raymond Hill
bb462e6e5d
Actual icon color is #FFCC00, not #FC0 2023-03-18 12:27:40 -04:00
Raymond Hill
a72c068bcc
Make badge color consistent with filtering status
Related commit:
- 32508620a2
2023-03-18 12:16:20 -04:00
Raymond Hill
32508620a2
Emphasize broken filtering at launch on toolbar icon badge
Related feedback:
- 769b8da664 (commitcomment-104695781)

The incomplete filtering status of a given tab at browser launch
will be carried over visually as a yellowish `!` badge until the
web page in the tab is force reloaded, navigated away, or closed.

The purpose is to make it obvious to end users that a web page
has not been filtered properly and to avoid issue reports
related to this.

It is expected that Firefox should never be affected by cases of
yellowish badge -- that is unless the setting "Suspend network
activity [...]" has been disabled, in which case the new behavior
will also be useful to those who disabled the setting.
2023-03-18 11:35:06 -04:00
Raymond Hill
769b8da664
Finalize "unreadiness" toolbar icon
- Yellow uBO toolbar icon: uBO not ready

- Yellow uBO toolbar icon + `!` badge: network requests went
  through while uBO is not ready
2023-03-16 07:13:27 -04:00
Raymond Hill
39cac612c2
Use the warning toolbar icon only if unprocessed requests
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/16939

Related commit:
- 0c9576d3e6
2023-03-15 21:13:28 -04:00
Raymond Hill
47c731f680
Import translation work from https://crowdin.com/project/ublock 2023-03-15 08:16:18 -04:00
Raymond Hill
fc84fdee52
Fine tune scriptlet 2023-03-14 08:21:22 -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
f9b03ebeac
Report unprocessed network request count in troubleshooting info
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/16939
2023-03-08 09:36:09 -05:00
Raymond Hill
0c9576d3e6
Show a distinct toolbar icon until filtering engines are fully initialized
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/16939

Until uBO's filtering engines are properly initialized, there will
be a distinct toolbar icon to help users understand that uBO may
not be fully initialized when a webpage is loaded -- often the
cause of improper filtering of trackers/ads at browser launch.
2023-03-07 16:02:09 -05:00
Raymond Hill
454a03a98f
Use block scope to isolate context 2023-02-24 18:02:28 -05:00
Raymond Hill
e23f0bd7d5
Raise minimum version of Firefox
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/111vv2y/
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2497#discussioncomment-4996662
2023-02-16 10:47:43 -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
8ea3b0f64c
Rewrite static filtering parser
This commit is a rewrite of the static filtering parser into a
tree-based data structure, for easier maintenance and better
abstraction of parsed filters.

This simplifies greatly syntax coloring of filters and also
simplify extending filter syntax.

The minimum version of Chromium-based browsers has been raised
to version 73 because of usage of String.matchAll().
2023-01-23 16:53:18 -05:00
Raymond Hill
1bf763d2a3
Fix https://github.com/uBlockOrigin/uBOL-issues/issues/24 2023-01-08 19:17:55 -05:00
Raymond Hill
d10d0ff14f
Set charset to utf-8 for Blob-based injected scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2431
2023-01-01 09:30:56 -05:00
Raymond Hill
9de9a027ef
Import translation work from https://crowdin.com/project/ublock 2022-12-26 10:39:16 -05:00
Raymond Hill
357a4c7bf5
Import translation work from https://crowdin.com/project/ublock 2022-12-26 10:36:09 -05:00
Raymond Hill
65a3cddf95
Remove mention of removed list 2022-12-26 10:31:13 -05:00
Raymond Hill
84aa217ede
Fix selection of lists test/benchmark platform 2022-12-23 12:55:15 -05:00
Raymond Hill
e5a9b066ec
Fix make target dig-snfe 2022-12-22 13:13:38 -05:00
Raymond Hill
bfed6059d4
Import translation work from https://crowdin.com/project/ublock 2022-12-22 11:10:56 -05:00
Raymond Hill
73c50a4077
[mv3] Remove "AdGuard CNAME-cloaked Trackers" list
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/21
2022-12-20 11:23:42 -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
e2c3917ecd
Unconditionally set label of toolbar icon
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2409
2022-12-15 10:04:03 -05:00
Raymond Hill
a91781a495
Rewrite logger's "exceptor" feature
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1861

The "exceptor" feature has been rewritten, with the following
changes as a result:

- The excepted filters cease to exist when closing the logger
- It's now possible to temporary except network filters

When toggling on/off a temporary exception, filter lists are now
fully reloaded. This simplified managing temporary exceptions, and
made it easy to implement temporary exception for network filters,
but this also means there might be a perceptible delay when
adding/removing temporary exceptions. At this point I consider
this an acceptable side-effect just to bring the ability to easily
create temporary exception for network filters, while this
simplified the existing temporary exception code throughout.
2022-12-14 16:04:45 -05:00
Raymond Hill
ce3f852bad
Fix npm dev dependencies -- this fixes "make test" 2022-12-14 10:55:02 -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
58e60d6d96
Fix various regressions in latest dev build
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2404
- https://github.com/uBlockOrigin/uBlock-issues/issues/2400#issuecomment-1346050327
2022-12-12 14:02:57 -05:00
Raymond Hill
c143ded758
Improve same-origin test for CNAME-uncloaking purpose
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1062

Related feedback:
- 161a175bb0 (commitcomment-90926455)
2022-12-11 11:30:09 -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
15450e3957
Remove now irrelevant scoping 2022-11-29 12:00:38 -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
9ab8de41cf
[mv3] Improve description 2022-11-20 12:20:15 -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
1ef09f9963
[mv3] Add reference description for webstores 2022-11-19 14:31:06 -05:00
Raymond Hill
161a175bb0
Do not cname-uncloak same-origin network requests
Same-origin as per URL address of the main document. Currently the
fix only affect top-level pages.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1062

The previous behavior can be restored by toggling the advanced
setting `cnameIgnoreRootDocument` to `false`.
2022-11-19 14:27:39 -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
b7b53eef14
[mv3] Add support for no-xhr-if/no-fetch-if scriptlets 2022-11-09 11:25:18 -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
2d3d57fbc8
Use our own mirror for Easylist lists 2022-10-27 14:15:57 -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
9879b7d03c
[mv3] Fix overwriting valid DNR rules with invalid entries
This fixes a flaw which has existed since the first version of
uBO Lite.

Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/11

Related commit:
- a559f5f271
2022-10-18 16:12:30 -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
25b0a2c90c
[mv3] Use the most up-to-date version of lists 2022-10-16 13:27:43 -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
30bd6c7bb8
Parse -abp-has as declarative if possible
With the new csstree-based parser, it should now be
safe to parse `-abp-has` as declarative. There are over
a hundred such cosmetic filters in EasyList, and we want
to have these filters declaratively enforced whenever
possible in order to let the browser do the work natively
rather than rely on JS code.
2022-10-14 13:04:47 -04:00
Raymond Hill
af47189da4
Import translation work from https://crowdin.com/project/ublock 2022-10-13 08:24:39 -04:00
Raymond Hill
b6ed70d415
Update en.md 2022-10-12 19:50:33 -04:00
Raymond Hill
9781292e92
[mv3] Add ubol-filters.txt to default set 2022-10-12 10:40:02 -04:00
Raymond Hill
2f9b3e56de
[mv3] Update description 2022-10-12 08:34:59 -04:00
Raymond Hill
2ced5d2fb6
Import translation work from https://crowdin.com/project/ublock 2022-10-11 17:06:03 -04:00
Raymond Hill
873c2e7264
[mv3] Support conditional env_mv3 directive to parser
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/1
2022-10-11 12:02:33 -04:00
Raymond Hill
da6d17c159
[mv3] Add support for aeld scriptlet 2022-10-11 11:13:27 -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
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