1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-16 23:42:39 +01:00
Commit Graph

4729 Commits

Author SHA1 Message Date
Fanboynz
397d6d47b9
Fix Chartbeat flicker control div's (#3913) 2024-02-13 16:35:20 -05:00
Raymond Hill
a7786a0a32
Import translation work from https://crowdin.com/project/ublock 2024-02-13 15:36:10 -05:00
Raymond Hill
7b138b58c6
Fix potential exfiltration of browsing history by a rogue list author through permissions=
As with `csp=` option, reporting capabilities need to be taken
into account with `permissions=` option.

Reference:
https://github.com/w3c/webappsec-permissions-policy/blob/main/reporting.md

This commit ensures that `permissions=` option using `report-to` are
marked as invalid.
2024-02-13 15:09:38 -05:00
Raymond Hill
db5656f607
Fix potential exfiltration of browsing history by a rogue list author through csp=
As reported internally to ubo-security by https://github.com/distinctmondaylila

One issue is a regression from the rewriting of the static filtering
parser in version 1.47.0, specifically the following commit:
https://github.com/gorhill/uBlock/commit/8ea3b0f64c
The existing regex was no longer suitable to properly detect
some usage of `report-xxx` in the rwritten parser.

Another issue which predates 1.47.0 is that the regex used for
validation was case-sensititive, while the `report-uri` directive
can be written using uppercase letters, i.e. `Report-uri`.
2024-02-13 14:35:08 -05:00
Raymond Hill
28e1424058
Fall back to console if log info can't be relayed to logger 2024-02-02 09:24:24 -05:00
Raymond Hill
b0122bb9fc
Do not rely on vAPI presence in logger broadcast code
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3096#discussioncomment-8339494
2024-02-02 09:15:09 -05:00
Raymond Hill
59d46ecd78
Postprocess selections only from from logger entries
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3097
2024-01-28 11:17:36 -05:00
Raymond Hill
030072c324
Output more information to dev console when loading filter lists
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2993#discussioncomment-8265914
2024-01-27 18:23:04 -05:00
Raymond Hill
fa162e2a31
Fix type
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3096#discussioncomment-8265304
2024-01-27 08:56:00 -05:00
Raymond Hill
cd736b515c
Fix bad CSS style 2024-01-27 07:54:37 -05:00
Raymond Hill
7fee16a4bd
Minor CSS changes in logger's 'Export' tool 2024-01-27 07:51:05 -05:00
Raymond Hill
9d1d5f9839
Support 'week' unit in ! Expires: directive 2024-01-27 07:36:58 -05:00
Raymond Hill
f200bbf5d5
Add trace information to console 2024-01-27 07:22:32 -05:00
Raymond Hill
cb6ff38f86
Fix error when site has only exception scriptlet filters
Cause by recent refactoring of scriptlet-related code.
2024-01-26 20:57:26 -05:00
Raymond Hill
94ec65b7db
Fix regression in response body filtering 2024-01-26 13:52:17 -05:00
Raymond Hill
34da372d7a
Ensure scriptlet logging information make it to destination
Avoid race conditions between isolated world-side broadcast channel
and main-side broadcast channel, so as to not lose logging
information if the isolated world-side is not yet ready to
receive through its broadcast channel.

Additionally, added new scriptlet: `trusted-replace-argument`.

[...]##+js(trusted-replace-argument, fn, argpos, argval [,condition, pattern])

Where:

- `fn` is the function we want to proxy through an `apply` handler.
  This can also be a class, in which case the scriptlet will proxy
  through `construct` handler. At the moment, `fn` must exist at the
  time the scriptlet executes.

- `argpos` is the 0-based position of the argument we want to change

- `argval` is the value we want to have for the argument -- the value
  is interpreted the same way the value for `set-constant` is
  interpreted.

- `condition, pattern` is a vararg which tells the scriptlet to act
  only if `pattern` is found in the argument to overwrite.

Example of usage:

    alliptvlinks.com##+js(trusted-replace-argument, MutationObserver, 0, noopFunc)
2024-01-26 12:18:30 -05:00
Raymond Hill
55e4cee6e8
Discard repeating adjacent entries in the logger 2024-01-26 09:24:10 -05:00
Raymond Hill
567508f619
Fix regression in looking up scriptlets for entity
Related feedback:
https://www.reddit.com/r/uBlockOrigin/comments/19fihsu/
2024-01-26 06:46:21 -05:00
Raymond Hill
49a6dc868f
Fix verbose mode not applying to newly injected scriptlets
Related commit:
869a653fdf
2024-01-25 13:30:41 -05:00
Raymond Hill
c11db790ff
Import translation work from https://crowdin.com/project/ublock 2024-01-25 12:49:32 -05:00
Raymond Hill
feb05f7e83
Add default tooltip until i18n-ed 2024-01-25 12:43:31 -05:00
Raymond Hill
869a653fdf
Output scriptlet logging information to the logger
This commit brings the following changes to the logger:

