1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 14:17:11 +02:00
Commit Graph

2461 Commits

Author SHA1 Message Date
Raymond Hill
3891b4d050
query-selectable selectors are not necessarily sheet-selectable
Related commits:
- 4f923384de
- 97a33c9572
- ef07171f5a

For instance, with "Experimental Web Platform features" enabled, the
following filter becomes natively query-selectable:

    .fail:has(+ a > b)

Meaning uBO won't need to emulate the `:has()` operator, it will
be executed natively using `querySelectorAll()`.

This commit fixes the erroneous assumption that a query-selectable
is also sheet-selectable.
2021-10-28 10:36:26 -04:00
Raymond Hill
ef07171f5a
Refactor how cosmetic filters with pseudo-elements are parsed
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1247#issuecomment-953284365

Distinguish between selectors which can be querySelector-ed
and/or used ni a stylesheet.
2021-10-27 18:09:02 -04:00
Raymond Hill
97a33c9572
Fix test for stylesheet presence
Related commit:
- 4f923384de
2021-10-27 15:13:13 -04:00
Raymond Hill
4f923384de
Use an actual stylesheet to validate cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1751

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/qgd6fe/

It turns out Chromium has started to implement the `:has()`
operator, which becomes recognized when the browser flag
"Experimental Web Platform features" is enabled. However the
hic is that `:has()` is not supported as a declarative CSS
style rule and is only supported through `querySelector()`
et al.

The fix is to no longer detect plain CSS selectors through
`querySelector` et al. but rather use an actual stylesheet
to validate that a cosmetic filter can be injected into a
stylesheet in a declarative way.

Additionally, I added support to enforce ABP's semantic
regarding cosmetic filter with the `#?#` anchor: when using
such anchor, uBO will _first_ try to compile the filter as
a procedural one rather than a declarative one.

Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1011#issuecomment-884824166
2021-10-27 12:56:37 -04:00
Raymond Hill
5bea149e8f
Fix spurious errors in uBO's dev console
Those spurious errors occurred when launching the browser
with the dashboard already opened from the previous
browsing session.
2021-10-26 08:54:04 -04:00
Raymond Hill
c136c7b454
Auto-escape commas in removeparam's regexes
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-951146371

This is a quick fix, some refactoring necessary for a more
comprehensive fix to all such issues.
2021-10-26 08:51:55 -04:00
Raymond Hill
d5cfd673dc
Condense list details in Support pane
Related commit:
- a3a43c7cb4
2021-10-22 14:59:41 -04:00
Raymond Hill
65985343fc
Create new page store if not found in tab event
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/757

Sometimes a tab event may fire for a tab which is not
yet known to uBO. In such case, bind the tab internally
so that it can be processed properly in the future.
2021-10-18 09:43:41 -04:00
Raymond Hill
c44117aa70
Further fine tune Support pane
Related commit:
- a3a43c7cb4
2021-10-16 08:43:31 -04:00
Raymond Hill
cd5f58779b
Also check for unsupported tags in descendants 2021-10-16 08:42:55 -04:00
Raymond Hill
c7f1af9547
Fix regression in DOM inspector
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1765

Related commit:
- 1285f78e05 (diff-77e1325098616e4d2bb6b1e9ccf3b7cb9898942739e29f01b63346220f55b2b8L250-R250)
2021-10-15 16:55:40 -04:00
Raymond Hill
730735cc5e
Further fine-tune new Support pane
Related commit:
- a3a43c7cb4

Specifically:
- Support i18n
- Autofill issues opened through Support pane with configuration
  information
- Remove from About pane items found in Support pane
2021-10-15 14:50:34 -04:00
Raymond Hill
2c7fcf7284
Simplify handling of valid HTML tags in i18n files
Use DOMParser instead of trying to manually parse
the HTML tags appearing in i18n files.
2021-10-15 14:49:02 -04:00
Raymond Hill
24553163c5
Minor fixes to new Support page 2021-10-14 12:00:24 -04:00
Raymond Hill
aceaea0122
Minor code review 2021-10-14 09:22:36 -04:00
Eli Grey
1285f78e05
Don't assume document.documentElement is non-null (#3857)
* Fix uBlockOrigin/uBlock-issues#1756

