1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-19 09:22:40 +02:00
Commit Graph

3634 Commits

Author SHA1 Message Date
Raymond Hill
f8daea085b
Remove assets dependency from redirect engine
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

This change allows to add the redirect engine into the
nodejs package. The purpose of the redirect engine is to
resolve a redirect token into a path to a local resource,
to be used by the caller as wished.
2021-08-02 09:23:48 -04:00
vt
2b9aba2748 Handle invalid meta refresh URLs in noscript scriptlet
Invalid URLs like "http://" and "http://foo@" trigger TypeErrors
when they are passed to the URL constructor. These TypeErrors
caused the scriptlet to stop processing subsequent noscript nodes
due to uncaught exceptions.

These exceptions are now caught to allow all noscript nodes to
be processed.
2021-07-31 13:16:33 -04:00
Raymond Hill
cb72211795
Move orphanizeString() into text-utils module
Another small step toward the goal of reducing dependency
on `µb`.

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

text-iterators module has been renamed text-utils to better
reflect its content.
2021-07-31 08:38:33 -04:00
Raymond Hill
dc08478130
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/1675 2021-07-31 07:15:19 -04:00
Raymond Hill
076a088371
Remove stray async 2021-07-29 17:04:32 -04:00
Raymond Hill
98fc66bb1b
Add support for enabling WASM code paths in NodeJS package
See `test.js` for reference on how to enable WASM code
paths (which are disabled by default).
2021-07-29 16:54:51 -04:00
Raymond Hill
1257dda47f
Import translation work from https://crowdin.com/project/ublock 2021-07-29 09:03:03 -04:00
Raymond Hill
3488e6d5ba
Merge branch 'master' of https://github.com/gorhill/uBlock into 1664 2021-07-29 08:54:48 -04:00
Raymond Hill
8ef8c5ab2e
Group all benchmarking functions in a separate file
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

The various filtering engine benchmarking functions are best
isolated in their own file since they have specific
dependencies that should not be suffered by the filtering
engines.

Additionally, moved decomposeHostname() into uri-utils.js
as it's a hostname-related function required by many
filtering engine cores -- this allows to further reduce
or outright remove dependency on `µb`.
2021-07-29 08:44:15 -04:00
Raymond Hill
62b6826dd5
Further modularize uBO's codebase
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

Modularization is a necessary step toward possibly publishing
a more complete nodejs package to allow using uBO's filtering
capabilities outside of the uBO extension.

Additionally, as per feedback, remove undue usage of console
output as per feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-888451032
2021-07-28 19:48:38 -04:00
Raymond Hill
ee0b2c2fa4
Do not truncate datalayer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1671

Regression from:
- 0dbe581c5b
2021-07-28 12:45:03 -04:00
Raymond Hill
22022f636f
Modularize codebase with export/import
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664

The changes are enough to fulfill the related issue.

A new platform has been added in order to allow for building
a NodeJS package. From the root of the project:

    ./tools/make-nodejs

This will create new uBlock0.nodejs directory in the
./dist/build directory, which is a valid NodeJS package.

From the root of the package, you can try:

    node test

This will instantiate a static network filtering engine,
populated by easylist and easyprivacy, which can be used
to match network requests by filling the appropriate
filtering context object.

The test.js file contains code which is typical example
of usage of the package.

Limitations: the NodeJS package can't execute the WASM
versions of the code since the WASM module requires the
use of fetch(), which is not available in NodeJS.

This is a first pass at modularizing the codebase, and
while at it a number of opportunistic small rewrites
have also been made.

This commit requires the minimum supported version for
Chromium and Firefox be raised to 61 and 60 respectively.
2021-07-27 17:26:04 -04:00
Raymond Hill
f392d09a13
Fix broken the compiling of generic cosmetic exception filters
Related issue:
- https://github.com/uBlockOrigin/uAssets/pull/9637

Regression from
- https://github.com/gorhill/uBlock/commit/c25938f
2021-07-26 08:34:32 -04:00
Raymond Hill
89064478dd
Modernize code: URLSearchParams() API support is now widespread 2021-07-25 07:08:03 -04:00
Raymond Hill
c25938f5bc
Ensure compiled sections are ordered in ascending id
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/oq6kt5/ubo_loads_generic_filter_instead_of_specific/h6a4nca/
2021-07-24 07:44:26 -04:00
Raymond Hill
51d14de44a
Fix handling of some procedural cosmetic filters with explicit :scope
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1011#issuecomment-884806241
2021-07-23 10:11:07 -04:00
Raymond Hill
7645189386
Import translation work from https://crowdin.com/project/ublock 2021-07-22 09:44:41 -04:00
Raymond Hill
cd237ed3e1
Fix rendering of punycoded hostname in popup panel
Regression from:
- 75deadd31e
2021-07-20 11:22:33 -04:00
Raymond Hill
d4b1b8467b
Import translation work from https://crowdin.com/project/ublock 2021-07-20 08:45:27 -04:00
Raymond Hill
75deadd31e
Provide visual cue in popup panel when base domain has subdomains
Related issue:
- https://github.com/gorhill/uBlock/issues/284
2021-07-20 08:37:05 -04:00
Raymond Hill
aff6a2fa05
Import translation work from https://crowdin.com/project/ublock 2021-07-19 11:38:31 -04:00
Raymond Hill
f51106014b
Import translation work from https://crowdin.com/project/ublock 2021-07-19 11:36:38 -04:00
Raymond Hill
448a9a52f6
Better using present tense...? 2021-07-19 11:32:43 -04:00
Raymond Hill
3c5c085ded
Import translation work from https://crowdin.com/project/ublock 2021-07-18 10:14:40 -04:00
Raymond Hill
1d27138da9
Disclose where uBO's own filter lists are hosted 2021-07-18 10:10:17 -04:00
Raymond Hill
5120aac6ad
Import translation work from https://crowdin.com/project/ublock 2021-07-17 12:21:09 -04:00
Raymond Hill
e85c6f2d3e
Merge background changes to user filters in "My filters" pane
Related issue:
- https://github.com/gorhill/uBlock/issues/3704
2021-07-17 12:03:56 -04:00
Raymond Hill
e3f8a612f4
Minor code review 2021-07-16 14:06:59 -04:00
Raymond Hill
a4aced69dc
Reorganize platform directory to avoid Chromium-centric appearance
Though Firefox shares a lot of WebExtensions code with Chromium,
these platforms have their own specific code paths, for various
reasons.