All logging output generated by injected scriptlets are now sent to
the logger, the developer console will no longer be used to log
scriptlet logging information.

When the logger is not opened, the scriplets will not output any
logging information.

The goal with this new approach is to allow filter authors to
more easily assess the working of scriptlets without having to
go through scriptlet parameters to enable logging.

Consequently all the previous ways to tell scriptlets to log
information are now obsolete: if the logger is opened, the
scriptlets will log information to the logger.

Another benefit of this approach is that the dev tools do not
need to be open to obtain scriptlets logging information.

Accordingly, new filter expressions have been added to the logger:
"info" and "error". Selecting the "scriptlet" expression will also
keep the logging information from scriptlets.

A new button has been added to the logger (not yet i18n-ed): a
"volume" icon, which allows to enable verbose mode. When verbose
mode is enabled, the scriptlets may choose to output more
information regarding their inner working.

The entries in the logger will automatically expand on mouse hover.
This allows to scroll through entries which text does not fit into
a single row.

Clicking anywhere on an entry in the logger will open the detailed
view when applicable.

Generic information/errors will now be rendered regardless of which
tab is currently selected in the logger (similar to how tabless
entries are already being rendered).
2024-01-25 12:20:38 -05:00
Raymond Hill
f1889b02ee
[mv3] Fix conversion of :xpath procedural filters
Procedural filters with `:xpath` operator were silently rejected
at conversion time because the parser was failing to evaluate the
xpath expression due to the absence of a `document` object in
nodejs.

If `document` object is not present, the parser will assume the
xpath expression is valid.
2024-01-22 10:57:48 -05:00
Raymond Hill
3d576603c4
[mv3] uritransform cannot be converted to DNR 2024-01-21 14:32:14 -05:00
Raymond Hill
49dd68ef3d
Code review recent commit re. quoting parameters
Related commit:
fa3a290ad4
2024-01-21 09:26:17 -05:00
Raymond Hill
fa3a290ad4
Fix decompiling of scriptlet parameters
Scriptlets parameters which are quoted must be re-quoted when
output to the logger to be sure they can be properly looked up
in the list, and that they can be used through copy-paste
operations.
2024-01-20 21:46:12 -05:00
Raymond Hill
f624c835c2
Remove minimum height constraint from "My filters" pane
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3058
2024-01-19 11:26:01 -05:00
Raymond Hill
13dcd844a7
Unregister all scriptlets when disabling uBO on a specific site
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3083

This will not completely eliminate the issue but it should
lower the likelihood it will occur -- so at least uBO can
still benefit from reliable scriptlet execution in Firefox.
2024-01-19 11:00:07 -05:00
Raymond Hill
b19094339f
Allow uritransform to process the hash part of a URL
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3084
2024-01-18 11:36:40 -05:00
Raymond Hill
f4f6b5d864
Import translation work from https://crowdin.com/project/ublock 2024-01-17 10:44:41 -05:00
Raymond Hill
3d1b100646
Remember presentation state of "My rules" pane
Related feedback:
https://old.reddit.com/r/uBlockOrigin/comments/198ohgi/
2024-01-17 10:36:23 -05:00
Raymond Hill
0e00010b91
Fix improperly assembled !#include sublists
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3077
2024-01-16 10:04:21 -05:00
Raymond Hill
757b8be9cd
Mark procedural filters with pseudo-elements selector as invalid
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2786
2024-01-16 09:25:22 -05:00
Raymond Hill
101cef44d2
Import translation work from https://crowdin.com/project/ublock 2024-01-16 08:49:52 -05:00
Raymond Hill
bc641fc024
Prevent access to picker when "My filters" is not enabled
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3076
2024-01-16 08:31:46 -05:00
Raymond Hill
3e6333d02b
Further fine tune visual as per feedback
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3066#issuecomment-1891023881
2024-01-14 13:29:58 -05:00
Raymond Hill
c4bb8a0f64
Provide visual feedback when applying changes in "Filter lists" pane
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3066#event-11479409505
2024-01-14 11:25:41 -05:00
Raymond Hill
a605f13e63
Import translation work from https://crowdin.com/project/ublock 2024-01-14 09:58:34 -05:00
Raymond Hill
1cac61a9a4
Empty query parameters must still use =
Related issue:
https://github.com/uBlockOrigin/uAssets/commit/453b544f31
2024-01-14 08:03:03 -05:00
Raymond Hill
e15cb4e8d3
Import translation work from https://crowdin.com/project/ublock 2024-01-12 17:50:08 -05:00
Raymond Hill
1c1091b83f
import translation work from https://crowdin.com/project/ublock 2024-01-12 12:05:03 -05:00
Raymond Hill
936444883f
Add support to toggle no-scripting switch with keyboard shortcut
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/692
2024-01-12 12:01:23 -05:00
Raymond Hill
c03c23d962
Import translation work from https://crowdin.com/project/ublock 2024-01-12 12:00:55 -05:00
Raymond Hill
63fe18a761
Do not exceed rate-limited calls to handlerBehaviorChanged()
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3063

