Commit Graph

11101 Commits

Author SHA1 Message Date
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 bc8bc6a4e6
Make Firefox dev build auto-update 2023-05-24 10:41:25 -04:00
Raymond Hill 7db6e5f053
New revision for dev build 2023-05-24 10:33:36 -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 9878156820
Make Firefox dev build auto-update 2023-05-23 21:56:29 -04:00
Raymond Hill 9134c11cf8
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/2668
Use document.append() only when there are no elements in
the DOM, as a document instance can't have more than one
direct child.
2023-05-23 21:49:42 -04:00
Raymond Hill d5804dce7f
New revision for release candidate 2023-05-23 18:00:26 -04:00
Raymond Hill 879b837669
Fix scriptlet alias 2023-05-23 17:58:20 -04:00
Raymond Hill 21615160a7
Make Firefox dev build auto-update 2023-05-23 17:11:09 -04:00
Raymond Hill d383c2f812
New revision for release candidate 2023-05-23 17:05:09 -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 f07fa40f16
Make Firefox dev build auto-update 2023-05-23 12:15:59 -04:00
Raymond Hill 6f06192982
New revision for dev build 2023-05-23 12:06:52 -04:00
Raymond Hill c622298793
Minor CSS tuning 2023-05-23 12:06:19 -04:00
Raymond Hill 947d45be2f
Include imported lists in request to update
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2582#discussioncomment-5969939
2023-05-23 12:04:47 -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 d74c73e452
Import translation work from https://crowdin.com/project/ublock 2023-05-23 09:28:36 -04:00
Raymond Hill f18071fd26
Flags: w40 => h48, probably better for UHD displays 2023-05-23 09:24:30 -04:00
Raymond Hill 824f8b7ceb
Add comments for reviewers 2023-05-23 09:03:19 -04:00
Raymond Hill e81439019f
Make Firefox dev build auto-update 2023-05-22 20:40:49 -04:00
Raymond Hill 296eabb498
New revision for dev build 2023-05-22 20:30:55 -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 9f465f503a
Make Firefox dev build auto-update 2023-05-22 15:46:25 -04:00
Raymond Hill b8b28a6a05
New revision for dev build 2023-05-22 15:34:48 -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
gorhill 692b0b2334 Update build log file
Files changed:
M	dist/mv3/log.txt
2023-05-22 17:36:47 +00:00
Raymond Hill 568e21accf
Make Firefox dev build auto-update 2023-05-22 10:56:28 -04:00
Raymond Hill 40fbe39058
New revision for dev build 2023-05-22 10:38:40 -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 81144687b4
Make Firefox dev build auto-update 2023-05-21 15:06:08 -04:00
Raymond Hill 8d36cf89c6
New revision for dev build 2023-05-21 14:57:30 -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 2c7d91ba57
Minor change to regex 2023-05-21 09:45:46 -04:00
Raymond Hill e50d6ee6ed
Fix sorting of lists in "Filter lists" pane
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2645#issuecomment-1556090600
2023-05-21 09:42:30 -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 8780eb6ea8
Make Firefox dev build auto-update 2023-05-20 21:46:13 -04:00
Raymond Hill 7c1bb3d997
New revision for dev build 2023-05-20 21:38:53 -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 01ec521075
Make Firefox dev build auto-update 2023-05-20 17:51:25 -04:00
Raymond Hill 34c4d70743
New revision for dev build 2023-05-20 17:31:40 -04:00
Raymond Hill 437889e309
Import translation work from https://crowdin.com/project/ublock 2023-05-20 17:31:01 -04:00
Raymond Hill 56f67631d6
Fix regression in handling mode changes 2023-05-20 17:21:14 -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
gorhill f0fba0d640 Update build log file
Files changed:
M	dist/mv3/log.txt
2023-05-19 19:38:19 +00:00
Raymond Hill eb2d6d1374
Bring scriptlets up to date 2023-05-19 15:36:01 -04:00
gorhill 1d63023263 Update build log file
Files changed:
M	dist/mv3/log.txt
2023-05-19 19:12:01 +00:00
Raymond Hill 13a4f869d2
Fix sticky blocking mode
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/42

Take into account that subdomains inherit the blocking mode
of their parent domain when toggling blocking mode of specific
hostnames.
2023-05-19 15:08:23 -04:00