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

3929 Commits

Author SHA1 Message Date
Raymond Hill
8aa379ef9e
Fix argument-less :watch-attr() procedural operator
It's valid to have no argument for `:watch-attr()`.
2022-10-18 07:35:47 -04:00
Raymond Hill
44812dd3c0
[mv3] Salvage network rules with entity syntax in domain= option
It's possible to salvage network rule with entity syntax-based
entries in their `domain=` option if there exists at least one
entry which is not entity syntax-based.

For negated entries, these can be unconditionally removed
safely.
2022-10-17 17:41:13 -04:00
Raymond Hill
614e65a6a5
Import translation work from https://crowdin.com/project/ublock 2022-10-17 08:24:54 -04:00
Raymond Hill
04119e9cdd
Properly handle unsupported `nth-child(an of selector)
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2284#issuecomment-1280325910
2022-10-17 07:26:51 -04:00
Raymond Hill
d22b4e9f71
[mv3] Revert attempt at fixing rules with entity-based syntax
This will need more careful analysis to properly address this.
2022-10-16 13:20:49 -04:00
Raymond Hill
985ea24e82
[mv3] Add support for redirect= filters
This adds support for `redirect=` filters. As with `removeparam=`
filters, `redirect=` filters can only be enforced when the
default filtering mode is set to Optimal or Complete, since these
filters require broad host permissions to be enforced by the DNR
engine.

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

Additionally, fixed the dropping of whole network filters even though
those filters are still useful despite not being completely
enforceable -- for example a filter with a single (unsupported) domain
using entity syntax in its `domain=` option should not be wholly
dropped when there are other valid domains in the list.
2022-10-16 12:05:24 -04:00
Raymond Hill
5a9cd724ca
Add missing method to neutered api 2022-10-15 14:46:12 -04:00
Raymond Hill
30bd6c7bb8
Parse -abp-has as declarative if possible
With the new csstree-based parser, it should now be
safe to parse `-abp-has` as declarative. There are over
a hundred such cosmetic filters in EasyList, and we want
to have these filters declaratively enforced whenever
possible in order to let the browser do the work natively
rather than rely on JS code.
2022-10-14 13:04:47 -04:00
Raymond Hill
af47189da4
Import translation work from https://crowdin.com/project/ublock 2022-10-13 08:24:39 -04:00
Raymond Hill
873c2e7264
[mv3] Support conditional env_mv3 directive to parser
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/1
2022-10-11 12:02:33 -04:00
Raymond Hill
8eb28a446c
[mv3] Introduce per-site filtering modes in lieu of per-site toggle switch 2022-10-10 12:28:24 -04:00
Raymond Hill
5777b672a4
Import translation work from https://crowdin.com/project/ublock 2022-10-10 10:46:19 -04:00
Raymond Hill
5659194932
Fix broken :has() operator in HTML filtering
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2228#issuecomment-1273119017
2022-10-10 08:38:40 -04:00
Raymond Hill
3f8e3fe0c6
Fix nth-of-type() not accepting identifier-based arguments
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2284#issuecomment-1271552479
2022-10-07 09:12:45 -04:00
Raymond Hill
93953f9b21
Prepend attribute flags with space
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2310#issuecomment-1269001494
2022-10-06 16:57:03 -04:00
Raymond Hill
9c0d76346b
Fix discarding attribute flags
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2310
2022-10-05 07:08:35 -04:00
Raymond Hill
24273d2c94
Escape attribute values
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2284#issuecomment-1265417399
2022-10-04 08:11:31 -04:00
Raymond Hill
e12cd232a0
Procedural operators without parenthesis are invalid
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2305

Bump up selfie/compile version numbers. Related feedback:
- 85adde9f0c (commitcomment-85569639)
2022-10-03 10:47:29 -04:00
Raymond Hill
1a9a19a91f
[mv3] Open options page at first install
To be sure first time users are properly informed about the
possibility to enable broad permissions for better filtering.
2022-09-30 09:18:52 -04:00
Raymond Hill
28aee736a5
[mv3] Add support for removeparam= filter option
Consequently, AdGuard URL Tracking Protection (AUTP) has been
added to the set of available filter lists.

However, removeparam= equivalent DNR rules can only be enforced
when granting uBOL broad permissions. If broad permissions are
not granted, removeparam= equivalent DNR rules are ignored.

Exception removeparam= filters are not supported, and these are
present in AUTP and meant to unbreak some websites which are
known to break as a result of removing query parameters.

This is issue might be mitigated in the future by making the
conversion from filters to DNR rules more complicated but this
can never replace the accuracy of uBO's filtering engine being
able to fully enforce arbitrary exception removeparam= filters.

Also, it is not possible to translate regex-based removeparam=
values to DNR rules, so these are dropped at conversion time.

As with other filters to DNR rules conversion, the converter
coallesce many distinct removeparam= filters into fewer DNR
rules.
2022-09-29 19:51:33 -04:00
Raymond Hill
80e17af9fa
Fix parsing of cosmetic filters with empty-string attribute value
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2303
2022-09-29 12:54:25 -04:00
Raymond Hill
b5e2ca8826
Import translation work from https://crowdin.com/project/ublock 2022-09-28 10:40:55 -04:00
Raymond Hill
de0f45581c
Fix logging of sub_frame types
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2302
2022-09-28 09:58:44 -04:00
Raymond Hill
13927fc203
Rules with excludedResourceTypes must not block main_frame
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2298
2022-09-28 09:37:10 -04:00
Raymond Hill
fe4cfeba2e
Code review re. attribute serializer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2300

Related commit:
- 7379bafb23
2022-09-28 09:05:04 -04:00
Raymond Hill
7379bafb23
Fix serializing of unquoted attribute values
Related commit:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2300
2022-09-28 08:34:39 -04:00
Raymond Hill
d3e4bec30a
Add missing ellipsis character 2022-09-27 20:04:38 -04:00
Raymond Hill
61e9a6e9c9
Import translation work from https://crowdin.com/project/ublock 2022-09-27 20:00:06 -04:00
Raymond Hill
0cd019ec7d
Fix preview of :style()-based cosmetic filters 2022-09-27 09:32:58 -04:00
Raymond Hill
51c2e22c7a
[mv3] Fix procedural operator matches-media()
The failure was caused by the fact that there is no
window.matchMedia() API available in Nodejs. The validation
is now done using cssTree.
2022-09-27 07:46:24 -04:00
Raymond Hill
115f7bb687
Fix operator token-to-ctor map
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2294
2022-09-26 22:27:50 -04:00
Raymond Hill
990ad75ca8
Redirect non-existing operators to a void operator
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2292

This will prevent unexpected oversezealous blocking if ever
this happens again. The internal void operator will ensure
no blocking takes place and issue a note about non-existing
operator to the dev tools console.
2022-09-26 16:46:24 -04:00
Raymond Hill
9a31ac8076
Revert removal of matches-css-related filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2292

Related commit:
- a71b71e4c8
2022-09-26 12:23:13 -04:00
Raymond Hill
e29e760b43
Use higher resolution favicons
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2287
2022-09-26 10:18:24 -04:00
Raymond Hill
59aa235952
Forbid relative selector at top level
Related commit:
- a71b71e4c8
2022-09-25 08:51:48 -04:00
Raymond Hill
743210f5df
Fix incomplete parsing of nth-of-type() and some other pseudo-classes
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2284

Regression from:
- a71b71e4c8
2022-09-24 17:27:20 -04:00
Raymond Hill
c698a9fcec
Fix overzealous validation of :style() arguments 2022-09-24 12:14:50 -04:00
Raymond Hill
d588f46a39
Import translation work from https://crowdin.com/project/ublock 2022-09-24 11:40:42 -04:00
Raymond Hill
966a157d19
[mv3] Add support for procedural cosmetic filtering 2022-09-24 11:33:04 -04:00
Raymond Hill
a71b71e4c8
New cosmetic filter parser using CSSTree library
The new parser no longer uses the browser DOM to validate
that a cosmetic filter is valid or not, this is now done
through a JS library, CSSTree.

This means filter list authors will have to be more careful
to ensure that a cosmetic filter is really valid, as there is
no more guarantee that a cosmetic filter which works for a
given browser/version will still work properly on another
browser, or different version of the same browser.

This change has become necessary because of many reasons,
one of them being the flakiness of the previous parser as
exposed by many issues lately:

- https://github.com/uBlockOrigin/uBlock-issues/issues/2262
- https://github.com/uBlockOrigin/uBlock-issues/issues/2228

The new parser introduces breaking changes, there was no way
to do otherwise. Some current procedural cosmetic filters will
be shown as invalid with this change. This occurs because the
CSSTree library gets confused with some syntax which was
previously allowed by the previous parser because it was more
permissive.

Mainly the issue is with the arguments passed to some procedural
cosmetic filters, and these issues can be solved as follow:

Use quotes around the argument. You can use either single or
double-quotes, whichever is most convenient. If your argument
contains a single quote, use double-quotes, and vice versa.

Additionally, try to escape a quote inside an argument using
backslash. THis may work, but if not, use quotes around the
argument.

When the parser encounter quotes around an argument, it will
discard them before trying to process the argument, same with
escaped quotes inside the argument. Examples:

Breakage:

    ...##^script:has-text(toscr')

Fix:

    ...##^script:has-text(toscr\')

Breakage:

    ...##:xpath(//*[contains(text(),"VPN")]):upward(2)

Fix:

    ...##:xpath('//*[contains(text(),"VPN")]'):upward(2)

There are not many filters which break in the default set of
filter lists, so this should be workable for default lists.

Unfortunately those fixes will break the filter for previous
versions of uBO since these to not deal with quoted argument.
In such case, it may be necessary to keep the previous filter,
which will be discarded as broken on newer version of uBO.

THis was a necessary change as the old parser was becoming
more and more flaky after being constantly patched for new
cases arising, The new parser should be far more robust and
stay robist through expanding procedural cosmetic filter
syntax.

Additionally, in the MV3 version, filters are pre-compiled
using a Nodejs script, i.e. outside the browser, so validating
cosmetic filters using a live DOM no longer made sense.

This new parser will have to be tested throughly before stable
release.
2022-09-23 16:03:13 -04:00
Raymond Hill
4bd02c0fb6
[mv3] Inject specific cosmetic filters through scriptlet injection
This solves the following remaining issues regarding specific cosmetic
filtering:
- High rate of false positives in last build
- High number of generated content css files in the package
2022-09-19 08:55:45 -04:00
Raymond Hill
35f4bdd113
Add ext_ubol to tokens recognized by the preparser
`ext_ubol` will evaluate to false in uBO, and true in uBO Lite.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2268
2022-09-18 11:06:07 -04:00
Raymond Hill
154a71c658
Import translation work from https://crowdin.com/project/ublock 2022-09-18 09:36:13 -04:00
Raymond Hill
5ddd3aaac6
[mv3] More work toward improving declarative css/js injection 2022-09-18 09:31:44 -04:00
q1800
b32de13001
Update about.html (#3874) 2022-09-18 07:15:47 -04:00
q1800
706f3b21d7
Update settings.html (#3875) 2022-09-18 07:15:06 -04:00
Raymond Hill
10406f5f74
Import translation work from https://crowdin.com/project/ublock 2022-09-17 08:35:54 -04:00
Raymond Hill
e1b54514cc
[mv3] Add badge reflecting number of injectable content on current site
Additonally, general code review.
2022-09-17 08:26:41 -04:00
Raymond Hill
232c44eeb2
[mv3] Add scriptlet support; improve reliability of cosmetic filtering
First iteration of adding scriptlet support. As with cosmetic
filtering, scriptlet niijection occurs only on sites for which
uBO Lite was granted extended permissions.

At the moment, only three scriptlets are supported:
- abort-current-script
- json-prune
- set-constant

More will be added in the future.
2022-09-16 15:56:35 -04:00
Raymond Hill
e7da3beddd
Fix typo in source code of "Filter lists" pane 2022-09-15 14:57:34 -04:00