To prevent spurious performance warnings by chromium-based browsers.
2024-01-11 13:25:19 -05:00
Raymond Hill
f6b726136c
Do not prevent applying changes when lists are updating
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3066
2024-01-11 10:50:18 -05:00
Raymond Hill
010cd3f9e0
Import translation work from https://crowdin.com/project/ublock 2024-01-10 12:59:09 -05:00
Raymond Hill
a9eb9630cf
Do not use tab character as field separator
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2730#issuecomment-1881821674

Character `\x1F` is now used instead.
2024-01-09 14:31:00 -05:00
Raymond Hill
4234faafc4
Use arrow function 2024-01-04 11:01:51 -05:00
Raymond Hill
9a104bcbd2
Prevent :others() from hiding html tag
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3060
2024-01-04 10:57:27 -05:00
Raymond Hill
1ea1ff7f4f
Import translation work from https://crowdin.com/project/ublock 2024-01-01 10:30:57 -05:00
Raymond Hill
00fb5f18b2
Add to error message 2023-12-26 11:32:08 -05:00
Raymond Hill
26f45e1fdf
Import translation work from https://crowdin.com/project/ublock 2023-12-23 17:45:36 -05:00
Raymond Hill
ec8292ef92
Fix bad text colors in logger for dark theme
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/1963#discussioncomment-7921578
2023-12-22 19:49:36 -05:00
Raymond Hill
f81d71c6e8
Mind type of drop event items
Related feedback:
https://github.com/gorhill/uBlock/commit/c8b7d1a526#commitcomment-135590810
2023-12-22 11:45:35 -05:00
Raymond Hill
c8b7d1a526
Mind drop events in filter expression field of logger
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/issues/3036#issuecomment-1867497436
2023-12-22 10:45:43 -05:00
Raymond Hill
49c8310e22
Fix message entry overflowing in logger
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3021
2023-12-21 12:02:57 -05:00
Raymond Hill
826bc7d457
It's ok for toLogger() to be in derived class
Related commit:
aa7f77aaad
2023-12-21 11:14:33 -05:00
Raymond Hill
aa7f77aaad
Split scriptlet filtering engine into lo- and hi-level classes
The idea is to remove as many dependencies as possible for
low-level ScriptletFilteringEngine in order to make it easier
to reuse the module outside uBO itself.

The high-level derived class takes care of caching and
injection of scriptlets into documents, which requires
more knowledge about the environment in which scriptlets
are to be used.

Also improve scriptlet cache usage to minimize overhead of
retrieving scriptlets.
2023-12-21 10:48:01 -05:00
Raymond Hill
abeadf18eb
Add support for application/x-javascript in replace= option
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/5090
2023-12-21 10:43:14 -05:00
Raymond Hill
9a8dd66517
Fix having picker & inspector active at the same time
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/3004#issuecomment-1863610146
2023-12-20 11:23:25 -05:00
Raymond Hill
462e8fe917
Import translation work from https://crowdin.com/project/ublock 2023-12-19 12:04:22 -05:00
Raymond Hill
7f2703acd6
Only filter lists are diff-updatable 2023-12-19 11:51:20 -05:00
Raymond Hill
443c1f81e1
Extend support for differential updates to imported lists
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3028
2023-12-19 11:01:40 -05:00
Raymond Hill
24ab492b77
Fix overlooking whether auto-update is disabled
Related feedback:
https://old.reddit.com/r/uBlockOrigin/comments/18ktpd5/
2023-12-18 10:41:48 -05:00
Raymond Hill
ebd9d93666
Prevent element picker from throwing when targeting html/body
Occurred when element picker was launched from context menu
as a result of clicking on `html` or `body` elements.
2023-12-16 11:23:58 -05:00
Raymond Hill
9f4b31a96f
Add detection of mismatched!#if-!#endif in linter
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1712
2023-12-15 16:57:49 -05:00
Raymond Hill
d56468b4ec
Fix launch of auto update shortly after launch
Regression from:
https://github.com/gorhill/uBlock/commit/bd7ce41224
2023-12-15 09:59:56 -05:00
Raymond Hill
a2caa7da78
Fix heuristic to verify whether a resource on a remote server is stale
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3022
2023-12-14 16:51:28 -05:00
Raymond Hill
5e3f9695b4
Support links to update lists which are differential update-friendly
If the `manual` parameter is assigned a date in the form of
`YYMMDD`, this will tell uBO to update lists from origin sources
when the current time is within the range of the specified date,
otherwise lists will be updated from CDNs. Updating from CDNs
is always strongly recommended since this enables differential
updates.