The reorganization here makes it clear that Chromium platform is
just one flavor of WebExtensions, and as such all Chromium-specific
code paths should no longer be automatically pulled by other
platforms where these code paths are not needed.

Given that the filepath of many files changed, here is the
parent commit to quickly browse back to the previous directory
layout:

ec7db30b2f
2021-07-16 10:06:58 -04:00
Raymond Hill
ec7db30b2f
Simplify fetching title of tabs
The title of tabs in uBO is solely to have a better
presentation in the logger -- no other purpose.

This commit simplify keeping track of the titles, from
an active approach by directly querying it from tabs
whenever a change occurs, to a passive approach by
storing it when the title string become available in
some tab event handlers.
2021-07-16 08:59:30 -04:00
Raymond Hill
bbdb68a2b6
Synthesize missing expected onCreatedNavigationTarget events
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1659

This commit introduces a workaround for missing
onCreatedNavigationTarget() in Chromium.
2021-07-15 11:34:37 -04:00
Raymond Hill
e03bb99f57
Add neutered replacement script for mixpanel
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/oicch9/

The new replacement script contains the smallest API
possible to resolve the reported case.

Please report instances where it's not sufficient to
unbreak a site, in which case I will extend the neutered
API to address these cases on an on-demand basis.
2021-07-13 07:58:31 -04:00
Raymond Hill
9a60573abe
Fix broken "Block element..." case when cosmetic filtering is off
Related feedback:
- e983f9a76e (commitcomment-53382148)
2021-07-12 18:32:32 -04:00
Raymond Hill
e983f9a76e
Disable creation of cosmetic filters in picker when unenforceable
Related issue:
- https://github.com/gorhill/uBlock/issues/3212

The element picker will now properly work on sites where
cosmetic filtering is disabled, but will not allow the
creation of cosmetic filters when specific cosmetic filters
are not meant to be enforced in the current page.

When specific cosmetic filters are not meant to be enforced,
the element picker will still allow the creation of network
filters, that is unless the current page is trusted, in which
case using the element picker is pointless.
2021-07-12 11:55:58 -04:00
Raymond Hill
f1a453d349
Avoid pointless check of doc id, presence of doc origin is what matter
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1657
2021-07-12 11:26:25 -04:00
Raymond Hill
717d8593c5
Improve the logger accuracy regarding matched part of the URL
Related issue:
- https://github.com/gorhill/uBlock/issues/3037

This takes care of the specific case reported. There are
other edge cases which are likely not addressed though, i.e.
those involving wildcards -- those should be rather rare and
at this point I rather leave them unaddressed to not
risk regressions (as they are less trivial to address).
2021-07-11 10:11:26 -04:00
Raymond Hill
27c633e054
Better handle negated behhvior types
Related issue:
- https://github.com/gorhill/uBlock/issues/2385
2021-07-10 16:35:52 -04:00
Raymond Hill
ed5dd0a791
Use location.replace() to modify URL of embedded frame
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1648
2021-07-10 09:56:36 -04:00
Raymond Hill
d3b1ca333c
Make getByName() return an dummy Tracker object
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/o44syz/ublock_origin_136_announcement_thread/h4big1n/
2021-07-07 10:52:16 -04:00
Raymond Hill
b75921c2fd
Limit recursion when parsing URL in document-blocked page
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1649
2021-07-06 10:13:50 -04:00
Raymond Hill
80a81284dc
Import translation work from https://crowdin.com/project/ublock 2021-07-03 09:26:21 -04:00
Raymond Hill
4422c42788
Discard network filters containing invalid pattern characters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1146
2021-06-26 12:12:25 -04:00
Raymond Hill
b41463d437
Skip handling non-media elements 2021-06-25 07:24:00 -04:00
Raymond Hill
163035dc92
Drop the v from build version 2021-06-25 07:18:11 -04:00
Raymond Hill
14076fe8c0
Take care of misreporting spurious filter syntax error
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1596
2021-06-24 11:48:27 -04:00
Raymond Hill
0dbe581c5b
Ensure pending callbacks are called only once 2021-06-24 11:08:55 -04:00
Raymond Hill
10efc35610
Import translation work from https://crowdin.com/project/ublock 2021-06-24 11:07:38 -04:00
Raymond Hill
81521256e7
Exclude trusted sites from no-popups-switch
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1616
2021-06-24 11:02:06 -04:00
Raymond Hill
ad15a5dd51
Map csp_report to other
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1622
2021-06-24 08:09:18 -04:00
Raymond Hill
39a51a6e43
Import translation work from https://crowdin.com/project/ublock 2021-06-19 11:22:50 -04:00
Raymond Hill
86ff2404f8
Import translation work from https://crowdin.com/project/ublock 2021-06-17 10:03:50 -04:00
Raymond Hill
090614dd18
Use firstElementChild instead of childElementCount
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1620

