uBlock/src
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
..
_locales Import translation work from https://crowdin.com/project/ublock 2023-05-20 17:31:01 -04:00
css Fix sorting of lists in "Filter lists" pane 2023-05-21 09:42:30 -04:00
img Patch Unicode country flags with image-based flags 2023-05-20 21:35:52 -04:00
js Add trusted-source support for privileged scriptlets 2023-05-21 14:16:56 -04:00
lib Add source code viewer (from logger) 2023-03-01 11:04:40 -05:00
web_accessible_resources Fix cloud storage widget not showing (regression) 2023-04-10 10:03:51 -04:00
1p-filters.html Convert remaining vAPI.setTimeout to vAPI.defer 2023-04-14 10:26:45 -04:00
3p-filters.html Add support for sublists in "Filter lists" pane 2023-05-06 12:50:25 -04:00
about.html Patch Unicode country flags with image-based flags 2023-05-20 21:35:52 -04:00
advanced-settings.html Fix cloud storage widget not showing (regression) 2023-04-10 10:03:51 -04:00
asset-viewer.html Convert remaining vAPI.setTimeout to vAPI.defer 2023-04-14 10:26:45 -04:00
background.html [mv3] Add ability to enable/disable filter lists 2022-09-13 17:44:24 -04:00
cloud-ui.html Work toward bringing dark theme closer to a stable release 2022-01-30 18:35:26 -05:00
code-viewer.html Convert remaining vAPI.setTimeout to vAPI.defer 2023-04-14 10:26:45 -04:00
dashboard.html Prevent dashboard from loading at browser launch until ready 2023-03-16 09:17:36 -04:00
devtools.html Convert remaining vAPI.setTimeout to vAPI.defer 2023-04-14 10:26:45 -04:00
document-blocked.html Fix cloud storage widget not showing (regression) 2023-04-10 10:03:51 -04:00
dyna-rules.html Fix cloud storage widget not showing (regression) 2023-04-10 10:03:51 -04:00
logger-ui.html Add "scriptlet" filter expression to logger 2023-05-07 09:35:48 -04:00
no-dashboard.html Code maintenance: replace uDom.js with dom.js 2022-11-12 09:51:22 -05:00
popup-fenix.html Minor HTML/CSS changes 2023-04-27 08:49:45 -04:00
settings.html Fix cloud storage widget not showing (regression) 2023-04-10 10:03:51 -04:00
support.html Fix and fine tune "Report a filter issue" page 2023-04-28 08:38:26 -04:00
whitelist.html Convert remaining vAPI.setTimeout to vAPI.defer 2023-04-14 10:26:45 -04:00