Commit Graph

1361 Commits

Author SHA1 Message Date
Raymond Hill 9443ba80a0
Add `set-local-storage-item`/`trusted-set-local-storage-item` scriptlets
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2697
2023-06-20 10:59:48 -04:00
Raymond Hill 7901a00bd7
Fix handling of `path` in `set-cookie` scriptlet
As per feedback from filter list volunteers.
2023-06-18 15:13:54 -04:00
Raymond Hill bd7318da3c
Fix `m3u-prune` scriptlet
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/14cbznu/foxcom_ssai_workaround/
2023-06-18 14:29:11 -04:00
Raymond Hill 0bd4b600cf
Rework `nowoif` scriptlet
New official name: `no-window-open-if`.

The pattern will now be matched against all arguments passed
to `window.open()`: all the arguments are joined as a single
space-spearated string, and the result is used as the target
for matching the pattern.

To enable logging, used the extra parameters approach, i.e.
`log, 1`, which should come after the positional arguments
`pattern`, `delay`, and `decoy`.
2023-06-17 11:53:08 -04:00
Raymond Hill 112e41b9d5
Fine tune new `set-cookie`/`trusted-set-cookie` scriptlet
Added support for extra parameter `reload, 1`. If present,
the scriplet will force a reload of the webpage if the cookie
being set was not already set.

As per feedback from filter list maintainers.
2023-06-16 11:32:12 -04:00
Raymond Hill 5d596b644d
Remove stray whitespaces 2023-06-15 20:00:57 -04:00
Raymond Hill eaea26b5e9
Add `trusted-set-cookie` scriptlet
This new scriptlet is only valid when used in a trusted lists.

Implementation follows:
https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/trusted-set-cookie.js
2023-06-15 19:57:10 -04:00
Raymond Hill 27a54c0845
Add `set-cookie` scriptlet
This new scriptlet is only valid when used in a trusted lists.

Implementation follows:
https://github.com/AdguardTeam/Scriptlets/blob/master/src/scriptlets/set-cookie.js#L16
2023-06-15 11:08:35 -04:00
Raymond Hill 103bdb63c5
Use hard tabs 2023-06-09 08:02:29 -04:00
Raymond Hill 5e46978b8c
Update `contentURL` of NLD
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/17919
2023-06-09 07:59:43 -04:00
Raymond Hill 257cfad90d
Update `assets.json` for uBO 1.50.0
This may cause some list namesw to not be rendered in a quirky
way in Chromium-based browsers due to country flags emojis not
being available, but this will fixed once people move to
uBO 1.50.0.

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

References:
- https://en.wikipedia.org/wiki/Regional_indicator_symbol
2023-06-07 10:31:46 -04:00
Raymond Hill f8c4b8e52d
Add support to remove attributes in xml-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18244
2023-06-05 08:51:20 -04:00
Raymond Hill f3b720d532
Improve `href-sanitizer` scriptlet 2023-05-30 09:13:46 -04:00
Raymond Hill 56e1d92dbd
Fix/improve scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2678
- https://github.com/uBlockOrigin/uAssets/issues/18278
2023-05-30 08:38:35 -04:00
Raymond Hill 2a3a796d33
Minor fix 2023-05-29 15:05:50 -04:00
Raymond Hill a1a3477b07
Fix oversight in last commit 2023-05-29 14:54:13 -04:00
Raymond Hill c8de904191
Add `evaldata-prune` scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18278
2023-05-29 14:37:02 -04:00
Raymond Hill c642541cc4
Minor fine tuning 2023-05-29 07:34:54 -04:00
Raymond Hill 3ee3275dc1
Harden `addEventListener` scriptlet 2023-05-28 14:56:31 -04:00
Raymond Hill 82eee10c3a
Logging-related changes 2023-05-28 10:37:23 -04:00
Raymond Hill 3c9e946107
Log error in dev console is logging is enabled 2023-05-27 19:05:02 -04:00
Raymond Hill 8ed78cfb23
Support pruning by xpath in `xml-prune` scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18244
2023-05-27 17:26:19 -04:00
Raymond Hill d3fae27017
Add support for xhr in xml-prune
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/18244
2023-05-27 09:14:19 -04:00
Raymond Hill 2bb446797a
Add `remove-node-text.js` scriptlet
The scriptlet remove the *whole* text of a DOM node. Usage:

    example.com##+js(remote-node-text, nodeName, condition, ...)

Where `condition` is a pattern to find in the target node for the
removal to occur. Since the text of the node is wholly removed,
this is not a scriplet which requires a trusted-source, as it is
virtually a similar capability as removing DOM nodes through
procedural cosmetic operator `:remove()` (which can't target
`#text` nodes), which does not require trusted-source.

Alias: `rmnt`

The extra parameters are the same as those documented for
`replace-node-text`.

For consistency, the alias for `replace-node-text` has been renamed
`rpnt`.
2023-05-25 08:51:26 -04:00
Raymond Hill 796ebc2444
Fix spoof-css for Firefox 2023-05-24 16:50:34 -04:00
Raymond Hill 005a0fe95d
Comment 2023-05-24 15:56:42 -04:00
Raymond Hill e33d948fdc
Minor code review 2023-05-24 15:33:46 -04:00
Raymond Hill db7cadae49
Remove pointless code in spoof-css scriptlet 2023-05-24 15:26:57 -04:00
Raymond Hill d4fb87b6ba
Properly return inherited methods in property getter in spoof-css scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2618#issuecomment-1561451479
2023-05-24 14:58:12 -04:00
Raymond Hill 1d9ee00498
Simplify passing extra parameters in scriptlets
When scriptlets can receive extra optional paramaters, these will
now be passed as pair of extra paramaters in the filter declaration,
whereas each pair is a `name, value` instance.

As a result, the optional paramaters that can be passed to the
`aeld` scriptlet can be passed this way, i.e. no longer need
a JSON approach, example:

    github.com##+js(aeld, click, , log, 1)
    github.com##+js(aeld, , , runAt, idle, log, 1)

The non-optional paramaters are always positional, after which
the optional paramaters are non-positional pairs of values.
2023-05-24 11:59:17 -04:00
Raymond Hill 8d1669f9b5
Ensure document.documentElement is present when executing `acs` scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2670
2023-05-24 10:32:03 -04:00
Raymond Hill 879b837669
Fix scriptlet alias 2023-05-23 17:58:20 -04:00
Raymond Hill 842e356610
Put back missing scriptlet dependency
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2668

This broke `set-constant` filters.
2023-05-23 17:03:30 -04:00
Raymond Hill 19cdd50a1c
Add `trusted-set-constant` scriptlet
Alias: `trusted-set`

Behaves exactly like set-constant, except that any arbitrary JSON-
compatible value can be set.

By default the value is treated as a string, which can be anything.

If the value starts with `{` and ends with `}`, the value will be
JSON-parsed, and the `value` property of the resulting object will
be used.

As with any scriptlet requiring trust, filters using
`trusted-set-constant` can only come from trusted filter lists,
otherwise they are discarded.

Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/18185#discussioncomment-5977456
2023-05-23 10:59:27 -04:00
Raymond Hill 824f8b7ceb
Add comments for reviewers 2023-05-23 09:03:19 -04:00
Raymond Hill 1a863a877d
Support injecting scriptlet in MAIN or ISOLATED world
This reflects the _world_ of the MV3 scripting API:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/scripting/ExecutionWorld