Related bugzilla issue:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1715841
2021-06-17 09:58:18 -04:00
Raymond Hill
2ea5fa57e3
Import translation work from https://crowdin.com/project/ublock 2021-06-14 07:41:03 -04:00
Raymond Hill
581e9a1c0c
Also process existing pending callbacks
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1629
2021-06-14 07:36:49 -04:00
Raymond Hill
8877ea290e
Do not redirect when no query parameters are removed
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1626
2021-06-12 13:26:21 -04:00
Raymond Hill
c212fac473
Import translation work from https://crowdin.com/project/ublock 2021-06-12 09:30:09 -04:00
Raymond Hill
32bd47f053
Force restart at first install for Chromium-based browsers
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1547

The approach used to fix the issue was confirmed working
in the following related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1608#issuecomment-856282345
2021-06-12 09:18:56 -04:00
Raymond Hill
ff592977db
Import translation work from https://crowdin.com/project/ublock 2021-06-06 09:04:40 -04:00
Raymond Hill
275b33d7b0
Import translation work from https://crowdin.com/project/ublock 2021-06-04 08:06:39 -04:00
Raymond Hill
a611e5fd50
Import translation work from https://crowdin.com/project/ublock 2021-06-02 07:10:09 -04:00
Raymond Hill
eb519b2ec1
Ensure version changes are persisted at launch 2021-06-02 07:07:10 -04:00
Raymond Hill
e8bc18e1fe
Import translation work from https://crowdin.com/project/ublock 2021-05-31 07:47:58 -04:00
Raymond Hill
3e041ce3b4
Import translation work from https://crowdin.com/project/ublock 2021-05-28 07:25:10 -04:00
Raymond Hill
9f70f655b9
Import translation work from https://crowdin.com/project/ublock 2021-05-28 07:23:33 -04:00
Raymond Hill
1e35ef8e15
Add link to privacy policy to About pane
I was sure it was there already but it turns out
it was not. Now it is.

Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/nklywj/does_ublock_origin_now_collect_personal_data/gzjwhe4/
2021-05-28 07:19:15 -04:00
Raymond Hill
bb426f84a9
Import translation work from https://crowdin.com/project/ublock 2021-05-26 08:01:00 -04:00
Raymond Hill
37ad821018
Fix loss of newlines when processing pre-parsing directives
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1603
2021-05-26 07:51:10 -04:00
Raymond Hill
7508700892
Prevent unchecked default lists from being visually collapsed
Related issue:
- https://github.com/gorhill/uBlock/issues/2303
2021-05-19 09:34:46 -04:00
Raymond Hill
10376090ca
Import translation work from https://crowdin.com/project/ublock 2021-05-19 08:18:03 -04:00
Raymond Hill
8cd2a1d263
Make googletagmanager_gtm.js an alias of google-analytics_analytics.js
Related feedback:
- https://ilakovac.com/teespring-ublock-issue/

The surrogate script googletagmanager_gtm.js was essentially a
subset of surrogate script google-analytics_analytics.js. This
commit makes it a plain alias so that the whole GA API -- often
expected by clients of GTM -- is properly stubbed.
2021-05-18 11:08:20 -04:00
Raymond Hill
3fa7316062
Minor code review
Related commit:
- a24e2a5d6c
2021-05-16 08:16:13 -04:00
Raymond Hill
f3f08d0b4d
Import translation work from https://crowdin.com/project/ublock 2021-05-15 10:56:15 -04:00
Raymond Hill
a24e2a5d6c
Fix management of reload button in popup panel
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1461
2021-05-15 10:45:31 -04:00
Raymond Hill
3ecadcfd04
Import translation work from https://crowdin.com/project/ublock 2021-05-15 08:22:47 -04:00
Raymond Hill
001094580c
Allow filter list subscription through context menu
Related issue/feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/763#issuecomment-841582704
2021-05-15 08:15:57 -04:00
Raymond Hill
cdf6088dfa
Use zero-based index for id
Related issue:
- https://github.com/AdguardTeam/AdguardFilters/issues/75762
2021-05-14 10:30:46 -04:00
Raymond Hill
7574d16509
Import translation work from https://crowdin.com/project/ublock 2021-05-14 09:39:11 -04:00
Raymond Hill
d0e4c60f59
Keep reporting last time "out of date" lists were updated 2021-05-09 11:53:26 -04:00
Raymond Hill
1f8a67f40e
Fix improper hashing of rules in classic popup panel
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/n5vaih/
2021-05-09 11:41:23 -04:00
Raymond Hill
bab6d611eb
Import translation work from https://crowdin.com/project/ublock 2021-04-29 11:41:59 -04:00
Raymond Hill
fca4db8021
Better handle network error when fetching sublist
Reported internally:

> STR --
>
> Import https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/filters.txt
> as a Custom filter list.
>
> Observe the filter count at 24K instead of true count
> being 29K.
>
> Force updating is sometimes compiling 24K filters and
> on subsequent updates 29K, so I narrowed it down to
> this host.

Findings:

One of the sublists was erroring when being fetched on
this particular CDN server (reason unknown).

uBO was not properly handling network errors when
fetching a sublist. This commit make it so that if
a sublist can't be fetched, then the error is propagated
as if it affected the whole list, in which case uBO will
use an alternative URL if any.
2021-04-29 08:32:32 -04:00
Raymond Hill
d307bbd134
Add missing getResponseInformation() method to neutered JS API
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/8970

