1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00
Commit Graph

3951 Commits

Author SHA1 Message Date
Raymond Hill
8a34425ca5
Avoid redundant logger entries for scriptlet injection
Report only when the scriptlets have been successfully injected.
2022-11-06 17:23:06 -05:00
Raymond Hill
c65114ee5e
Add support for Belarusian language 2022-11-06 17:04:56 -05:00
Raymond Hill
49df063191
Try to inject scriptlets at onResponseStarted() time
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2350

As per AdGuard findings, it's possible (though unreliable) to try
to inject scriptlets at webRequest.onResponseStarted time, which
increases scriptlet injection reliability overall when injecting
from multiple entry points.

uBO was already injecting at webNavigation.onCommitted and
main content script time, and adding webRequest.onResponseStarted
as an entry point for scriptlet injection increases reliability
for webpages which executes inline scripts at the top of the DOM.

References:
- https://github.com/AdguardTeam/AdguardBrowserExtension/issues/1029
- https://github.com/AdguardTeam/AdguardBrowserExtension/blob/9ab85be5/Extension/src/background/webrequest.js#L620
2022-11-06 16:54:32 -05:00
Raymond Hill
e0e68a24d2
Import translation work from https://crowdin.com/project/ublock 2022-11-06 13:11:23 -05:00
Raymond Hill
6574ede152
[mv3] Do not merge rules with errors
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/10#issuecomment-1304822579
2022-11-06 11:21:02 -05:00
Raymond Hill
36bfa27c30
Rearrange code flow 2022-11-04 11:08:41 -04:00
Raymond Hill
c3d0d574d7
Fix incorrect serialization of pseudo elements
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/ylnvwf/how_to_block_suggestive_keyword_in_reddit_search/iv014wu/
2022-11-04 10:55:10 -04:00
Raymond Hill
42ddac5e3d
Fix unescaped backslashes in selector attribute
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/yjoh9p/
2022-11-02 08:32:54 -04:00
Raymond Hill
4863f3093e
Do not inject scriptlets on navigation events in Firefox
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2343
2022-10-28 11:07:46 -04:00
Raymond Hill
d992824625
Just to be sure no race condition
Related commit:
- d1f8a05d2d
2022-10-27 16:28:55 -04:00
Raymond Hill
d1f8a05d2d
Further ensure scriptlets are actually injected
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/ye6abt/

Possibly because the Opera sidebar window is a special
case, it appears the scriptlets must be injected at a
later time.

Use a global isolated window variable to detect whether
the scriptlets have really be injected, and ultimately
inject them at main content script time when it is found
they haven't been injected at that point.
2022-10-27 15:52:03 -04:00
Raymond Hill
bccd5a0264
Harden scriptlet injections
This commit make it so scriptlet injections will occur
at the earliest possible time on all platform.

This should also fix the case reported at:
- https://www.reddit.com/r/uBlockOrigin/comments/ye6abt/

Which is caused by the fact that there is no webNavigation
events being fired by the browser. In such case, the changes
here will make it so that uBO will detect that the scriptlet
were not injected and will inject them at main content script
injection time.
2022-10-27 14:16:21 -04:00
Raymond Hill
ae5717ea72
Just use the already existing method 2022-10-24 09:30:29 -04:00
Raymond Hill
fb4059d11c
Add missing API method in neutered resource 2022-10-24 09:11:02 -04:00
Raymond Hill
df7bedbe04
Return punycoded hostname in static extended filtering 2022-10-24 09:08:50 -04:00
q1800
08eb790145
Update support.html (#3876) 2022-10-21 14:17:18 -04:00
Raymond Hill
3d3ad0e386
Void elements (i.e. link) do not need self-closing slash
Ref.:
  https://html.spec.whatwg.org/multipage/syntax.html#void-elements
2022-10-21 12:17:37 -04:00
Raymond Hill
433adac6ff
[mv3] Add ability to handle entity-based CSS and scriptlet injection filters
This commit adds the ability to inject entity-based plain CSS
filters and also a set of the most commonly used entity-based
scriptlet injection filters.

Since the scripting API is not compatible with entity patterns,
the entity-related content scripts are injected in all documents
and the entity-matching is done by the content script themselves.

Given this, entity-based content scripts are enabled only when
working in the Complete filtering mode, there won't be any
entity-based filters injected in lower modes.

Also, since there is no way to reasonably have access to the
Public Suffix List in the content scripts, the entity-matching
algorithm is an approximation, though I expect false positives
to be rare (time will tell). In the event of such false
positive, simply falling back to Optimal mode will fix the
issue.

The following issues have been fixed at the same time:

Fixed the no-filtering mode related rules having lower priority
then redirect rules, i.e. redirect rules would still be applied
despite disabling all filtering on a site.

Fixed improper detection of changes to the generic-related CSS
content script, potentially causing undue delays when for example
trying to access the popup panel while working in Complete mode.
The scripting MV3 can be quite slow when registering/updating
large content scripts, so uBOL does its best to call the API only
if really needed, but there had been a regression in the recent
builds preventing uBO from properly detecting unchanged content
script parameters.
2022-10-20 15:48:06 -04:00
Raymond Hill
7ec59b09ac
Fix improperly detecting ruleset changes re. dynamic URL filtering
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2330\
2022-10-19 12:12:09 -04:00
Raymond Hill
9247072061
Import translation work from https://crowdin.com/project/ublock 2022-10-19 11:38:55 -04:00
Raymond Hill
d027a3f7c4
Fix improperly detecting ruleset changes re. dynamic URL filtering
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2330
2022-10-19 11:37:11 -04:00
Raymond Hill
9879b7d03c
[mv3] Fix overwriting valid DNR rules with invalid entries
This fixes a flaw which has existed since the first version of
uBO Lite.

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

Related commit:
- a559f5f271
2022-10-18 16:12:30 -04:00
Raymond Hill
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