For the time being, `manual=1` will always cause to update lists
from origin, but this form will be deprecated once next stable
release is widespread. The idea is to not leave behind stale
and obsolete links which would be detrimental to differential
updates should someone click on one of these old links left
behind.
2023-12-14 09:50:11 -05:00
Raymond Hill
bd7ce41224
Remove "Purge all caches" button from "Filter lists" pane
Purging all the lists from cache storage is detrimental to
differential update, and cause filter lists to be updated less
often and consequently to be less up to date then when letting
differential updater do its work.
2023-12-13 21:01:51 -05:00
Raymond Hill
14926913f7
Add support for all list token in updater-link feature
Using `listkeys=all` will cause all enabled lists to be updated.
2023-12-12 11:04:16 -05:00
Raymond Hill
4305ea9c0c
Fix logging of broad exception filter #@#+js()
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/843

Regression from:
https://github.com/gorhill/uBlock/commit/1a863a877d
2023-12-12 08:21:47 -05:00
Raymond Hill
a3e3cd9216
Ensure cache storage backend is selected before use
Related commit:
bfa28b960e
2023-12-11 12:17:25 -05:00
Raymond Hill
bfa28b960e
Ensure cache storage is selected before access
Possibly related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2136

Also reported internally, steps to reproduce the issue fixed here:

- Open uBO's dashboard through 3-dot > Add-ons > uBO > Settings
- Bring forth "Filter lists" pane
  We want the tab to be already opened at next launch
- Quit Firefox for Android
- Launch Firefox for Android

Result:

Very long launch time, lists marked as out of date.
2023-12-10 12:33:51 -05:00
Raymond Hill
4183ce477a
Fix popup panel rendering when embedded in logger
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3015
2023-12-09 17:54:02 -05:00
Raymond Hill
7e44db763e
Add visual hint in support information re. differential update
In Support pane's troubleshooting information, a delta sign will
be added to list update information when the list was last updated
through differential update.
2023-12-08 15:28:20 -05:00
Raymond Hill
310bfec6a1
Remove obsolete web accessible resources 2023-12-08 12:06:34 -05:00
Raymond Hill
b35d17143b
Fix DNR output in uBO's dev tools page 2023-12-08 11:45:39 -05:00
Raymond Hill
e789a6b0c5
Import translation work from https://crowdin.com/project/ublock 2023-12-08 10:19:18 -05:00
Raymond Hill
cdc5e89f52
Rename urltransform to uritransform
Related commit:
https://github.com/uBlockOrigin/uAssets/commit/20312c2178

To work around incompatibity with `urltransform` in 1.53.0.
With this commit support for `urltransform` is dropped in
favor of `uritransform`. Since `uritransform` won't be parsed
by older versions of uBO, the change in syntax for `urltransform`
between 1.53.0 and 1.54.0 will no longer cause issue.
2023-12-08 10:07:11 -05:00
Raymond Hill
885bc3875b
Vertically expand/collapse in steps in dom inspector
Additionally, lock the inspected page to the item under
the mouse in the dom inspector.
2023-12-07 20:59:45 -05:00
Raymond Hill
15b1250c99
[firefox] Fix DOM inspector being broken in private window
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3004

Related commit:
ee83a4304a

Use extensions API message ports to establish direct communication
between content script and logger window.
2023-12-06 21:16:48 -05:00
Raymond Hill
06d22ca6c3
Fix details regarding light/dark theme in dom inspector
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/1411#issuecomment-1841509464
2023-12-05 17:38:12 -05:00
Raymond Hill
71be1a4fe5
[mv3] Detect and discard regex-based from=/to= domains 2023-12-05 09:18:58 -05:00
Raymond Hill
eb66820728
]firefox] Improve load time & behavior from suspended state
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2969

Changes:

Use browser.alarms to trigger selfie creation. Presence of a selfie
improve markedly time to readiness when uBO is unsuspended.

Mirror content of storage.local to (in-memory) storage.session for
faster load to readiness when uBO is ususpended.
2023-12-04 15:15:08 -05:00
Raymond Hill
a969a672e0
Change official description in source code top comment 2023-12-04 12:10:34 -05:00
Raymond Hill
5dcb9d42ab
Add support to auto-complete permissions= 2023-12-04 11:19:06 -05:00
Raymond Hill
aa584d750b
Import translation work from https://crowdin.com/project/ublock 2023-12-04 08:13:19 -05:00
Raymond Hill
c744c87607
Reset the DOM inspector when URL in top context changes
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/542
2023-12-04 08:07:53 -05:00
Raymond Hill
03ea001681
Minor 2023-12-03 16:26:05 -05:00
Raymond Hill
ee83a4304a
Isolate DOM inspector layers from page context
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/1411

Additionally, refactored communication mechanism between content
script contexts and uBO contexts by using MessageChannel/BroadcastChannel
web APIs.
2023-12-03 16:21:32 -05:00
Raymond Hill
2c495487f1
Import translation work from https://crowdin.com/project/ublock 2023-12-02 12:59:05 -05:00
Raymond Hill
67fb969572
Refactoring: Replace DOM events with broadcast channels
Broadcast channels are more suited to uBO than DOM events to dispatch
notifications to different parts of uBO.

