1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-01 08:39:37 +02:00
Commit Graph

4350 Commits

Author SHA1 Message Date
Raymond Hill
bf591d93fb
Imrpove no-xhr-if scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2773

The `randomize` paramater introduced in https://github.com/gorhill/uBlock/commit/418087de9c
is now named `directive`, and beside the `true` value which is meant
to respond with a random 10-character string, it can now take the
following value:

  war:[web_accessible_resource name]

In order to mock the XHR response with a web accessible resource. For
example:

  piquark6046.github.io##+js(no-xhr-if, adsbygoogle.js, war:googlesyndication_adsbygoogle.js)

Will cause the XHR performed by the webpage to resolve to the content
of `/web_accessible_resources/googlesyndication_adsbygoogle.js`.

Should the resource not exist, the empty string will be returned.
2023-08-14 10:03:50 -04:00
Raymond Hill
bb41d9594f
[mv3] Use workaround to inject scriptlets in Firefox
Additionally:

Use `export UBO_VERSION=local` at the console to build MV3 extension using
current version of uBO code base. By default, the version is taken from
`./platform/mv3/ubo-version' and usually set to last stable release.
2023-08-11 13:22:25 -04:00
Raymond Hill
79ed0c76cb
Use non-normalized URL for reload/report operations
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2774
2023-08-10 12:10:19 -04:00
Raymond Hill
7bcc340ab0
Add commented keywords to googlesyndication_adsbygoogle.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2773
2023-08-10 09:54:58 -04:00
Raymond Hill
3c609793fd
Improve fingerprint2.js scriptlet
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2741
2023-08-09 09:28:05 -04:00
Raymond Hill
a3a2ac5ec0
Nothing can come after action operator in procedural cosmetic filters
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2760
2023-08-09 08:26:35 -04:00
Raymond Hill
96d7b278b4
Output scriplet errors to console in dev build 2023-08-08 10:29:54 -04:00
Raymond Hill
9ac18318af
Fix parsing cosmetic filter anchor when using AdGuard/ABP modifiers
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2765
2023-08-07 13:58:15 -04:00
Raymond Hill
443c30f18c
Import translation work from https://crowdin.com/project/ublock 2023-08-07 10:46:39 -04:00
Raymond Hill
84cc69aa10
Support negated pattern for stack test in scriptlets
Prepend pattern with `!` to test for unmatched patterns in
stack trace. This applies to sctiplet parameters which purpose
is to test against the stack, i.e. `aost` and `json-prune`.

Additionally, dropped support for JSON notation in favor of
optional variable arguments notation.

Related discussion:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/789#discussioncomment-6520330
2023-07-31 09:38:04 -04:00
Raymond Hill
223e230e49
Fix looking up clickable URLs in code viewer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2759
2023-07-29 10:51:15 -04:00
Raymond Hill
fdb6dc2cc2
Fix remnants of visible text in collapsed rows
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2632#discussioncomment-6517792
2023-07-24 07:40:10 -04:00
Viktor Szépe
c23a9ada33
Fix typos 2023-07-23 10:01:08 -04:00
Raymond Hill
c74fc6460e
Add visual hint for filtered out rows in firewall pane
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2632
2023-07-22 09:11:23 -04:00
Raymond Hill
e23ce99f34
Use , when normalizing list of selectors 2023-07-20 08:05:58 -04:00
Raymond Hill
9ead6ad5ac
Remove obsolete entry
Related commit:
- ee0649329c
2023-07-18 09:42:28 -04:00
Raymond Hill
ee0649329c
Remove obsolete web_accessible_resources
Add removed resource as an alias of `no-window-open-if.js`.

Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/19002#issuecomment-1638367659
2023-07-18 09:39:06 -04:00
Raymond Hill
ef42819b33
Import translation work from https://crowdin.com/project/ublock 2023-07-17 09:36:56 -04:00
Raymond Hill
cf43be53a6
Fix overly wide source link button
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2735
2023-07-17 09:17:33 -04:00
Raymond Hill
cdf385f5f4
Add missing (deprecated) method to google ima
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2265#issuecomment-1637094149
2023-07-16 11:23:31 -04:00
Raymond Hill
aa6baf9a29
Fix regression in handling of experimental header= filter option
Also completed fix for reverse lookup issues related to `header=`
filter option:
https://github.com/uBlockOrigin/uBlock-issues/issues/1932
2023-07-14 09:02:10 -04:00
Raymond Hill
0da7e12ea4
Only already normalized CSS selectors can be fast path-compiled
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2730

CSS selectors used in cosmetic filtering are normalized in order
to ignore non-functional differences. For instance:

    example.org##body      p
    example.org#@#body p

The first cosmetic filter should be excepted by the second one,
but this was not the case because the fast path use to compile
common CSS selectors was not causing normalization to take
place.

The fix is to ensure that the fast path used to compile most
common CSS selectors is taken only when in presence of already
normalized CSS selectors.
2023-07-13 18:02:10 -04:00
Raymond Hill
fbcd6cf29b
Add scriptlet alias for increased compatibility with AdGuard's lists
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2729#issuecomment-1632373662
2023-07-12 07:50:12 -04:00
Raymond Hill
ec06981965
Improve compatibility with AdGuard's scriptlets
Related:
https://testcases.agrd.dev/Filters/scriptlet-rules/test-scriptlet-rules.html
2023-07-11 18:25:21 -04:00
Raymond Hill
4a83b80328
[mv3] Properly enforce generic cosmetic exception filters
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/58
2023-07-11 14:38:35 -04:00
Raymond Hill
4a570c151f
[mv3] Merge modifyHeaders rules where feasible 2023-07-10 13:13:20 -04:00
Raymond Hill
ff7c3d0ad6
Add permissions= handling to built-in benchmark 2023-07-10 12:00:02 -04:00
Raymond Hill
0f6400c160
[mv3] Add support for permissions= filter option
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714
2023-07-10 11:56:57 -04:00
Raymond Hill
de5241ab36
[mv3] Reject filters with unsupported modifier options
For example, filters with `permissions` option.
2023-07-09 09:26:50 -04:00
Raymond Hill
5ebdbf3e24
Add static network filter option: permissions
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2714

Reference:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#permissions-modifier

Example:

    ||example.org^$permissions=browsing-topics=()

Difference with AdGuard's syntax: use `|` to separate permissions
policy directives instead of `\,` -- uBO will replace instances
of `|` with `, `:

    *$permissions=oversized-images=()|unsized-media=()

Eventually uBO will support AdGuard's syntax of using escaped
commas, but not for this first iteration.
2023-07-09 08:03:47 -04:00
Raymond Hill
5739562d10
Use browser.storage.local API for Firefox + private mode
But only if the indexedDB is being created.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2725
2023-07-06 19:58:05 -04:00
Raymond Hill
872eafa378
[mv3] Add support for highly generic cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/54
2023-07-06 15:45:45 -04:00
Raymond Hill
80b3f3c3c0
Fix regression in cloud storage import of "Filter lists" pane
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2721
2023-07-04 07:27:14 -04:00
Raymond Hill
60b21b1422
Prevent negative position when widget size is greater than viewport size
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2718
- https://github.com/uBlockOrigin/uBlock-issues/issues/2704
2023-07-03 07:14:52 -04:00
Raymond Hill
e52da39839
Fine tune network filter option anchor detection
The change allows to better parse AdGuard filters with `replace=`
option when the value to the `replace=` option contains dollar
sign character `$`. uBO will still reject these filters but will
better identify which dollar sign `$` is the real filter option
anchor.
2023-07-03 06:54:46 -04:00
Raymond Hill
622cda2cdf
Add visual hint when not all sublists are enabled
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2687
2023-07-03 06:49:09 -04:00
Raymond Hill
44b281e517
Import translation work from https://crowdin.com/project/ublock 2023-07-01 10:33:02 -04:00
Raymond Hill
33b409dd5b
Add support for AdGuard's noop (_) network filter option
Reference:
- https://adguard.com/kb/general/ad-filtering/create-own-filters/#noop-modifier

uBO already supported the noop filter option `_` to allow filter
authors to resolve possible ambiguities arising when crafting network
filters with many options.

AdGuard extended the semantic of the `_` option to also resolve
readability issues by supporting multiple instances of the `_` option
in a single filter, and also by supporting any number of consecutive
`_` in a single noop filter option.
2023-06-30 16:09:21 -04:00
Raymond Hill
b44815f0c8
Ensure no negative value for top property of floating widget in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2704
2023-06-30 11:45:34 -04:00
Raymond Hill
5d6e103186
Add "tabless" filter expression for logger output
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2711
2023-06-29 15:12:22 -04:00
Raymond Hill
194354cd5d
Add support for logical expressions to !#if directive
Reference:
https://adguard.com/kb/general/ad-filtering/create-own-filters/#conditions-directive

This commit should make uBO fully compatible with the `!#if`
directives found throughout AdGuard's filter lists.