Adding the missing method does not solve the janky
scrolling, but does solve the spurious error messages
in the page's dev console.
2021-04-27 10:07:37 -04:00
Raymond Hill
81fadf836f
Stop autoplay for unset media source with no-large-media-elements
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/mxgpmc/
2021-04-27 08:59:59 -04:00
Raymond Hill
2a5e67e3f5
Use CDN URLs as fall back URLs
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1566#issuecomment-826473517

Additionally, add more CDN URLs to default filter lists.
2021-04-27 08:56:07 -04:00
Raymond Hill
c736407a04
Import translation work from https://crowdin.com/project/ublock 2021-04-21 09:33:05 -04:00
Raymond Hill
2a8fcfad9e
Import translation work from https://crowdin.com/project/ublock 2021-04-19 08:51:34 -04:00
Raymond Hill
912bdce9cd
Normalize removeparam to removeparam, not queryprune 2021-04-16 08:59:57 -04:00
Raymond Hill
0ff6acd419
Import translation work from https://crowdin.com/project/ublock 2021-04-14 11:02:09 -04:00
Raymond Hill
bc8c1d00ad
Remove advanced setting ignoreScriptInjectFilters
This advanced setting is not really needed, as the
same can be accomplished with a broad exception
filter such as `#@#+js()`.

Related feedback:
- f5b453fae3 (commitcomment-49499082)
2021-04-14 10:56:04 -04:00
Raymond Hill
12347b85b0
Import translation work from https://crowdin.com/project/ublock 2021-04-13 10:27:01 -04:00
Raymond Hill
d0189d78ce
Import translation work from https://crowdin.com/project/ublock 2021-04-13 09:38:07 -04:00
Raymond Hill
58505cfddc
Finalize 3rd-party scripts/frames mini-filtering widget
For now the mini-filtering widget on 3rd-party scripts/frames
cells will allow to emphasize rows which have 3rd-party
scripts and/or frames.

Somewhat related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/210
2021-04-13 09:08:53 -04:00
Raymond Hill
f5b453fae3
Remove advanced setting ignoreScriptInjectFilters
Ever since the `redirect` code was refactored:

157cef6034

This advanced setting is no longer needed, as the same
can be accomplished with a plain network filter:

    @@*$redirect-rule
2021-04-13 08:49:10 -04:00
Raymond Hill
bfdc81e9e4
Ensure FLoC is opt-in by default
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1553

This commit ensures FLoC is opt-in. The generic filter
`*##+js(no-floc)` in "uBlock filters -- Privacy" ensures
the feature is disabled when using default settings/lists.

Users can opt-in to FLoC by adding a generic exception
filter to their custom filters, `#@#+js(no-floc)`; or they
can opt-in only for a specific set of websites through a
more specific exception filter:

    example.com,shopping.example#@#+js(no-floc)
2021-04-11 09:36:56 -04:00
Raymond Hill
9a94ba0a22
Fix regex used to extract attribute name in element picker
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/mh2ctv/
2021-03-31 12:21:29 -04:00
Raymond Hill
b68a800851
Fix regression causing dynamic URL pane to disappear
Reported internally.

Related commit:
- f876b68171
2021-03-14 09:18:51 -04:00
Raymond Hill
b1228f9d51
Add missing new JS file
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1527#issuecomment-798449462

Related commit:
- f876b68171
2021-03-13 09:38:29 -05:00
Raymond Hill
a80b10ac96
Import translation work from https://crowdin.com/project/ublock 2021-03-13 09:09:27 -05:00
Raymond Hill
49f2c0d756
Bring back experimental widget for current dev cycle 2021-03-13 09:08:19 -05:00
Raymond Hill
5e5bc24f63
Alphabetical order 2021-03-13 09:05:54 -05:00
Raymond Hill
f876b68171
Add support for removal of response headers
The syntax to remove response header is a special case
of HTML filtering, whereas the response headers are
targeted, rather than the response body:

  example.com##^responseheader(header-name)

Where `header-name` is the name of the header to
remove, and must always be lowercase.

The removal of response headers can only be applied to
document resources, i.e. main- or sub-frames.

Only a limited set of headers can be targeted for
removal:

  location
  refresh
  report-to
  set-cookie

This limitation is to ensure that uBO never lowers the
security profile of web pages, i.e. we wouldn't want to
remove `content-security-policy`.

Given that the header removal occurs at onHeaderReceived
time, this new ability works for all browsers.

The motivation for this new filtering ability is instance
of website using a `refresh` header to redirect a visitor
to an undesirable destination after a few seconds.
2021-03-13 08:53:34 -05:00
Raymond Hill
af980c5c06
Disable unfinished widget from stable release 2021-03-10 08:17:31 -05:00
Raymond Hill
ed318a57ea
Import translation work from https://crowdin.com/project/ublock 2021-03-10 08:06:38 -05:00
Raymond Hill
a01c03e11a
Fix no-scripting switch not working for SVG-based documents
Issue spotted while trying the following page:
- https://www.xul.fr/svgtetris.svg
2021-03-06 08:18:46 -05:00
Raymond Hill
4e324377b9
Import translation work from https://crowdin.com/project/ublock 2021-03-04 14:34:18 -05:00
Raymond Hill
9f063c717b
Also CSS-escape tag name in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1519
2021-03-04 06:19:44 -05:00
Raymond Hill
fa96a3c622
Import translation work from https://crowdin.com/project/ublock 2021-03-03 10:59:07 -05:00
Raymond Hill
404e6252d6
Fix regression causing exceptions to be thrown
Related commit:
- 1c3b45f75d

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1513
2021-03-03 10:51:56 -05:00
Raymond Hill
1aef8d6f4f
Import translation work from https://crowdin.com/translate/ublock 2021-03-02 13:20:52 -05:00
Raymond Hill
1c3b45f75d
Expose ability to toggle on/off cname-uncloaking to all users
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1513