DOM events can only be dispatched to local context, broadcast channels
dispatch to all contexts (i.e. background process, workers, auxiliary
pages) -- this last behavior is better suited to uBO to communicate
internal changes to all potential listeners, not just those in the local
context.

Additionally, broadcasting to content scripts is now done through
tabs.sendMessage() instead of through potentially opened message
ports, this simplifies broadcasting to content scripts, and this
doesn't require to have long-lived message ports in content
scripts.
2023-12-01 14:35:28 -05:00
Raymond Hill
c4de5552e5
Fix non-filter lists ending into selected lists at install time
Fortunately, getAvailableLists() filters out non-filter
list resources thus preventing those mistakenly selected
resources from being loaded as filter lists.
2023-12-01 12:03:54 -05:00
Raymond Hill
ea7d411bc2
Support non-default sticky lists
"Sticky" lists are those which stay visible when collapsing
non-used lists in the "Filter lists" pane.
2023-12-01 08:31:28 -05:00
rajiv
a8cf08325d
Add enableLazyLoad function
see https://developers.google.com/publisher-tag/reference#javascript_16

Fixes https://github.com/uBlockOrigin/uAssets/issues/20988
2023-12-01 02:20:40 -05:00
Raymond Hill
c16fcc1105
Import translation work from https://crowdin.com/project/ublock 2023-11-29 16:19:23 -05:00
Raymond Hill
2bd2e6a079
Import translation work from https://crowdin.com/project/ublock 2023-11-28 21:10:29 -05:00
Raymond Hill
430c578978
Import translation work from https://crowdin.com/project/ublock 2023-11-27 19:04:43 -05:00
Raymond Hill
5a338b7210
Change frequency of save-to-storage blocking stats
In order to prepare for support of non-persistent background
process.
2023-11-25 11:22:26 -05:00
Raymond Hill
9ce958432d
Catch cases of ! Expires: field with no value 2023-11-22 13:40:49 -05:00
Raymond Hill
f77481f740
Import translation work from https://crowdin.com/project/ublock 2023-11-20 12:47:49 -05:00
Raymond Hill
2da9f0b03f
[mv3] Ensure filters incompatible with DNR are properly reported 2023-11-18 10:46:25 -05:00
Raymond Hill
0c29374a72
Add abp-resource:blank-mp4 alias for increased ABP compatibility 2023-11-18 10:04:52 -05:00
Raymond Hill
3fd2588650
Allow scriptlets to be injected in about:blank
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2963
2023-11-16 17:07:48 -05:00
Raymond Hill
bd8a91ed3a
Add support to redirect to noop.json
There ar ea couple of AdGuard filters supporting this local
resource.