Additionally, added the new `!#else` directive for convenience
to filter list authors:

    !#if cap_html_filtering
    example.com##^script:has-text(fakeAd)
    !#else
    example.com##+js(rmnt, script, fakeAd)
    !#endif
2023-06-29 14:50:42 -04:00
Raymond Hill
9433b218f7
Remove obsolete code 2023-06-29 14:49:43 -04:00
Raymond Hill
7867c25128
Add resource aliases for increased compatibility with AdGuard lists 2023-06-29 14:48:43 -04:00
Raymond Hill
c350e23b2d
Fix regression in parameters-passing in scriptlets 2023-06-29 09:05:48 -04:00
Raymond Hill
de6b1d361d
Fix typo in new getScriptletArgs() method
Additionally, bring mv3 build up to date with latest changes
to scriptlet framework.
2023-06-28 20:05:59 -04:00
Raymond Hill
fd036a51ee
Add compatibility with AdGuard's #%#//scriptlet(...) syntax
Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/332

Additionally, uBO's own scriplet syntax now also accept quoting
the parameters with either `'` or `"`. This can be used to avoid
having to escape commas when they are present in a parameter.
2023-06-28 19:35:22 -04:00
Raymond Hill
8b7a5264de
Fix syntax highlighter throwing with invalid patterns
The syntax highlighter could throw with some invalid static
network filter patterns. This was caused by the syntax
highlighter still drilling down the pattern parts after
having told codemirror to style the whole pattern as an
error, thus causing the codemirror stream position to go
backward.
2023-06-28 08:38:47 -04:00
Raymond Hill
7184f93cb0
Return empty array instead of undefined
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18649
2023-06-23 20:42:58 -04:00
Raymond Hill
7ba85472d7
[mv3] Properly distinguish trust level when compiling scriptlets
Since in uBOL filter lists from various sources are combined into
a single list, there must be a way to turn on/off trust level
inside the resulting combined filter list so as to be able to
validate the trust level of filters requiring trust.

This commit adds new parser directives understood only by MV3
compiler to turn on/off trust flag internally.
2023-06-23 08:27:07 -04:00
Raymond Hill
e50b391105
Prevent creating report until filter lists are updated
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2582#discussioncomment-6187066
2023-06-22 14:36:12 -04:00