Prior to this commit, the ability to enable/disable the
uncloaking of canonical names was only available to advanced
users. This commit make it so that the setting can be
toggled from the _Settings_ pane.

The setting is enabled by default. The documentation should
be clear that the setting should not be disabled unless it
actually solves serious network issues, for example:

https://bugzilla.mozilla.org/show_bug.cgi?id=1694404

Also, as a result, the advanced setting `cnameUncloak` is no
longer available from within the advanced settings editor.
2021-03-02 13:00:56 -05:00
Raymond Hill
972feae05d
Drop ctrl-key requirement in "Purge all caches" operation
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/lrcwii/memory_use_in_roaming_profile_in_windows/goq6h4n/
2021-02-26 06:48:26 -05:00
Raymond Hill
b7a2352c6f
Do not suggest network filters with wildcarded hostname in picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1494
2021-02-22 07:57:23 -05:00
Raymond Hill
918a073c81
Fix regression in strict blocking
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/lp6dwp/

Regression from:
- 3af1120082
2021-02-22 06:32:43 -05:00
Raymond Hill
266a7507b8
Fix regression when initializing popup panel
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1505

Regression from:
- 435c91636f
2021-02-21 07:41:09 -05:00
Raymond Hill
3565a0511e
Update comment
DOM logger and inspector are loaded on demand.
2021-02-20 07:05:19 -05:00
Raymond Hill
0dfafc3bd3
Upgrade CodeMirror to 5.59.2
This should fix the following issue:
- https://www.reddit.com/r/uBlockOrigin/comments/lnfyer/

CodeMirror was detecting Windows as iOS:
- https://github.com/codemirror/CodeMirror/issues/6532
2021-02-19 13:07:34 -05:00
Raymond Hill
dfa1b64cae
Fix regression when reverting temporary rules in popup panel
Refression from:
- 435c91636f
2021-02-19 12:32:07 -05:00
Raymond Hill
b263d4d83e
Import translation work from https://crowdin.com/translate/ublock 2021-02-19 08:57:13 -05:00
Raymond Hill
3af1120082
Add support for exception of document to bypass strict-blocking
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1501

Exception filters for `document` option are complying with
uBO's own semantic for `document` option, i.e. an exception
filter for `document` option will only allow to bypass a
block filter for `document` (either explicit or implicit)
and nothing else.

Exception filters using `document` option are *not*
compatible with ABP's interpretation of these filters.
Whereas in ABP the purpose of a `document` exception filter
is to wholly disable content blocking, in uBO the same
filter will just cause strict-blocking to be disabled while
leaving content blocking intact.

Additionally, the logger was fixed to properly report pages
which are being strict-blocked.
2021-02-19 08:38:50 -05:00
Raymond Hill
96049f147e
Reflect latest changes in comment 2021-02-19 08:38:07 -05:00
Raymond Hill
eb6be3a0cf
Fix 'adsbygoogle' neutered script
As per internal feedback.

The `length` property exists if the `adsbygoogle` object
is instantiated before the `adsbygoogle.js` script has
been loaded, but is no longer present once the
`adsbygoogle.js` script has been loaded.
2021-02-19 08:31:58 -05:00
Raymond Hill
9c3205b37c
Inject procedural cosmetic filterer's code only when needed
The procedural cosmetic filtering code has been split from
the content script code injected unconditionally and will
from now on be injected only when it is needed, i.e. when
there are procedural cosmetic filters to enforce.

The motivation for this is:
https://www.debugbear.com/blog/2020-chrome-extension-performance-report#what-can-extension-developers-do-to-keep-their-extensions-fast

Though uBO's content script injected unconditionally in all
pages/frames is relatively small, I still wanted to further
reduce the amount of content script code injected
unconditionally: The procedural cosmetic filtering code
represents roughly 14KB of code the browser won't have to
parse/execute unconditionally unless there exists procedural
cosmetic filters to enforce for a page or frame.

At the time the above article was published, the total
size of unconditional content scripts injected by uBO was
~101 KB, while after this commit, the total size will be
~57 KB (keeping in mind uBO does not minify and does not
remove comments from its JavaScript code).

Additionally, some refactoring on how user stylesheets are
injected so as to ensure that `:style`-based procedural
filters which are essentially declarative are injected
earlier along with plain, non-procedural cosmetic filters.
2021-02-17 09:12:00 -05:00
Raymond Hill
435c91636f
Count allowed/blocked requests for 3rd-party scripts/frames
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/210

Additionally, a small (experimental) widget has been added
to emphasize/de-emphasize rows which have 3rd-party
scripts/frames, so as to more easily identify which rows
are "affected" by 3rd-party scripts and/or frames.

Tooltip localization for the new widget is not available
yet as I want wait for the feature to be fully settled.
2021-02-15 06:52:31 -05:00
Raymond Hill
3715b32d93
Import translation work from https://crowdin.com/project/ublock 2021-02-04 06:55:25 -05:00
Raymond Hill
3bb73065e3
Fix broken forward compatibility re. imported lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1480

Forward compatiblity was broken due to `externalLists`
being converted into an Array from a string, i.e.
downgrading to uBO 1.32.4 was completely breaking uBO.

This commit restores `externalLists` as a string which
is what older versions of uBO expect.