This PR fixes uBlockOrigin/uBlock-issues#1756.

* fix dom-inspector.js

* more explicit if statements

* these changes should also be safe
2021-10-14 09:08:08 -04:00
Raymond Hill
9d0e72b243
Further fine-tuning new Support pane
Related commit:
- a3a43c7cb4
2021-10-14 08:54:38 -04:00
Raymond Hill
f9989f30d8
Further improve new Support pane
For now the language locales are not available as the text on
the page needs to stabilize before asking translation
volunteers to contribute their time working on the new text.
2021-10-13 11:18:23 -04:00
Raymond Hill
e7444883a3
Fine tune data reported in Support pane
Related commit:
- a3a43c7cb4
2021-10-13 08:31:04 -04:00
Raymond Hill
6836809aad
Make Shortcut pane not present by default [Firefox]
By default uBO assumed the Shortcut pane was needed,
unless it found the current version of FF was higher
than 73. This commit reverses the test, it assumes
the Shortcut pane is not needed, unless the current
version is lower than 74.
2021-10-13 08:23:20 -04:00
Raymond Hill
a3a43c7cb4
Add "Support" pane to dashboard
The purpose is to allow users to make it easy to share
technical information about their uBO configuration, and
to make it easy for volunteers to diagnose issues.

This is a first step toward the goal of making it easier
for users to report issues with either uBO or filter
issues on websites.

Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1701
- https://github.com/uBlockOrigin/uBlock-issues/issues/1541
2021-10-12 11:19:56 -04:00
Raymond Hill
01cbe7520d
Fix regression with no-cosmetic-filtering switch
Related commit:
- c4b7ee80ea
2021-10-11 07:07:41 -04:00
Raymond Hill
c4b7ee80ea
Further work on JS modules
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1664
2021-10-07 14:41:29 -04:00
Raymond Hill
c0cba22771
Fix regression of isBlockImportant()
isBlockImportant() was relying strictly on the hash bits
to detect whether a matching filter was `important`, but
this approach regressed with changes with how `important`
filters are compiled. This commit fixed this by no longer
relying on the hash bits but rather on an internal
register variable being set by `important` filters when
they match.

I couldn't find any actual cases in default filter lists
(including a couple of default regional lists) that the
regression is having any effect, due to the limited cases
for which isBlockImportant() is called.

A test was added in a previous commit to detect such
regression in the future:
- a76935b232
2021-10-06 09:57:49 -04:00
Raymond Hill
6464002088
Give precedence to negated types in case of ambiguity
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/7639#issuecomment-933525018
2021-10-06 09:44:15 -04:00
Raymond Hill
a6cd954a2a
Fix handling of negated types in all filter option
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1730

Related commit:
- 8f98622374
2021-09-25 12:36:33 -04:00
Raymond Hill
1130746a9b
Fix regression with important filter option
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1732

The regression affect filter with the `important` option when
the following conditions were fulfilled:

- The filter pattern is pure hostname
- The filter has not one of the following options:
  - domain
  - denyallow
  - header
  - strict1p, strict3p
  - csp
  - removeparam
- There is a matching exception filter

Related commit:
- a2a8ef7e85

A related mocha test has been added in order to detect this
specific regression in the future through `make test`.
2021-09-24 11:09:32 -04:00
Raymond Hill
8f98622374
Refactor implementation of ~[type] filter options
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1730

A new filter unit, FilterNotType, is introduced to enforce
negated filter type options.

Before this commit, there was no actual negated types in the
static network filtering engine, as a negated type was internally
converted to non-negated types at compile time. As a result,
the logger would never output a matching filter with its original
negated type options.

This commit no longer causes an internal conversion to take place
at compile time, but explicitly enforce negated types at match time,
and as a result the logger will from now on output matching filter
with their original negated type options.
2021-09-23 09:38:27 -04:00
Raymond Hill
f49c4e254b
Add advanced setting to default modify webext flavor
Name: modifyWebextFlavor

Value: A list of space-separated tokens to be added/removed from the
computed default webext flavor.