MAIN: page's world
ISOLATED: extension's content script world

Some scriptlets are best executed in either world, so this
commit allows to pick in which world a scriptlet should execute
(default to MAIN).

For instance, the new sed.js scriptlet will now execute in
the ISOLATED world.
2023-05-22 20:19:00 -04:00
Raymond Hill 659f35837a
Imrpove sed scriptlet reliability
Related feedback:
- https://github.com/uBlockOrigin/uAssets/discussions/18185
2023-05-22 15:33:47 -04:00
Raymond Hill 99ce027fd7
Review default behavior of new sed.js scriptlet
Related commit:
- 41876336db

The `tryCount` parameter has been removed.

The new default behavior of the sed.js scriptlet is to bail out
when the document itself has been fully loaded, i.e. when
DOMContentLoaded event is fired.

Two new parameters have been added to override the default quit out
behavior:

`stay, 1`

Use to force the scriptlet to stay at work forever.

`quitAfter, ms`

This tells the scriptlet to quit `ms` milliseconds after the
page has been loaded, i.e. after the DOMContentLoaded event has
been fired.

The mutation observer of the sed.js scriptlet can be a significant
overhead for pages with dynamically updated DOM, and in most cases
the scriptlet is useful only for DOM changes occurring before the
DOMContentLoaded event, so the default is to quit out when that
event is received ("quit out" means discarding the mutation observer
and having the scriptlet garbage-collected by the JS engine).
2023-05-22 10:26:09 -04:00
Raymond Hill bd1520ec92
Add easylist-chat to Annoyances/Easylist -- Annoyances section
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13l9c5b/
2023-05-21 21:23:02 -04:00
Raymond Hill aa8a68b8be
Keep reference to non-minimized packaged lists
To ensure smooth transition in next stable release: people on
an older version of uBO could end up updating assets.json,
hence we needs to keep a local URL to the non-minified packaged
version of the lists.
2023-05-21 21:14:49 -04:00
Raymond Hill 23ec2541ef
Prefix lists with ccTLDs instead of 3-letter country codes
ccTLDs are more relatable websites loaded in the browser.
2023-05-21 21:08:29 -04:00
Raymond Hill 41876336db
Add trusted-source support for privileged scriptlets
At the moment, the only filter lists deemed from a "trusted source"
are uBO-specific filter lists (i.e. "uBlock filters -- ..."), and
the user's own filters from "My filters".

A new scriptlet which can only be used by filter lists from trusted
sources has been introduced: `sed.js`.

The new `sed.js` scriptlet provides the ability to perform
text-level substitutions. Usage:

    example.org##+js(sed, nodeName, pattern, replacement, ...)

`nodeName`

The name of the node for which the text content must be substituted.
Valid node names can be found at:
https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName

`pattern`

A string or regex to find in the text content of the node as the target of
substitution.

`replacement`

The replacement text. Can be omitted if the goal is to delete the text which
matches the pattern. Cannot be omitted if extra pairs of parameters have to be
used (see below).

Optionally, extra pairs of parameters to modify the behavior of the scriptlet:

`condition, pattern`

A string or regex which must be found in the text content of the node
in order for the substitution to occur.

`sedCount, n`

This will cause the scriptlet to stop after n instances of substitution. Since
a mutation oberver is used by the scriptlet, it's advised to stop it whenever
it becomes pointless. Default to zero, which means the scriptlet never stops.

`tryCount, n`

This will cause the scriptlet to stop after n instances of mutation observer
run (regardless of whether a substitution occurred). Default to zero, which
means the scriptlet never stops.

`log, 1`

This will cause the scriptlet to output information at the console, useful as
a debugging tool for filter authors. The logging ability is supported only
in the dev build of uBO.

Examples of usage:

    example.com##+js(sed, script, /devtoolsDetector\.launch\(\)\;/, , sedCount, 1)

    example.com##+js(sed, #text, /^Advertisement$/)
2023-05-21 14:16:56 -04:00
Raymond Hill 2a9378b5a8
Use non-minified lists for stable release of assets.json
Because this is what the current stable release (1.49.2) ships
with.

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13n0p4g/
2023-05-20 22:01:55 -04:00
Raymond Hill d506b28a48
Patch Unicode country flags with image-based flags
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645
2023-05-20 21:35:52 -04:00
Raymond Hill d405460584
Add `spoof-css` scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2618

Usage:

    example.com##+js(spoof-css, selector, property-name, property-value, ...)

- selector: a valid CSS selector which matches the elements for which
  the spoofing must apply.
- property-name: a CSS property name (can be dashed- or camel-cased)
- property-value: the value to return regardless of the currently
  computed value.

There can be any number of property-name/property-value pairs, all
separated by commas.

A special property-name/property-value pair `debug/1` can be used
to force the browser to break when `getComputedStyle()` or
`getBoundingClientrect()` is called, useful to help pinpoint usage
of those calls in the page's source code:

    example.com##+js(spoof-css, .ad, debug, 1)
2023-05-20 17:18:44 -04:00
Raymond Hill 02dff78eab
Add back AdGuard Tracking Protection
As per discussion with fitler list maintainers.
2023-05-19 13:11:51 -04:00
Raymond Hill 2ef2888805
Expand/harden some scriptlets
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2615

Expand `set-constant`: 3rd parameter and beyond are tokens which
modify the behavior of `set-contant`. Valid tokens:

- `interactive`, `end`, `2`: set the constant when the event
  `DOMContentInteractive` is fired.
- `complete`, `idle`, `3`: set the constant when the event
  `load` is fired.
- `asFunction`: the constant will be a function returning the
  specified value.
- `asCallback`: the constant will be a function returning a
  function returning the specified value.
- `asResolved`: the constant will be a promise resolving to
  the specified value.
- `asRejected`: the constant will be a promise failing with
  the specified value.

Harden `no-setimeout-if` and `no-setinterval-if` as per feedback
from filter list maintainers.
2023-05-19 12:55:01 -04:00
Raymond Hill df5437a54f
Revert "Render List stats below on mobile"
This reverts commit 9ea39886b6.
2023-05-17 15:44:11 -04:00
Raymond Hill bcb5c441a9
Work on tags (more to do) 2023-05-16 19:49:57 -04:00
Raymond Hill 9ea39886b6
Render List stats below on mobile 2023-05-16 12:10:40 -04:00
Raymond Hill e79d9b2f85
Add more minified version of uBO lists 2023-05-13 15:20:35 -04:00
Raymond Hill c1ac09b96a
Address #17921 2023-05-10 08:50:52 -04:00
Raymond Hill 39a8aaa39b
Rmove unicode-based flags 2023-05-09 09:51:34 -04:00
Raymond Hill 84fad1deeb
Add support for sublists in "Filter lists" pane
As discussed internally with filter list maintainers.