Reference:
https://github.com/AdguardTeam/Scriptlets/blob/master/wiki/about-redirects.md#noopjson
2023-11-16 09:54:21 -05:00
Dave Vandyke
c1d8f5908d
More improvements to the google-ima shim script (#3908)
We have enabled the google-ima shim script again in the DuckDuckGo
Privacy Essentials browser extension, and found a couple more issues:
- Some websites set the enablePreloading[1] option, which should
  cause[2] the AdsManager.init() method to trigger the LOADED AdEvent
  to fire. If the event doesn't fire, those websites can get stuck
  waiting for the event forever.
- When AdsManager.start() method is called, a bunch of events are
  dispatched in order, to simulate ads loading, playing and
  finishing. There was a mistake in that logic though. The
  CONTENT_PAUSE_REQUESTED and CONTENT_RESUME_REQUESTED events[3]
  should fire as the ads start and finish respectively. By firing the
  latter early, and skipping the former, some websites got confused
  and tried to display ad overlays at the same time as playing their
  content, or didn't display they content at all.

1 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRenderingSettings#enablePreloading
2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/preload#timing
3 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent
2023-11-16 09:41:07 -05:00
Raymond Hill
dac320e396
Fix bad argument passing 2023-11-14 18:03:02 -05:00
Raymond Hill
0b871e6546
If response is 404, skip trying other CDNs
When there is a 404 response, in all likelihood other
CDNs will also return 404, no point pointlessly fetching
from others.
2023-11-14 17:39:48 -05:00
Raymond Hill
6a9c69aa94
Add support for minute unit 2023-11-14 13:53:17 -05:00
Raymond Hill
d2b8d990e6
All exceptions filters are exempt from requiring a trusted source
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7566154
2023-11-14 09:58:26 -05:00
Raymond Hill
7c6005278e
Import translation work from https://crowdin.com/project/ublock 2023-11-14 09:05:37 -05:00
Raymond Hill
6d38180608
Fix spurious change in i18n strings 2023-11-14 09:04:06 -05:00
Raymond Hill
92c0088f64
Keep assetKey and diffName well separated 2023-11-13 14:55:52 -05:00
Raymond Hill
a373efe9c0
Import translation work from https://crowdin.com/project/ublock 2023-11-13 10:34:09 -05:00
Raymond Hill
7b2149e595
Fix quirks re. diff-updater 2023-11-13 09:42:31 -05:00
Raymond Hill
b26d421a57
Add Punjabi (pa) translation 2023-11-12 13:51:50 -05:00
Raymond Hill
01d796346c
Import translation work from https://crowdin.com/project/ublock 2023-11-12 13:48:39 -05:00
Raymond Hill
1db569d4ee
Fix last commit
Related commit:
e30223c42e

This needs to be done with currently cached list, not with
failed modified list.
2023-11-11 19:54:05 -05:00
Raymond Hill
e30223c42e
Add check-then-fix code to ensure diff-path name in sync
There is a lot asynchronicity in the auto-update code, and
the fix here is to detect then fix instances of out of sync
state between a cached filter list and its metadata stored
separately.
2023-11-11 15:51:59 -05:00
Raymond Hill
4422926b63
Add more details to error message 2023-11-11 13:25:58 -05:00
Raymond Hill
130c437dd3
Import translation work from https://crowdin.com/project/ublock 2023-11-11 10:55:40 -05:00
Raymond Hill
193672dae5
Extract diff-name from diff-path when diff-name field is missing 2023-11-11 09:35:08 -05:00
Raymond Hill
15e3f763a3
Mind exception filters for replace= option
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2952
2023-11-10 10:45:24 -05:00
Raymond Hill
9f52b4763e
Lookup asset key from diff name
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2948

This fix has to make it into next stable release to ensure
imported external lists can benefit from diff-updater.
2023-11-09 20:01:39 -05:00
Raymond Hill
ec53a8f2c7
Re-work unescaping arguments in parser
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/5184#issuecomment-1803455520
2023-11-09 09:11:59 -05:00
Raymond Hill
9204fdf92c
Partially revert 3ff456a
Related feedback:
3ff456a63d (commitcomment-132105051)
2023-11-09 07:01:22 -05:00
Raymond Hill
831a707616
Typo in comment 2023-11-08 22:40:43 -05:00
Raymond Hill
1dba557c9a
Ensure CSSTree does not hold onto last parsed string
When done compiling, force CSSTree to parse an empty string, so
as to ensure it doesn't keep a reference to that string.

Typically, the string passed to CSSTree is a small slice of a
larger string which is a whole filter list. This means that
holding a reference to the sliced string causes the JS engine
to hold in memory to the whole filter list last parsed.
2023-11-08 22:33:01 -05:00
Raymond Hill
9ebed116da
Import translation work from https://crowdin.com/project/ublock 2023-11-08 19:44:33 -05:00
Raymond Hill
3c5491a8bd
Improve comment 2023-11-08 07:22:23 -05:00
Raymond Hill
856e8de64c
Diff-updater: report URL without the hash part 2023-11-08 07:16:23 -05:00
Raymond Hill
2170051c4a
Fix documentation in comment following recent changes 2023-11-07 17:29:25 -05:00
Raymond Hill
b8193ea5f9
Fix detection of unfilled filter list fields
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/781#discussioncomment-7503866
2023-11-07 17:27:37 -05:00
Raymond Hill
3ff456a63d
Prefer CDNs when subscribing to a new list
Also, purging the cache of a list should not remove the
compiled version of that list so that it keep being seen
as cached, but obsolete.
2023-11-07 08:21:22 -05:00
Raymond Hill
ae24032607
Add more replace-able types
Reference:
https://en.wikipedia.org/wiki/M3U#Internet_media_types
2023-11-07 07:53:37 -05:00
Raymond Hill
2360bc02f3
Lower maximum Expires value to 4h
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2899
2023-11-06 19:45:16 -05:00
Raymond Hill
8ed1ad9c9d
Properly reset needle length in unserialized buffer
Possible related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2925
2023-11-06 19:22:47 -05:00
Imre Kristoffer Eilertsen
a2ab313ae2
Attempted to set flag codes for Chromium Windows users (#3906)
* Attempted to set flag codes for Chromium users

* Not sure how I missed MD.
2023-11-06 16:46:56 -05:00
Raymond Hill
11ebb736ca
Import translation work from https://crowdin.com/project/ublock 2023-11-06 12:16:48 -05:00
Raymond Hill
5d1618e1be
Reset potential g regex before use in replace= option
Related discussion:
https://github.com/uBlockOrigin/uAssets/issues/5184#issuecomment-1794058253
2023-11-06 07:16:41 -05:00
Raymond Hill
6417f54299
Apply response filtering according to mime type
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2833
2023-11-05 19:13:38 -05:00
Raymond Hill
1055203542
Avoid creating a session if there are no jobs 2023-11-05 14:54:59 -05:00
Raymond Hill
ce835bb300
Remove extraneous increment in charset sniffing code
Related commit:
7c3e060c01

Related feedback:
7c3e060c01 (commitcomment-131759551)
2023-11-05 14:19:06 -05:00
Raymond Hill
b69b0b5fb9
Add more mimes as valid target for response filtering
Related feedback:
7c3e060c01 (commitcomment-131754750)

application/vnd.apple.mpegurl
Reference:
https://www.iana.org/assignments/media-types/application/vnd.apple.mpegurl

application/vnd.api+json
Reference:
https://www.iana.org/assignments/media-types/application/vnd.api+json
2023-11-05 12:50:03 -05:00
Raymond Hill
d7c99b46e6
Have urltransform= use the same syntax as replace=
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2924
2023-11-05 11:19:03 -05:00
Raymond Hill
5f78d83fea
Fix various code paths in bodyFilterer
Related to extracting charset of response body.
2023-11-05 10:32:23 -05:00
Raymond Hill
1cf634cce0
Leave out hash part when extracting patch file name
Related commit:
aeff955667
2023-11-05 08:03:43 -05:00
Raymond Hill
c38267bb2b
Fix charset sniffing in reworked response body filtering code
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/830

Related commit:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2537#discussioncomment-5277574
2023-11-04 09:50:10 -04:00
Raymond Hill
4de6bd6f07
Fix potential exceptions in new response body filtering code
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2929

Related commit:
7c3e060c01
2023-11-04 09:43:38 -04:00
Raymond Hill
4774a39b17
[mv3] Fix converter to DNR rules 2023-11-03 21:32:44 -04:00
Raymond Hill
4c48148eb2
Support auto-complete for from= same as domain= 2023-11-03 20:19:19 -04:00
Raymond Hill
d12d014b10
Import translation work from https://crowdin.com/project/ublock 2023-11-03 19:13:07 -04:00
Raymond Hill
7c3e060c01
Implement network filter option replace=
Reference documentation:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#replace-modifier

This is a network filter option which can only be loaded from a
trusted source.

Since this filter is about modifying the response body, it currently
only works in Firefox.

As discussed with filter list maintainers.
2023-11-03 19:01:01 -04:00
Raymond Hill
aeff955667
Extract list name from hash portion of ! Diff-Path: 2023-11-03 18:39:14 -04:00
Raymond Hill
89b272775a
Prevent evaluating the SNFE until fully loaded
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2925
2023-11-03 10:01:40 -04:00
Raymond Hill
605ad238b4
Report modifier stats in built-in benchmark of SNFE 2023-11-02 19:23:06 -04:00
Raymond Hill
4032ac9149
Minor re-wording in log output 2023-11-02 11:49:15 -04:00
Raymond Hill
69fce3aa6e
Fine-tune details about when differential update should kick in
Manual update of one or more lists will cause the most recent version
of these lists to be fetched from the "origin" server, and since the
lists from "origin" servers cannot be updated through differential
update, the lists will be subsequently updated according to their
`Expires` directive.

When the lists are auto-updated, the "CDN" servers will be used,
and as a result the lists will start to be updated trhough
differential updates every 6-hour (currently).

Thus it is recommended and optimal to let the lists auto-update,
since you will benefit from a much shorter delay to get up-to-date
lists (i.e. every 6-hour instead of every 6-day).

You can force the auto-updater to fetch all the lists by clicking
"Purge all caches", then restart uBO without clicking "Update".
This will cause uBO to perform an emergency auto-update at restart
time, after which you will have all the lists which are candidates
for differential update.

The "Update now" button in the "Support" pane will also cause lists
to be fetched from their "origin" server.
2023-11-01 10:45:31 -04:00
Raymond Hill
9058fce037
Fire notification when no update but writeTime change 2023-10-31 16:33:03 -04:00
Raymond Hill
abd8577096
Distinguish diff patch not-available from not-yet-available
A not-yet-available won't cause a list to become candidate for
full update.

A not-available will cause the list to be candidate for full
update.
2023-10-31 10:52:03 -04:00
Raymond Hill
153783cfaa
Forgot to lower update period limit to 6-hour 2023-10-30 20:42:38 -04:00
Raymond Hill
3dca115eb6
Add more dev console tracing to asset updater 2023-10-30 19:49:17 -04:00
Raymond Hill
19d6d7ff5c
Minor code review: remove pointless argument 2023-10-30 14:02:47 -04:00
Raymond Hill
2344cbdeca
Harden diff-updater against unexpected errors
The diff-updater worker will terminate upon unexpected
error, in order to avoid a stalled updater.
2023-10-30 13:47:24 -04:00
Raymond Hill
d05ff8ffeb
Add support for diff-patching filter lists
Related discussion:
https://github.com/ameshkov/diffupdates

The benefits of diff-patching filter lists is much shorter update
schedule and significantly less bandwidth consumed.

At the moment, only default filter lists are subject to be
diff-patched.

External filter lists can make their lists diff-patchable by
following the specification link above.

Only filter lists fetched by the auto-updater are candidate for
diff-patching.

Forcing a manual update of the filter lists will prevent the
diff-patcher from kicking in until one or more lists are
auto-updated.

Some back-of-the-envelop calculations regarding the load on free
CDN solutions used by uBO to distribute its own filter lists:

Currently, for each CDN (with lists updating after days):
~560 M req/month, ~78 TB/month

With diff-patching lists on a 6-hour schedule:
~390 M req/month, 1 TB/month

Those estimates were done according to statistics shown by
jsDelivr, which is one of 4 CDNs picked randomly when a list
updates:
https://www.jsdelivr.com/package/gh/uBlockOrigin/uAssetsCDN?tab=stats
2023-10-30 12:30:46 -04:00
Raymond Hill
032f170dba
Make update-through-link equivalent to auto-update cycle 2023-10-30 12:09:16 -04:00
Raymond Hill
4fa92f930e
Support soft-updating through update links
Where "soft-updating" means updating from CDNs, and "hard-updating"
means updating from `ublockorigin.github.io/uAssets`.
2023-10-30 10:47:38 -04:00
Raymond Hill
b061db229e
Prevent contentScripts.register from throwing
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2915
2023-10-30 10:44:04 -04:00
Raymond Hill
0b59ebf1c6
Import translation work from https://crowdin.com/project/ublock 2023-10-27 21:27:28 -04:00
Raymond Hill
07ac27e07b
Give precedence to Last modified: field when evaluating "age" if lists
Available network information is not very reliable and should be
used only when `Last modified:` is not available.
2023-10-27 21:09:49 -04:00
Raymond Hill
51dfde8f41
Import translation work from https://crowdin.com/project/ublock 2023-10-25 20:04:58 -04:00
Dave Vandyke
0fa30a73c5
Further improve google-ima shim script (#3900)
I worked through some of the websites listed in the google-ima shim
script issue[1], to see what was going wrong. It turned out the
addEventListener method supports an optional context Object, which is
bound to the listener if provided. Some websites make use of that,
and then break when `this` is not bound correctly when events are
dispatched.

See also https://github.com/duckduckgo/tracker-surrogates/pull/24

1 - https://github.com/uBlockOrigin/uBlock-issues/issues/2265
2023-10-25 12:00:21 -04:00
Raymond Hill
c2217a170e
Update user interface srings as suggested 2023-10-25 07:31:23 -04:00
Raymond Hill
e2b9e090ce
Update user interface srings as suggested 2023-10-25 07:28:41 -04:00
Raymond Hill
c1657c2f9c
Import translation work from https://crowdin.com/project/ublock 2023-10-24 11:22:21 -04:00
Dave Vandyke
b445f4f4cd
Improve google-ima shim script (#3899)
We made use of the google-ima shim script from uBlock in the
DuckDuckGo Privacy Essentials extension recently, but found a few
issues with website breakage. After debugging and fixing those[1], I
thought it would be worth sharing the improvements back again. Issues
we ran into:

- The AdDisplayContainer[2] constructor usually creates some DOM
  elements inside the given container. They are all nested within a
  DIV and some websites break when at least that top DIV element isn't
  created.
- While not documented (that I could see), the event listeners can be
  added using an array of event types. Some websites make use of that
  and then hang forever when the expected events aren't fired. This
  caused videos not to play on some websites.
- The Ad.prototype.getUniversalAdIds()[3] method should return an
  array of UniversalAdIdInfo Objects, instead of an Array of
  strings. When an array of strings are returned, some websites then
  break when the UniversalAdIdInfo's methods are missing.
- The UniversalAdIdInfo.prototype.getAdIdValue()[4] method had a typo
  in the name ("getAsIdValue") and was effectively missing. That
  caused some websites to break when the missing method was called.
- The google.ima.OmidVerificationVendor[5] Object was missing, which
  broke some websites that attempted to access it.

1 - 52f2999523
2 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdDisplayContainer
3 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.Ad#getUniversalAdIds
4 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.UniversalAdIdInfo#getAdIdValue
5 - https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima#.OmidVerificationVendor
2023-10-24 11:16:14 -04:00
Raymond Hill
e351551dc4
Move warning sentence to the start
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7353454
2023-10-23 10:01:33 -04:00
Raymond Hill
6c672c99c2
Import translation work from https://crowdin.com/project/ublock 2023-10-23 09:20:59 -04:00
Raymond Hill
589f281f21
Fine tune CSS
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7353182
2023-10-22 18:33:28 -04:00
Raymond Hill
1a1876e593
Import translation work from https://crowdin.com/project/ublock 2023-10-22 18:22:27 -04:00
Raymond Hill
1e745c2f4d
Emphasize warning in "My filters"
Related feedback:
f1ce3b2191 (commitcomment-130633291)
2023-10-22 17:52:38 -04:00
Raymond Hill
9bd483bec3
Enable "not permissions" filtering expression in logger
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714#discussioncomment-6959861
2023-10-22 17:50:45 -04:00
Raymond Hill
9e2c919c24
Import translation work from https://crowdin.com/project/ublock 2023-10-22 15:40:16 -04:00
Raymond Hill
a9ff41ae55
Add filter expressions for logger output
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714#discussioncomment-6959761
2023-10-22 15:33:21 -04:00
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