The primary purpose is to give filter list authors the ability to
test mobile flavor on desktop computers. Though mobile versions of
web pages can be emulated using browser dev tools, it's not
possible to do so for uBO itself.

By using `+mobile` as a value for this setting will force uBO
to act as if it's being executed on a mobile device.

Important: this setting is best used in a dedicated browser
profile, as this affects how filter lists are compiled. So best
to set it in a new browser profile, then force all filter lists
to be recompiled, and use the profile in the future when there
is a need to test the specific webext flavor.
2021-09-22 09:37:21 -04:00
Raymond Hill
33a18c3a1e
Convert fingerprint2.js scriptlet into a redirectable resource
As per internal discussion with volunteer filter list
maintainers.
2021-09-18 10:55:22 -04:00
Raymond Hill
4100761863
Keep ability to prevent local IP address leaks for mobile version
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1723

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1723#issuecomment-919913361
2021-09-15 08:28:10 -04:00
Raymond Hill
831cf478da
Revert "Remove now obsolete webrtc-related setting"
This reverts commit af41aadab7.
2021-09-15 07:40:32 -04:00
Raymond Hill
af41aadab7
Remove now obsolete webrtc-related setting
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1723

The leaking of local IP addresses is no longer an issue
in modern browsers.
2021-09-14 10:04:35 -04:00
Raymond Hill
d930504e3e
Better lookup all elements under mouse cursor in element picker
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/pefaov/elementpickerzapper_often_misses_images/hcnycbx/?context=3
2021-09-13 10:39:17 -04:00
Raymond Hill
a3a66d0e31
Avoid parsing query parameters with URLSearchParams
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1717
2021-09-12 12:17:46 -04:00
Eli Grey
6e6697fab6
Fix typo in comment about buffer expiry
The code below the comment specifies 30 seconds, while the comment says 60 seconds. This PR fixes that typo to make the comment indicate 30 seconds.
2021-08-26 17:03:39 -07:00
Raymond Hill
46eb3801ec
Revert "Inject scriptlets at webNavigation.onCommitted time in Firefox"
This reverts commit 7ee9c21b37.

Potentially related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1696
2021-08-26 18:36:36 -04:00
Raymond Hill
7ee9c21b37
Inject scriptlets at webNavigation.onCommitted time in Firefox
Just as is the case with Chromium.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1694
2021-08-25 09:24:10 -04:00
Raymond Hill
a2d8545382
Forbid instances of /* in :style() operator
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1693
2021-08-25 07:43:26 -04:00
Raymond Hill
6dcd5df991
Take into account simple selectors present in array of selectors
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1692
2021-08-24 12:29:48 -04:00
Raymond Hill
f0b46bde4f
Mitigate generic cosmetic filters erroneously targeting html/body
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1692

The ids/classes from html/body elements will leave out
looking up lowly generic cosmetic filters made of a single
identifier.

This does not absolutely guarantee that html/body elements
will never be targeted, but it should greatly mitigate the
probability that this erroneously happens.
2021-08-24 10:03:25 -04:00
Manish Jethani
925c01dc14
Fix ESLint globals error in biditrie.js (#3850) 2021-08-23 11:10:49 -04:00
Manish Jethani
d959c7aabe
Remove globals.js (#3849) 2021-08-23 10:54:16 -04:00
Manish Jethani
d13294dd39
Remove globals usage from background.js (#3848) 2021-08-23 10:28:44 -04:00
Manish Jethani
724a946c79
Remove globals usage from start.js (#3847) 2021-08-23 10:16:02 -04:00
Manish Jethani
9761b02c79
Convert publicsuffixlist.js into an ES module (#3846) 2021-08-23 09:42:27 -04:00
Raymond Hill
ba83c21354
Fix trie instance iterator 2021-08-22 13:06:05 -04:00
Manish Jethani
9ddbb293c0
Convert punycode.js into an ES module (#3845) 2021-08-22 12:03:59 -04:00
Manish Jethani
1bde1e5ecb
Convert regex.js into an ES module (#3844) 2021-08-22 08:25:06 -04:00
Raymond Hill
9d4006f2c3
Include query string when evaluating matches-path()
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1690#issuecomment-903133439
2021-08-21 11:50:46 -04:00