Additionally, added a search field to filter out lists. This
is still a work in progress, no need to open issues about this,
I am aware of what is missing (i18n, more tags, etc.)
2023-05-06 12:50:25 -04:00
Raymond Hill 47c458c27c
Fix bad renaming 2023-05-05 20:56:55 -04:00
Raymond Hill b884d71f04
Use tabs instead of spaces 2023-05-05 10:20:12 -04:00
Raymond Hill 53ba8ded5c
Split AdGuard Annoyances into sublists 2023-05-05 10:13:35 -04:00
Raymond Hill 68539e1fd3
Deprecate "Fanboy Annoyances" in `assets.dev.json`
To be replaced with five sublists.

Users who are already subscribed to the list will have to manually
unsubscribe from it, which will be moved to _Custom_ section, and
subscribe to the sublists which have narrower purpose.
2023-05-05 09:53:25 -04:00
Raymond Hill 223815342e
Make dev build use its own assets.json: assets.dev.json
This will make it easier to safely test new versions of
assets.json.
2023-05-04 19:20:18 -04:00
Raymond Hill 42106cf5ff
Update URLs of NLD list
Related issue:
- https://github.com/uBlockOrigin/uAssets/discussions/17919
2023-05-03 19:35:29 -04:00
Raymond Hill e6e5b1eac4
Add Fanboy lists optimized for uBO: Cookie & Social
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2612
2023-04-29 12:17:51 -04:00
Raymond Hill bbda637294
Host a minified version of uBO lists on CDNs 2023-04-28 17:30:13 -04:00
Raymond Hill 6c29ae82f2
Protect against possible page modification to addEventListener 2023-04-28 07:58:23 -04:00
Raymond Hill 3c12173dfe
Add ability to execute aeld scriptlet at a later time
As per discussion with filter list maintainers.

THis requires to use JSON notation for parameter passing:

- "runAt":  "end" = execute scriptlet at `DOMContentLoaded` event
- "runAt": "idle" = execute scriptlet at `load` event
2023-04-27 12:52:17 -04:00
Raymond Hill d3fbef5f9c
Use uBO-optimized Fanboy lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2610
2023-04-24 12:05:27 -04:00
Raymond Hill 349c8ca619
Fix overzealous logging in acs scriptlet 2023-04-23 09:28:59 -04:00
Raymond Hill 2ab2b48066
Updated the Finnish list source address (#3894)
Co-authored-by: peace2000 <17256841+peace2000@users.noreply.github.com>
2023-04-18 09:46:33 -04:00
Raymond Hill cc062d3a8a
No need for redundant "safe" 2023-04-15 11:14:14 -04:00
Raymond Hill e1500ee88d
Add ability to defer set-constant execution
A new optional parameter has been added to `set-constant`
scriptlet: `runAt`, default to `0`.

 ..##+js(set, document.body.oncontextmenu, null, 2)

When the `runAt` parameter is present, uBO will take it into
account to possibly defer execution of `set-constant`:

- `runAt` not present: execute immediately
- `runAt` = 1: execute immediately
- `runAt` = 2: execute when document state is "interactive"
- `runAt` = 3: execute when document state is `"complete"
2023-04-11 21:45:40 -04:00
Raymond Hill edbe96a401
Add logging ability to `acs` scriptlet, for the benefit of filter list
maintainers.

To enable logging, use the JSON approach to pass parameters to
`acs` scriptlet. Example:

    ..##+js(acs, { "target": "document.oncontextmenu", "log": true })

Whereas "target", "needle", and "context" correspond to their
respective positional argument. Using JSON form to pass parameters
allows to specify extra paramters to facilitate debugging of that
scriptlet:

- `"log": true` => output useful information at the dev console.
- `"debug": true` => break at key locations in the scriptlet.

The added logging/debugging capabilities work only in the dev build
of uBO or if the advanced setting `filterAuthorMode` is set to
`true`.
2023-04-02 12:01:58 -04:00
Raymond Hill b5d78a07bf
Fix type in variable name
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2570
2023-03-30 20:46:44 -04:00
Raymond Hill c8af55e27a
Harden aeld scriptlet against page's tampering
Related feedback:
- https://github.com/uBlockOrigin/uBlock-discussions/discussions/1#discussioncomment-5433222
2023-03-26 14:02:21 -04:00
Raymond Hill 5c9c87e485
Add ability for scriptlets to share local data
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1741

As a result of the new capability, usage of RegExp API in `aost`
scriptlet has been shielded from the webpage tampering with the
API.
2023-03-26 12:31:36 -04:00
Raymond Hill 236fb3ad59
Add scriptlet dependencies to reduce code duplication 2023-03-26 09:13:17 -04:00
Raymond Hill 439951824a
Remove addEventListenerLogger, expand addEventListenerDefuser
The scriptlet addEventListenerLogger has been removed.

The logging of addEventListener() calls can now be done with the
addEventListenerDefuser scriptlet, which now supports the
following named arguments:

"type": the event type to match. Default to '', i.e. match-all.

"pattern": the pattern to match against the handler argument
Default to '', i.e. match-all.

"log": an integer value telling when to log:

- 1: log only when both type and pattern matches, i.e. when a
     call to addEventListener() is defused
- 2: log when either the type or pattern matches
- 3: log all calls to addEventListener()

"debug": an integer value telling when to break into the
 debugger, useful to inspect the debugger's call stack.

- 1: break into the debugger when both type and pattern match,
     so effectively when defusing is taking place.
- 2: break into the debugger when either type or pattern matches.

The usage of named arguments is optional, positional arguments
are still supported as documented. Named arguments is required
to use "log" and/or "debug" arguments.

Obviously, do not use "log" or "debug" in any filter list, these
are investigative tools for filter list authors.

Examples of usage using named arguments:

  wikipedia.org##+js(aeld, { "type": "/mouse/", "pattern": "/.^/", "log": 2 })

Above filter will log calls to addEventListener() which have the
pattern "mouse" in the event type (so "mouseover", "mouseout",
etc.) without defusing any of them (because pattern can't match
anything).

  wikipedia.org##+js(aeld, { "type": "/.^/", "log": 2 })

Above filter will log all calls without defusing any of them
(because type can't match anything)

  wikipedia.org##+js(aeld, { "log": 1 })

Above filter will log and defuse all calls to addEventListener().
2023-03-25 12:35:56 -04:00
Raymond Hill a51130baed
Remove unused scriptlets 2023-03-24 18:46:39 -04:00
Raymond Hill 18a84d2819
Refactor scriptlets injection code
Builtin scriptlets are no longer parsed as text-based resources,
they are imported as JS functions, and `toString()` is used to
obtain text-based representation of a scriptlet.

Scriptlet parameters are now passed as function call arguments
rather than by replacing text-based occurrences of `{{i}}`. The
arguments are always string values (see below for exception).

Support for argument as Object has been added. This opens the
door to have scriptlets using named arguments rather than
positional arguments, and hence easier to extend functionality
of existing scriptlets. Example:

    example.com##+js(scriplet, { "prop": "adblock", "value": false, "log": true })

Compatibility with user-provided scriptlets has been preserved.

User-provided scriptlets can benefit some of the changes:

Use the form `function(..){..}` instead of `(function(..){..})();`
in order to received scriptlet arguments as part of function call
-- instead of using `{{i}}`.

If using the form `function(..){..}`, you can choose to receive
an Object as argument -- just be sure that your scriptlet's
parameter is valid JSON notation.
2023-03-24 14:05:18 -04:00
Raymond Hill 285ce54d9c
Add regional filter list for Croatia/Serbia
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/17088#issuecomment-1460942565
2023-03-21 09:56:43 -04:00
Raymond Hill e93117cbb6
Add `call-nothrow` scriptlet
The purpose is to prevent a call to an existing function from
throwing an exception. The exception will be caught by the
scriptlet and neutralized.

The first argument must be a reference to a function call. At
the moment, the function call must exist at the time the
scriptlet is called.
2023-03-14 18:50:01 -04:00
Raymond Hill 5fe0416001
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/2546 2023-03-14 14:05:20 -04:00
Raymond Hill fc84fdee52
Fine tune scriptlet 2023-03-14 08:21:22 -04:00
Raymond Hill b3821e6869
Support removing whole lines of text with regex in m3u-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2508

If the first argument is a regex with multine flag set, the
scriptlet will execute the regex against the whole text, and
remove matching text from the whole text.

If the matching text does not contains whole lines, the text
won't be removed, i.e. it is not allowed to remove only part
of a line.
2023-03-12 17:45:02 -04:00
Raymond Hill f80c84ab40
Remove references to deprecated `gitcdn.link`
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2136#issuecomment-1465231197
2023-03-12 14:09:44 -04:00
Raymond Hill 4b4ef6a60c
Rename href-from-text to href-sanitizer, add argument
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2531#issuecomment-1462389539

Usage:
- example.com##+js(href-sanitizer, a[href^="/go?to="]:not([title]))
- example.com##+js(href-sanitizer, a[href^="/go?to="][title], [title])

The second argument is the attribute from which to extract the text
to be used for the `href` attribute of the link. If the second
attribute is absent, the text content of the element will be used.
2023-03-09 13:37:06 -05:00
Raymond Hill e123256eaf
Add experimental href-from-text scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2531

Usage:

    example.com##+js(href-from-text, a[href^="/tracker-link?to="]

The above scriptlet will find all elements matching the selector
passed as 1st argument, and replace the `href` attribute with the
text content of the element, if all the following conditions are
met:

- The element is a link (`a`) element
- The link element has an existing `href` attribute
- The text content of the element is a valid `https`-based URL
2023-03-09 08:49:26 -05:00
Raymond Hill 088e90ed42
Add list for Macedonia; add languages to Persian list
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2522
- https://github.com/AdguardTeam/AdguardFilters/pull/144318#issuecomment-1451721914
2023-03-02 17:09:32 -05:00
Raymond Hill 46c1eb8678
Update URLs to EasyDutch list
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/11204#issuecomment-1384238094
2023-01-23 20:04:01 -05:00
Raymond Hill 98c0bd8406
Remove AdGuard Tracking Protection from stock lists
Related issue:
- https://github.com/AdguardTeam/AdguardFilters/issues/139081#issuecomment-1375396423
2023-01-11 20:29:07 -05:00
Raymond Hill eb88e6fb12
Fix bad JSON 2022-12-26 09:11:04 -05:00
Raymond Hill 8f66de67e1
Remove gitcdn.link as CDN provider
Appears broken at the moment. Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1165#issuecomment-1364607559
2022-12-25 07:40:13 -05:00
Raymond Hill c88f4445d1
Update invalid SDN URL for EasyList Lithuania
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2420
- https://github.com/uBlockOrigin/uBlock-issues/issues/1566#issuecomment-826372745
2022-12-22 10:34:49 -05:00
Raymond Hill 6140e55589
Remove combinatronics.io as CDN 2022-12-02 11:39:32 -05:00
Raymond Hill 17590c5a0c
Use `git clone` instead of submodule to pull uAssets dependencies
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2358

We need two different branches of uAssets to properly add the
default filter lists into the packages. I couldn't figure out
how to do this with submodules, using simple `git clone` as a
dependency just work.
2022-11-14 09:50:53 -05:00
Raymond Hill 2f646dbdb0
Pull reference Easylist assests from own repo 2022-10-24 12:37:04 -04:00
Raymond Hill e84b374279
Partially revert fd945f3358 2022-10-19 18:17:39 -04:00
Raymond Hill 83b9ca5db6
Don't use github as cdn for EasyList/EasyPrivacy 2022-10-17 17:21:01 -04:00
Raymond Hill fd945f3358
Add mirrors for EasyList lists 2022-10-05 10:37:33 -04:00
Raymond Hill ec83127f6c
Update m3u-prune scriptlet 2022-09-26 22:37:11 -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 6828e1c3b2
Bail out early if missing required argument 2022-09-25 06:57:51 -04:00
Raymond Hill 596145ceb9
Harden xml-prune scriptlet 2022-09-25 06:49:41 -04:00
Raymond Hill bf690145c4
Add new scriptlet: xml-prune
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/14849

Arguments:

1. Required. The selector of elements which are to be removed.
   Example: Period[id*="-roll-"][id*="-ad-"]

2. An optional selector that must have a match in the document
   for the pruning to occur. No selector means the pruning can
   be performed regardless.

3. An optional URL which must be a match for the pruning to
   occur. If left blank, the pruning can be performed regardless.
2022-09-24 20:49:00 -04:00
Raymond Hill fe21ce5002
Ease load on EasyList server
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2276#issuecomment-1254387437
2022-09-22 05:52:47 -04:00
Imre Kristoffer Eilertsen 3ea8142d9e
Adding "LKA" for Sri Lanka and "NPL" for Nepal to IndianList's title (#3866)
* Added "LKA" for Sri Lanka to IndianList's title

* Added NPL for Nepal too

After seeing that IndianList already supports Nepal languages outright.
2022-09-18 07:17:45 -04:00
Raymond Hill 65a0561072
Slightly change behavior of window-close-if scriplet
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2270

If the argument to the window-close-if scriptlet is a regex, the
match will be against the whole location URL, otherwise the
match will be against the part+query part of the location URL.
2022-09-17 12:46:42 -04:00
Raymond Hill 424797a0b1
Fix/add support URLs for uBO's own lists 2022-09-14 09:29:49 -04:00
Raymond Hill 78fccadaf2
Fix bad alias
Related feedback:
- https://github.com/DandelionSprout/adfilt/issues/63#issuecomment-1214131551
2022-08-13 09:09:36 -04:00
Raymond Hill ac0cdf2d56
Update URL of new RUAdList location
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2193
2022-08-01 17:53:02 -04:00
Raymond Hill cb65b2a122
Update URLs for Latvian (LVA-0) list
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2176
2022-07-17 12:59:23 -04:00
Raymond Hill 9d81b7c4d9
Skip testing context when none present in acis scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2154
2022-06-24 13:35:20 -04:00
Raymond Hill dddf353c94
Use hard tab 2022-06-19 11:55:06 -04:00
Raymond Hill 33b839fdd0
Replace Adblock-Iran with PersianBlocker
Related discussion:
- https://github.com/uBlockOrigin/uAssets/discussions/13259
2022-06-05 09:17:41 -04:00
Ming Di Leom 2ce7f84157
fix(curben-filter): curben.gitlab.io migrated to malware-filter.gitlab.io (#3867) 2022-06-03 12:46:10 -04:00
Raymond Hill fd3ff0b395
Fix bad content URL for List-KR
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2129

Fixed as suggested in:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2129#issuecomment-1142168643
2022-06-03 12:31:07 -04:00
Raymond Hill b76d7c6af6
Also dispatch `loadend` event in case of match
Related issue:
- https://github.com/AdguardTeam/Scriptlets/issues/199
2022-05-08 11:22:32 -04:00
Raymond Hill bd1e82418b
Update CDN URLs: gitcdn.xyz/repo => gitcdn.link/cdn 2022-05-02 12:42:20 -04:00
Raymond Hill 792ef1186d
Update content URLs for List-KR 2022-04-25 13:52:11 -04:00
Raymond Hill ed0f7ae3ce
Replace Youslist with List-KR
As per internal discussion with volunteer filter list maintainers.
2022-04-25 12:06:37 -04:00
Raymond Hill 3af9cd2b71
Add CDN URLs to NLD list
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/11204#issuecomment-1104098368
2022-04-20 12:42:49 -04:00
Raymond Hill 09666fd6d2
Update NLD content URL as requested
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/11204#issuecomment-1099192585
2022-04-14 10:29:40 -04:00
Raymond Hill 1091c204b6
Add IndianList as regional list
As discussed with contributors.
2022-04-09 10:08:13 -04:00
Raymond Hill a1788e64bc
Need local URL to enabled-by-default quick-fixes list
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2022
2022-04-06 12:46:17 -04:00
Raymond Hill c955c2b974
Actually, prefer uAssetsCDN over uAssets for mirrors 2022-03-24 14:08:14 -04:00
Raymond Hill 0bfa41ceb9
Update CDN links to gh-pages repo 2022-03-24 12:58:54 -04:00
Raymond Hill 3c52e75863
Set reference list URL to deployed gh-pages 2022-03-23 12:08:28 -04:00
Raymond Hill b932e01910
Deploy assets.json to GitHub/Cloudflare CDNs 2022-03-21 09:20:02 -04:00
Raymond Hill 6a1f87788f
Remove raw.githubusercontent.com as CDN 2022-03-21 08:29:01 -04:00
Raymond Hill f26d69c581
Use dedicated repo for CDN purpose
Having low commit rate ensures build quota of CDNs are
respected.
2022-03-21 08:11:38 -04:00
Raymond Hill 678dd89ca7
Add Cloudflare Pages as CDN provider for uBO's own filter lists 2022-03-20 08:17:17 -04:00
Raymond Hill 53a0d1ec5f
Add ublockorigin.github.io as CDN for uBO's own filter lists 2022-03-18 11:11:44 -04:00
Raymond Hill 4c2bfbe543
Enable quick-fixes by default 2022-03-17 08:04:58 -04:00
Raymond Hill 2dbbe0ff5c
Fine tune update-after values 2022-03-16 14:04:22 -04:00
Raymond Hill a4376e9500
Add "quick fixes" list 2022-03-16 08:10:57 -04:00
Ming Di Leom b4fe22c7b6
fix(assets): remove netlify from urlhaus-filter 2022-03-14 09:33:43 -04:00
Raymond Hill 858fdaced3
Remove MVPS from stock lists due to inactivity
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2032
2022-03-07 07:06:47 -05:00
Raymond Hill 61966254cd
Use EasyDutch as the default filter lists for NLD
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/11204#issuecomment-1012000389
2022-01-15 14:38:10 -05:00
Raymond Hill 2b65f25dfd
Add regional ALB list for Albanian sites
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/11286#issuecomment-1011397836
2022-01-13 08:44:01 -05:00
Raymond Hill 82ad7bd4fb
Remove redundant mirrors 2022-01-11 07:10:55 -05:00
Ming Di Leom 417d6c99f9
fix(curben filters): replace deprecated mirrors
- 8c94ddba40
- 6cb2cbff6e
- e5bb1712c0
2022-01-09 09:30:46 +00:00
Raymond Hill 529edbd314
Remove "ABP X Files" from stock filter lists
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/11204
2022-01-06 08:06:02 -05:00
Raymond Hill 8d7469afcf
Fix typo 2021-12-13 14:28:39 -05:00
Raymond Hill c198b9a748
Add `window.close` scriptlet
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/10323#issuecomment-992312847

AdGuard's rationale:
- https://github.com/AdguardTeam/Scriptlets/issues/158
2021-12-13 08:14:30 -05:00
Raymond Hill 59db565796
Update CDN URLs for pup-filters
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1766#issuecomment-991017061
2021-12-10 09:35:56 -05:00
Edward Brey 95a105da1a
Link to filter descriptions
If you click the Home button for one of the EasyList filter lists in uBlock settings, now you will go to a page that succinctly describes what the filter does. The old links took you to a forum with no clear way to find info on a given filter, especially for a new user.
2021-11-26 06:12:46 -06:00
Raymond Hill ee5ef4e8ab
Update block-lan list location 2021-11-18 12:27:26 -05:00
gwarser 51b00301da
Rename "Block Access to LAN" (#3861)
to avoid fears of blocking local servers or file addresses

https://github.com/gwarser/filter-lists/issues/27
2021-11-16 10:09:34 -05:00
Raymond Hill b3f1f75389
Update twitch scriptlet as suggested
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1789#issuecomment-969416887
2021-11-16 07:22:06 -05:00
Raymond Hill ddd31f3567
Update twitch-videoad.js scriptlet
Related commit:
- aad8946dab

Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1789#issuecomment-962440694
2021-11-14 13:55:34 -05:00
Imre Kristoffer Eilertsen d8fea7f568
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/1742 (#3860) 2021-11-06 12:52:23 -04:00
Raymond Hill 3f47172473
Update Twitch scriptlet
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1789#issuecomment-959831926

Related commit:
- 7233b5fd22
2021-11-04 09:24:31 -04:00
Raymond Hill 9f693c75c7
Remove Spam-404, add curben's Phishing and PUP lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1766
2021-10-16 12:36:32 -04:00
Raymond Hill d7d38449ea
Add official mirrors for Nordic Filters and EasyList Lithuania (issue #1566) (#3859)
* Fix https://github.com/uBlockOrigin/uBlock-issues/issues/1566

* Update assets.json

* Removed two cdnURLs duplicates

As per https://github.com/uBlockOrigin/uBlock-issues/issues/1566#issuecomment-944922005

Co-authored-by: Imre Kristoffer Eilertsen <imreeil42@gmail.com>
2021-10-16 10:50:16 -04:00
pixeltris cc0008df57
Fix broken twitch.tv functionality (#3858)
* Fix broken twitch.tv functionality

Fixes some features of twitch.tv which are broken due to device id change on every gql request.

Related issues:
- https://github.com/pixeltris/TwitchAdSolutions/issues/50
- https://github.com/pixeltris/TwitchAdSolutions/issues/45

* Use strict equality
2021-10-14 10:03:25 -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 0d3a1932e9
Update twitch-videoad scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/5184#issuecomment-938379331

Solution contributed by <https://github.com/pixeltris>:
- 6be4c53130
2021-10-08 07:12:58 -04:00
Raymond Hill c0a43b0d32
Add refresh-defuser scriptlet
To specifically defuse the reloading of a document through
a meta "refresh" tag.

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

As per solution from AdGuard:
- https://www.reddit.com/r/uBlockOrigin/comments/q0frv0/while_reading_a_sports_article_i_was_redirected/hf7wo9v/
2021-10-03 09:46:24 -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 745fbd1c02
Add no-xhr-if scriptlet
As per request from filter list maintainers.
2021-09-11 09:15:39 -04:00
Raymond Hill 5dd91211ae
Catch exceptions thrown Object.defineProperty
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/9883

Related commit:
- a9e6f9c72c
2021-09-01 18:25:20 -04:00
Raymond Hill a9e6f9c72c
Assign value in set-constant regardless of `configurable` property
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1694
2021-08-27 10:48:49 -04:00
Raymond Hill a21ecafbc6
Improve reliability of set-constant scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1694
2021-08-25 10:48:50 -04:00
Raymond Hill 4fe8126c66
Add ability to match against script content of data: URI
Related commit:
- ebc42ae21e
2021-07-18 08:50:57 -04:00
Raymond Hill f07b1475a3
Fix hasty last commit 2021-07-17 14:27:37 -04:00
Raymond Hill ebc42ae21e
Add abort-current-script scriptlet
This scriplet supersedes abort-current-inline-script (acis),
and accepts an optional third argument which is matched
against the `src` property of script resources.

When the third argument is not provided, the scriptlet
behaves essentially the same as `acis`, and because of
this `acis` is now aliased to `abort-current-script`, and
all existing `acis` filters will execute with no change
in behavior.

In the long run, usage of `abort-current-inline-script` or
its alias `acis` should go away and be replaced with
`abort-current-script` or its alias `acs`.
2021-07-17 14:03:50 -04:00
Raymond Hill 0952dd52c6
Add "Block access to LAN" as stock list
Enabling the list did NOT cause measurable difference in
results of built in benchmark.
2021-07-06 10:01:26 -04:00
Raymond Hill c91b4258e9
Put back mistakenly removed newline 2021-07-03 09:23:06 -04:00
Raymond Hill 35d7406214
Add `asap` behavior to `remove-attr` scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/9528
2021-07-03 09:19:24 -04:00
Raymond Hill 2a8c85b132
Add "AdGuard URL Tracking" list as stock lists (under "Privacy") 2021-06-25 07:09:22 -04:00
Raymond Hill 2de24a1184
Add ability to linger for `remove-class` scriptlet
Similar to related change for the `remove-attr` scriptlet:
- 0f330c7359

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/nsroaw/some_elements_isare_not_removed_after_the_cookie/
2021-06-06 08:58:40 -04:00
Hoàng Rio c16f080cc7
Update ABPVN List url to uBO specific support 2021-06-05 11:01:48 +07:00
Raymond Hill ce801b952b
Add empty array, object to set-constant scriptlet 2021-05-28 07:09:30 -04:00
Raymond Hill 07d3c96261
Fix potential exception when casting to string
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/9123#issuecomment-848255120
2021-05-26 07:22:17 -04:00
Raymond Hill 4509df154f
Lower update period of assets.json and add support for CDN urls 2021-05-18 09:21:09 -04:00
Raymond Hill e4b8f2ef2d
Ensure getter/setter are called with proper context
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/9110
2021-05-18 09:01:40 -04:00
Raymond Hill 9e394aa02b
Restore "EasyList Dutch" as the default list for NLD
Breach of trust:
- f73cefaf13
2021-05-18 08:37:33 -04:00
Raymond Hill 55c6f768d4
Fix https://github.com/uBlockOrigin/uAssets/issues/9122 2021-05-18 07:15:00 -04:00
Raymond Hill 7ca831a344
Bring back `cdn.statically.io` as valid CDN for "uBlock filters"
Related commit:
- aa376314b9
2021-05-13 08:49:57 -04:00
Raymond Hill 4d12ae1387
Add new CDN for "uBlock filters"
As per internal discussion.
2021-04-28 14:02:49 -04:00
Raymond Hill aa376314b9
Drop `cdn.statically.io` as CDN for "uBlock filters"
Some sublists fail to load with this CDN, and
uBO fails to properly error out on the whole
list in such case, causing a truncated whole
list to be used in the end.
2021-04-28 13:32:12 -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 1fc3b57ba5
Replace EasyList Dutch with EasyDutch
As per internal discussion with list maintainers.

Also, related discussion:
- 31a6438704
2021-04-21 09:12:47 -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 5a48917b80
Add no-floc scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1553
2021-04-11 07:11:09 -04:00
Raymond Hill d338e4c4b6
Add support for "remove all properties" in json-prune scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1545
2021-04-06 10:12:34 -04:00
Raymond Hill 97619cf8f5
Revert "Use gitcdn.link instead of gitcdn.xyz"
This reverts commit 60b9aa2f38.

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/megq9g/
2021-03-27 12:19:34 -04:00
Raymond Hill 60b9aa2f38
Use gitcdn.link instead of gitcdn.xyz
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1533
2021-03-21 08:17:33 -04:00
Raymond Hill 634724cf29
Add fallback URLs for "IRN: Adblock-Iran"
Main URL is currently failing. Reported internally.
2021-03-20 07:41:24 -04:00
Raymond Hill 4320e9c28b
Removing Fanboy Enhanced Tracking
Too likely to cause breakage. It was originally added without
having been really evaluated. As per feedback, it's too likely
to cause breakage.

The list is seemingly used to evaluate filters, which are moved
to EasyPrivacy once they are deemed valid and useful.
2021-03-06 10:25:36 -05:00
Raymond Hill de1ed2c519
Replace "EasyList China" with "AdGuard Chinese"
As discussed internally with list maintainers:

- EasyList China doesn't leverage uBO's extended
  filter syntax

- EasyList China's home page is no longer available
  to the public

Additionally, "CJX's EasyList Lite" has been removed
from stock lists, as the list hosted on GitHub is no
longer updated, and "AdGuard Chinese" is the official
list to enable to address all filter issues for
Chinese sites.
2021-02-02 08:30:02 -05:00
Raymond Hill 001f5a6500
Add any-delay to timeout/interval boosters
Using `*` as delay argument will match any
delay.

As per internal feedback from filter list
maintainers.
2021-01-23 09:45:44 -05:00
Raymond Hill 5fa873960f
Listen to load events on window, not document
Related feedback:
- 0f330c7359 (r45774155)
2021-01-08 13:11:09 -05:00
Raymond Hill 0f330c7359
Add ability to linger for remove-attr scriplet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1445

A third (optional) argument has been added to `remove-attr`
scriptlet, which can be one or more space-separated tokens
dictating the behavior of the scriptlet:

`stay`: This tells the scriplet to stay and act on DOM
changes, whiĺe the default behavior is to act only once
when the document becomes interactive.

`complete`: This tells the scriplet to start acting only
when the document is complete, i.e. once all secondary
resources have been loaded, while the default is to start
acting when the document is interactive -- which is earlier
than when the document is complete.

Example:

    ...##+js(remove-attr, class, .j-mini-player, stay)
2021-01-08 10:45:35 -05:00
Raymond Hill ab06a01062
Better handle Request argument in no-fetch-if
As per internal feedback.
2020-12-24 08:26:30 -05:00
Raymond Hill b6ed83bc5c
Add logging ability to new scriptlet no-fetch-if
When no-fetch-if scriptlet is used without argument, the
parameters passed to no-fetch-if will be output to the
console, as `uBO: fetch([...list of arguments...])`.
2020-12-11 09:28:29 -05:00
Raymond Hill ba11a70013
Add new scriptlet: no-fetch-if
The new scriptlet allows to defuse calls to fetch() by returning
a promise which always resolve to an empty response.

There is only one argument, which is a space-separated list
of conditions which must be ALL fulfilled in order for the
defusing to take place.

Each condition is a pair of property name and property value
separated by a column. Valid property names are those
documented as valid `init` options:

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch

The URL of the fetch() is a special case and does not have to
be associated with a property name. Example of usage:

  ...##+js(no-fetch-if, method:HEAD)

Which means: defuse the call to fetch() if there is an
explicit option which contains `HEAD`. Another example:

  ...##+js(no-fetch-if, adsbygoogle.js)

Which means: defuse the call to fetch() if the URL contains
`adsbygoogle.js`. Multiple conditions can be provided:

  ...##+js(no-fetch-if, adsbygoogle.js method:HEAD)

If at least one condition does not match, the defusing will
not take place.

The string against which to match can be a literal regular
expression:

  ...##+js(no-fetch-if, /adsbygoogle.js$/ method:/HEAD|POST/)

Additonally, the following deprecated scriplets have been
removed:

- requestAnimationFrame-if.js
- setInterval-defuser.js
- setTimeout-logger.js
2020-12-11 08:29:23 -05:00
Raymond Hill bf7ce857ee
Update URL of HUN filter list
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1364
2020-11-27 11:36:50 -05:00
Raymond Hill 13f92756be
Make json-prune scriptlet also trap Response.json() calls
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/jns1t4/white_screen_skip_ad_on_youtube/gbg4aq8/
2020-11-08 08:45:33 -05:00
Raymond Hill fe2c4a4914
Use `secure.fanboy.co.nz` instead of `fanboy.co.nz`
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/8166
2020-11-06 06:22:34 -05:00
Raymond Hill d037d9dced
Update Fanboy URLs
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/8166
2020-11-06 06:17:37 -05:00
Raymond Hill 5de0ce9757
Improve fix for set-constant conflict
Related commit:
- 2546f39568
2020-10-20 05:23:10 -04:00
Raymond Hill 2546f39568
Avoid trapping already trapped properties
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/156#issuecomment-712249945

When the client code assigned a variable to itself, this
would cause the scriptlet to try to re-trap already
trapped properties.
2020-10-19 12:01:55 -04:00
Raymond Hill a08f33e09d
Prevent only target (leaf) property from being overtaken
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/156#issuecomment-707095193

Related commit:
- 6e010ecc0f
2020-10-12 11:00:30 -04:00
Raymond Hill 6e010ecc0f
Prevent set-constant properties from being overtaken
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/156#issuecomment-707095193

Additionally, while investigating the issue I removed
code which is no longer needed since content scripts
are now injected in `about:blank` frames since 1.29.0.
2020-10-12 10:08:51 -04:00
Raymond Hill 11b9f88b38
Update urlhaus-filter URL
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1285
2020-10-08 07:25:15 -04:00
pixeltris 75c58ec7af
Update for twitch.tv #5184 (#3781) 2020-10-02 12:20:30 -04:00
Raymond Hill 3693755e94
Add fall back URL for manual update of urlhaus-filter
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/j1ehm5/
2020-09-28 16:31:44 -04:00
Raymond Hill 793e2c7896
Further fine tune new `aost` scriptlet 2020-09-23 09:41:00 -04:00
Raymond Hill 365b3f7f83
Changes to abort-on-stack-trace as per road testing
Related commit:
- https://github.com/gorhill/uBlock/commit/b735ac6b6aba
2020-09-23 06:54:44 -04:00
Raymond Hill 1e91fb8733
Fine tune regex used to detect inline script contexts
Related commit:
- b735ac6b6a
2020-09-22 11:18:12 -04:00
Raymond Hill b735ac6b6a
Add abort-on-stack-trace scriptlet
This new scriplet has become necessary as a
countermeasure to new bypass mechanisms by
some websites, as discussed with filter list
maintainers.

Also related discussion:
https://github.com/AdguardTeam/Scriptlets/issues/82

Scriptlet: abort-on-stack-trace

Alias: aost

Argument 1:
  The property to trap in order to launch the
  stack trace matching code, ex. Math.random

Argument 2:
  The string (needle) to match against the stack
  trace. If the empty string, always match. There
  is a special string which can be used to match
  inline script context, <inline-script>.

Argument 3:
Whether to log, and if so how:
  Empty string: do not log
  1: log stack trace for all access to trapped
     property
  2: log stack trace for defused access to trapped
     property
  3: log stack trace for non-defused access to
     trapped property
2020-09-22 09:59:04 -04:00
Raymond Hill 953ba1231f
Object.values() may fail for unknown reasons
Work around this issue by using more reliable
Object.keys().
2020-09-11 08:30:11 -04:00
Raymond Hill 23f08f0274
Add support for blocklist of filter lists
Many filter lists are known to cause serious filtering
issues in uBO and are not meant to be used in uBO.

Unfortunately, unwitting users keep importing these
filter lists and as a result this ends up causing
filtering issues for which the resolution is always
to remove the incompatible filter list.

Example of inconpatible filter lists:
- Reek's Anti-Adblock Killer
- AdBlock Warning Removal List
- ABP anti-circumvention filter list

uBO will use the following resource to know
which filter lists are incompatible:
- https://github.com/uBlockOrigin/uAssets/blob/master/filters/badlists.txt

Incompatible filter lists can still be imported into
uBO, useful for asset-viewing purpose, but their content
will be discarded at compile time.
2020-08-21 11:57:20 -04:00
Raymond Hill 8275690e93
Fix https://github.com/uBlockOrigin/uAssets/issues/5696#issuecomment-675757755 2020-08-20 09:53:11 -04:00
Raymond Hill bf01fc737d
urlhaus blocklist CDNs: remove githack, add github, gitlab 2020-07-20 12:52:41 -04:00
Raymond Hill c33de41660
Support multiple trappers to same property in set-constant
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/156
- https://github.com/uBlockOrigin/uBlock-issues/issues/1162

Take into account that a trapped property may have been
already trapped, and if so honour previous trapper
getter/setter.
2020-07-19 08:16:40 -04:00
Raymond Hill 321eae7417
Remove stray empty line 2020-07-16 16:39:07 -04:00
Raymond Hill 3aed2497a3
Use AdGuard French as in-place replacement of Liste FR
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/379

Related recent discussion:
- 529643bdce
2020-07-16 16:29:24 -04:00
Raymond Hill 975d894419
Stringify argument using implicit rather than explicit conversion
Reported internally by team.

Explicit conversion was causing an exception to be
thrown when the type argument was not supporting
`toString()`, for example when `type` argument was
literal `null`.
2020-07-16 09:55:06 -04:00
Raymond Hill 947651427d
Use tabs instead of whitespaces 2020-07-15 16:06:39 -04:00
Raymond Hill dacf83b5c0
Add cdn.jsdelivr.net mirror for urlhaus blocklist 2020-07-13 15:50:13 -04:00
Raymond Hill d93f32e882
Remove repo.or.cz from list of CDNs for urlhaus blocklist
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1152
2020-07-13 15:34:07 -04:00
Raymond Hill 4197defe6e
Remove reference to no longer used `resources.txt` 2020-07-08 10:51:26 -04:00
Raymond Hill 4c89c16401
Fix cdn.statically.io-based URL for urlhaus lists
Related feedback:
- a13ac92089 (commitcomment-40399574)
2020-07-06 11:06:59 -04:00
Raymond Hill 46e205d61a
Fix incorrect list name for newly added urlhaus list 2020-07-06 09:43:44 -04:00
Raymond Hill a13ac92089
Replace seemingly abandoned malware lists with urlhaus list
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1116
- https://github.com/uBlockOrigin/uBlock-issues/issues/984

It has been found that the two malware lists uBO uses by
default appear to be essentially no longer maintained.

urlhaus list[1] has been identified by the community as
being well maintained and as being actually useful as a
default malware-related list in uBO, since it's being updated
every day from a database of top domains and specific URLs
identified as serving malicious content. Additionally, the
maintainer of urlhaus list has taken steps to increase
compatibility with uBO[2].

The decision has been to replace the current two malware-
related lists with urlhaus list, which will be enabled by
default in uBO -- and this means that list will be part of
uBO's package from now on.

For those who have the two removed malware lists enabled,
these will be moved to the custom lists section -- they
will still be enabled. It is suggested users remove them from
their selection of lists as their usefulness at this point
is questionable.

[1] https://gitlab.com/curben/urlhaus-filter
[2] 859dfd03c6
2020-07-06 09:03:20 -04:00
Raymond Hill 8f3d8cde7a
Add support to compare delay against literal Number.NaN in nossif/nostif
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1136
2020-07-02 11:47:49 -04:00
Raymond Hill f433932d86
Add support for wildcard/array in json-prune
Add support for specially-named properties:

`[]`, to iterate through all elements in an array, in
order to deal more graciously with cases where the
property to remove is an element in an array. An
actual case:

    +js(json-prune, playlist.movies.0.adserver playlist.movies.1.adserver ...)

Can be now converted to:

    +js(json-prune, playlist.movies.[].adserver)

`*`, to iterate through all own properties of an object,
in order to deal with random-named properties. For
example (not an actual case):

    +js(json-prune, playlist.*.adserver)

Where `adserver` would be a property member of an
object which is itself a property of `playlist`, but
which name is unknown or is variable.
2020-06-26 10:03:48 -04:00
Raymond Hill c4d39d3763
Fix cookie removal on subdomains of base domain
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1126
2020-06-24 17:18:14 -04:00
Raymond Hill 89fcdc6a11
Update URL for EasyList Lithuania
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1106
2020-06-10 16:28:31 -04:00
Raymond Hill faffb63234
`easylist.to` server is fixed, revert a79e0c8f40 2020-05-26 08:14:08 -04:00
Raymond Hill a79e0c8f40
Use `secure.fanboy.co.nz/easylist.txt` for the time being
Related discussion:
- https://twitter.com/gorhill/status/1264689513475039232
2020-05-25 07:32:02 -04:00
Raymond Hill 5227013a8e
Add `uBO:` prefix to logged output in some scriptlets
As per request.
2020-04-28 11:19:26 -04:00
Raymond Hill 578594bbd7
Improve logging capabilities of json-prune scriptlet
Specifically:

- Log entries as received by client code
- Prettier and more readable console output
- Ability to only log entries matching a
  specific needle

As per internal discussion at
<https://github.com/uBlockOrigin/uAssets>; limited
logging capabilities of json-prune originally raised
by <https://github.com/gwarser>.
2020-04-28 09:47:03 -04:00
Raymond Hill a733944624
Add statically.io as CDN provider
As of commit time, the provider caches resources
for at most 24 hours.
2020-04-26 09:59:51 -04:00
Raymond Hill d95b27915f
Bring fingerprint2.js scriptlet up to date
Related issue:
- https://github.com/uBlockOrigin/uAssets/pull/4961
2020-04-18 09:45:07 -04:00
Raymond Hill 08be3a0558
Add CDN URLs for "uBlock filters -- Unbreak" 2020-04-16 09:03:29 -04:00
Raymond Hill 1de0e820b8
Replace requestAnimationFrame-if.js with no-requestAnimationFrame-if.js
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/981

To be consistent with no-setTimeout-if.js.

requestAnimationFrame-if.js is deprecated and must no longer be
used, it will be removed in the near future when it's no longer
in use in default filter lists.

no-requestAnimationFrame-if.js is aliased to norafif.js.
2020-04-15 10:06:53 -04:00
Raymond Hill bf2d38ccf3
Add CDN URLS for `ublock-filters`
Related commit:
- 4687c60bf9
2020-04-08 10:12:50 -04:00
Raymond Hill 34a2ef6c42
Remove Disconnect Malvertising from stock filter lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/973

The list appears no longer maintained and has seen mostly
only removed entries over years.
2020-04-05 08:24:05 -04:00
Raymond Hill 81413b4076
Remove hpHosts from stock filter lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/971
2020-04-01 07:41:52 -04:00
Raymond Hill 49d9929191
Add remove-class scriptlet (alias: rc)
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/935

Arguments are similar to that of remove-attr
scriptlet.
2020-03-18 09:44:18 -04:00
Raymond Hill 8b69af0dda
Remove "Adblock Warning Removal​" from stock filter lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/951
​​​​​
2020-03-18 09:02:22 -04:00
Raymond Hill 85cf8f5807
Fix last commit re. set-constant scriptlet
Related commit:
- https://github.com/gorhill/uBlock/commit/40ea9d69d5d0

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

Restore intended behavior with original commit:
- https://github.com/gorhill/uBlock/commit/14ebfbea279c

The purpose of the original change was to be able to
trap properties which values were `null`.
2020-03-16 09:09:48 -04:00
Raymond Hill 40ea9d69d5
Fix regression in set-constant scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/947

`Object.prototype` is not an instance of `Object`, but
yet is still a JS object; thus the solution is to
additionally compare against `typeof`.
2020-03-16 08:47:34 -04:00
Raymond Hill 14ebfbea27
Improve set-constant.js scriptlet
The scriptlet will now still try to trap a specific
property if a segment of the chain is not undefined
while yet not an object either.

For example, this now allows to set a value on
`document.body.onselectstart` when `document.body` has
not been instantiated yet by the browser parser,
whereas this would previously fail because
`document.body` would be `null` while the scriptlet
was testing against `undefined`.
2020-03-07 14:16:54 -05:00
Raymond Hill 8780ef2413
Remove no longer maintained KOR list
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/914
2020-02-28 08:10:42 -05:00
Raymond Hill 034c915f3b
Allow re-entrance in abort-current-inline-script
Related feedback:
- https://github.com/DandelionSprout/adfilt/issues/7#issuecomment-590391877

If a property is already trapped with a getter/setter,
propagate to these after validation succeed.
2020-02-24 13:40:17 -05:00
Saitama 84635ad38d
mvps list secure protocol http => https (#3769) 2020-02-23 06:57:03 -05:00
Raymond Hill 1a8571755e
Harden abort-current-inline-script scriplet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/6929
2020-02-09 10:35:18 -05:00