A new property `importedLists` has been created to
hold the imported lists as an array, while
`externalLists` will be kept around for a while until
it is completely removed in some future.
2021-01-31 10:30:12 -05:00
Raymond Hill
0390bb8b8a
Fix potential spurious redirection in whitelisted tabless contexts
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1478
2021-01-30 15:08:21 -05:00
Raymond Hill
28b25f5e5a
Import translation work from https://crowdin.com/project/ublock 2021-01-29 10:46:16 -05:00
Raymond Hill
3101c5fa22
Upload non-filtered rules to cloud storage
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1472
2021-01-28 09:43:14 -05:00
Raymond Hill
40c145d76a
Fix handling of cname-aliased URLs in click-to-load widget
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1455
2021-01-22 09:37:12 -05:00
Raymond Hill
0934779f4b
Improve neutered adsbygoogle scriptlet 2021-01-21 10:13:16 -05:00
Raymond Hill
174731851e
Minor fine tuning of some default parameters 2021-01-21 08:40:10 -05:00
Raymond Hill
b79052de3d
Import translation work from https://crowdin.com/project/ublock 2021-01-21 08:36:08 -05:00
Raymond Hill
6eb1246508
Add userSettings entry to managed storage
The managed `userSettings` entry is an array of entries,
where each entry is a name/value pair encoded into an array
of strings.

The first item in the entry array is the name of a setting,
and the second item is the stringified value for the
setting.

This is a more convenient way for administrators to set
specific user settings. The settings set through
`userSettings` policy will always be set at uBO launch
time.
2021-01-16 10:35:56 -05:00
Raymond Hill
649b3480e0
Add "toOverwrite.filters" entry as managed storage property
The new entry is an array of strings, each representing a
distinct line, and all entries are used to populate the
"My filters" pane.

This offers an more straightforward way for administrators
to specify a list of custom filters to use for all
installations.
2021-01-10 12:31:31 -05:00
Raymond Hill
114012ae11
Add ability to lookup effective context from store of frames
Content scripts can't properly look up effective context
for sandboxed frames. This commit add ability to extract
effective context from already existing store of frames
used for each tab.
2021-01-10 11:56:27 -05:00
Raymond Hill
03e1b16961
Fix content script's broken context lookup from sandboxed anonymous frames 2021-01-08 13:12:48 -05:00
Raymond Hill
0e3071dd50
Add filterLists property to managed storage
The entry `toOverwrite.filterLists` is an array of
string, where each string is a token identifying a
stock filter list, or a URL for an external filter
list.

This new entry is to make it easier for an
administrator to centrally configure uBO with a
custom set of filter lists.
2021-01-08 09:18:26 -05:00
Raymond Hill
e4e7cbc78f
Use better identifying name for overview panel 2021-01-07 08:19:47 -05:00
Raymond Hill
1fcc3c6ddc
Add URL as tooltip 2021-01-07 08:19:02 -05:00
Raymond Hill
c75e347c05
Add missing no-dashboard page
Related commit:
- cc9c45f1e4
2021-01-06 12:09:53 -05:00
Raymond Hill
cc9c45f1e4
Adding to and further reviewing admin-managed settings 2021-01-06 11:39:24 -05:00
Raymond Hill
2ab11603f0
Allow everybody to use now-stable queryprune=
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760
2021-01-06 11:17:07 -05:00
Raymond Hill
c1130ec843
Add support for admin-managed hidden settings
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1437#issuecomment-754127066
2021-01-05 12:16:50 -05:00
Raymond Hill
b28acfccbc
Add "extraTrustedSiteDirectives" as new admin policy
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1433

The new "extraTrustedSiteDirectives" policy is an array
of strings, each of which is parsed as a trusted-site
directive to append to a user's own set of trusted-site
directives at launch time.

The added trusted-site directives will be considered as
part of the default set of directives by uBO.
2021-01-04 07:54:24 -05:00
Raymond Hill
2bb33aac20
Be sure to use only a valid journal slot pointer
Related commit:
- 70cabc1cc6
2021-01-02 12:41:13 -05:00
Raymond Hill
752191a04f
Make sure journal slot pointers are properly reset
For when the same page store is recycled later.
2021-01-02 12:07:31 -05:00
Raymond Hill
70cabc1cc6
Better report secondary requests with quick redirections
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1241

uBO will not discard secondary requests fired before a root
frame is committed, by ensuring that if newly uncommitted
root frames are of the same origin as previous one(s), the
uncommited journal slot pointer is not updated.
2021-01-02 11:52:16 -05:00
Raymond Hill
4d42969a1d
Import translation work from https://crowdin.com/project/ublock 2021-01-01 10:31:23 -05:00
Raymond Hill
c2357c5cd6
Just extract token from queryprune -- don't create pattern
Related commit:
- 6ac09a2856

Patternless `queryprune` ar enow preserved as being
pattern-less while still attempting to extract a token
from the `queryprune` value. This allows to report the
filter in the logger same as its original form.
2021-01-01 10:23:40 -05:00
Raymond Hill
1669d122df
Add resource for noop VMAP
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1425

The resource content is a copy/paste of AdGuard's code:
- bc5eec1989/src/redirects/static-redirects.yml (L134)
2020-12-29 09:05:28 -05:00
Raymond Hill
b003c4de3d
Import punycode library in "My rules"
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1424
2020-12-29 08:33:48 -05:00
Raymond Hill
54e77b1b54
Import translation work from https://crowdin.com/project/ublock 2020-12-28 07:35:19 -05:00
Raymond Hill
2e7f1b8d08
Improve validation of synctactically bad regexes
The following regex are not rejected as invalid when
using built-in regex objects:

    /abc]/
    /a7,18}/
    /a{7,18/

However, as per documentation, they are not supposed to
be valid, as `{` and `}` are special characters and as
such should be escaped:

    /abc\]/
    /a7,18\}/
    /a\{7,18/

With this commit, the regexes will additionally be
validated using the regex analyzer library in the editor
to ensure strict regex syntax compliance so as to avoid
what are likely mistakes in regex crafting by authors.
2020-12-28 07:13:57 -05:00
Raymond Hill
4ba3adc28c
Fix comment 2020-12-28 07:07:04 -05:00
Raymond Hill
d910111d4a
Fix parsing of trailing resource
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1419
2020-12-28 07:03:52 -05:00
Raymond Hill
6d3ad553b4
Fix word-based selection in filter list editor/viewer
This commit fixes mouse double-click-and-drag operations,
which was broken due to the implementation of a custom
word selection in the filter list editor/viewer.
2020-12-27 09:32:50 -05:00
Raymond Hill
b053477087
Fix potentially missing context in logger for popup entries
Reported internally.
2020-12-26 10:15:07 -05:00
Raymond Hill
426395aa03
Improve extraction of tokens from regex-based filters
Regex-based static network filters are those most likely to
cause performance degradation, and as such the best guard
against undue performance degradation caused by regex-based
filters is the ability to extract valid and good tokens
from regex patterns.

This commit introduces a complete regex parser so that the
static network filtering engine can now safely extract
tokens regardless of the complexity of the regex pattern.

The regex parser is a library imported from:
https://github.com/foo123/RegexAnalyzer

The syntax highlighter adds an underline to regex-based
filters as a visual aid to filter authors so as to avoid
mistakenly creating regex-based filters. This commit
further colors the underline as a warning when a regex-based
filter is found to be untokenizable.

Filter list authors are invited to spot these untokenizable
regex-based filters in their lists to verify that no
mistake were made for those filters, causing them to be
untokenizabke. For example, what appears to be a mistake:

    /^https?:\/\/.*\/sw.js?.[a-zA-Z0-9%]{50,}/

Though the mistake is minor, the regex-based filter above
is untokenizable as a result, and become tokenizable when
the `.` is properly escaped:

    /^https?:\/\/.*\/sw\.js?.[a-zA-Z0-9%]{50,}/

Filter list authors can use this search expression in the
asset viewer to find instances of regex-based filters:

    /^(@@)?\/[^\n]+\/(\$|$)/
2020-12-26 08:52:42 -05:00
Raymond Hill
596f085fa5
Allow default word selection when not using better selection
Double-click in editor will just fall back to default word
selection when NOT using enhanced word selection.
2020-12-24 08:34:45 -05:00
Raymond Hill
1c37e29e0a
Fix handling of fragment when applying queryprune
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1415
2020-12-24 07:35:26 -05:00
Raymond Hill
5d617484e5
Upgrade CodeMirror library to 5.59.0 (from 5.46.0) 2020-12-22 09:06:26 -05:00
Raymond Hill
ea71e93c81
Reset Chromium-specific color-scheme CSS property
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1408
2020-12-21 09:20:56 -05:00
Raymond Hill
86a2bcaff0
Import translation work from https://crowdin.com/project/ublock 2020-12-20 12:08:06 -05:00
Raymond Hill
187f1831f0
Allow more local resources to be redirected as data: URIs
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1388#issuecomment-748625280
2020-12-20 11:54:24 -05:00
Raymond Hill
990cff576d
Fix case of scriptlet injection not working about: frames
This is an issue in uBO affecting only Chromium-based browsers.

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-748179731
2020-12-18 12:07:08 -05:00
Raymond Hill
a307cf5e6a
Mind restore-from-backup for no-csp-reports rule
Related commit:
- 7d90f97aa1
2020-12-17 08:12:06 -05:00
Raymond Hill
bc9b8a1330
Enable broad no-csp-reports rule only in Firefox
Related commit:
- 7d90f97aa1
2020-12-16 07:02:55 -05:00
Raymond Hill
095924aa50
New revision for dev build 2020-12-16 07:02:01 -05:00
Raymond Hill
89cac090a4
Mind important only for valid redirect tokens
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1366#issuecomment-745744824
2020-12-16 06:55:46 -05:00
Raymond Hill
a090b2b564
Fix auto-completion for epicker in Firefox 2020-12-15 09:38:20 -05:00
Raymond Hill
0052dc123b
Fix no-csp-reports default enabled switch state
Related feedback:
- 7d90f97aa1 (commitcomment-45138096)
2020-12-15 09:36:04 -05:00
Raymond Hill
e28c2cc3c6
Auto-complete of origin pattern for ||-based patterns
Related commit:
- daf464b3c3
2020-12-15 08:27:59 -05:00
Raymond Hill
8060ddb283
Avoid duplicates in editor's auto-completion of origins
Related commit:
- daf464b3c3
2020-12-14 11:26:04 -05:00
Raymond Hill
b22cf24bd5
Fix look-up of specific-generic filters entity-less hostnames
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-743755956
2020-12-14 11:22:08 -05:00
Raymond Hill
d4425ad753
Fix bad access to hostname info from filtering context
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1398

Regression from:
- 6df32675b1
2020-12-14 08:38:30 -05:00
Raymond Hill
1ff8132216
Simplify code
Related commit:
- b779f1f7c9
2020-12-13 12:14:37 -05:00
Raymond Hill
18e6f30c1c
Minor code review
Related commit:
- 6df32675b1
2020-12-12 14:38:44 -05:00
Raymond Hill
b779f1f7c9
Dynamically reload 3p css when noop-ing "3rd-party" cell
This should improve usability of uBO's hard-mode
and "relax blocking mode" operations. This is the
new default behavior.

The previous behavior of forcing a reload of the
page can be re-enabled by simply setting the `3p`
bit of the advanced setting `blockingProfiles`
to 1.
2020-12-12 14:33:49 -05:00
Raymond Hill
6df32675b1
Add approximate reporting of tabless network requests
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1204

Not much can be done beside reporting to tabless network
requests to all tabs for which the context is a match.

A short term local cache is used to avoid having to iterate
through all existing tabs for each tabless network request
just to find and report to the matching ones -- users
reporting having a lot of opened tabs at once is not so
uncommon.
2020-12-12 08:19:40 -05:00
Raymond Hill
7d90f97aa1
Enable the blocking of CSP reports by default
Related issue:
- https://github.com/LiCybora/NanoDefenderFirefox/issues/196
2020-12-11 12:34:09 -05:00
Raymond Hill
24755d4300
Fix broken alias nostif
Related feedback:
- ba11a70013 (r45030152)

Regression from:
- ba11a70013
2020-12-11 10:34:33 -05:00
Raymond Hill
45373275db
New revision for dev build 2020-12-11 08:50:58 -05:00
Raymond Hill
cb71fb494c
Fix DOM watcher not reporting removal of elements
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1392

Regression from:
- 6112a68faf
2020-12-10 12:51:26 -05:00
Raymond Hill
15afd59e1e
Fix unstyling of nodes no longer matching procedural filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1392

Regression from:
- 35aefed926
2020-12-10 10:03:15 -05:00
Raymond Hill
0b5f53923f
Add basic compatibility with ABP's rewrite option
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/857

The recognized resources are:
- abp-resource:blank-mp3
- abp-resource:blank-js

ABP's tokens are excluded from auto-complete so as to not
get in the way of uBO's filter list maintainers.
2020-12-09 08:16:28 -05:00
Raymond Hill
3ff6617ea3
Fix block filter reported in the logger despite being excepted
Reported internally by @uBlock-user.

Also, fixed broken caching of `cname` exception, which forced
uBO to repeatedly evaluate whether a `cname` exception exists
when a block `cname`-cloaked request is encountered.
2020-12-08 11:16:17 -05:00
Raymond Hill
a440bcbc46
Import translation work from https://crowdin.com/project/ublock 2020-12-08 10:43:02 -05:00
Raymond Hill
9aef41738b
Prevent non-stable uiTheme from being used in stable build
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1389

Asking people to respect the warning in the documentation
does not work, consequently the setting will be now disabled
for stable releases.
2020-12-08 10:11:34 -05:00
Raymond Hill
5d7b2918ef
Harden processing of changes in compiled list format
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1365

This commit adds the compiled magic version number to the
compiled data itself, and consequently this allows uBO
to no longer require that any given compiled list with a
mismatched format to be detected and discarded at launch
time.

Given this change, uBO no longer needs to rely on the
deletion of cached data at launch time to ensure it
won't use no longer valid compiled lists.
2020-12-08 10:00:47 -05:00
Raymond Hill
780b605bad
Fix missing magnifier in document-blocked page
Related feedback:
- e559cb73b9 (commitcomment-44887972)

Regression from:
- e559cb73b9
2020-12-07 14:32:59 -05:00
Raymond Hill
5d838c2098
Import translation work from https://crowdin.com/project/ublock 2020-12-07 11:28:10 -05:00
Raymond Hill
904aa87e2a
Fix various regression in behavior of redirect-rule=
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1388

Fixed the special `none` redirect resource no longer being
enforced.

Fixed the enforcement of `important` redirect rules over
exceptions and non-important ones.
2020-12-07 11:12:41 -05:00
Raymond Hill
5d7a5a559d
Fix broken redirect-rule= priority parser
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1388

Regression from:
- cf2c638d8e
2020-12-07 10:49:05 -05:00
Raymond Hill
a6fc978f70
Import translation work from https://crowdin.com/project/ublock 2020-12-06 11:29:09 -05:00
Raymond Hill
e559cb73b9
Complete removal of font-based Fontawesome icons
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/249
2020-12-06 11:24:04 -05:00
Raymond Hill
7b16c11b87
Import translation work from https://crowdin.com/project/ublock 2020-12-05 15:31:28 -05:00
Raymond Hill
db7f54dbf6
Add support to launch element picker in embedded frames
Related issue:
- https://github.com/gorhill/uBlock/issues/1744

A new context menu entry, "Block element in frame...", will
be present when right-clicking on a frame element. When
this entry is clicked, uBO's element picker will be
launched from within the embedded frame and function the
same way as when launched from within the page.
2020-12-05 15:26:29 -05:00
Raymond Hill
4b921f10e8
Import translation work from https://crowdin.com/project/ublock 2020-12-05 15:21:21 -05:00
Raymond Hill
c77f697b4b
Reuse duplicate strings stored in tries
This is particularly helpful for static network filters
used with filter options causing the same pattern to be
reused across multiple filter instances, i.e. `all` or
`~css`, etc.
2020-12-04 07:53:01 -05:00
Raymond Hill
e8e4a1ac74
Wait for removal of storage entries to be completed
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1365

When compiled data format changes, do not rely on order
of operations at launch to assume deletion of storage
occurs before attempts to access it. It's unclear this
commit will fix the reported issue, as I could not
reproduce it except when outright commenting out the code
to prevent the storage deletion from occurring.
2020-12-04 06:17:18 -05:00