1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 17:02:27 +02:00
Commit Graph

4274 Commits

Author SHA1 Message Date
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
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
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
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
437889e309
Import translation work from https://crowdin.com/project/ublock 2023-05-20 17:31:01 -04:00
Raymond Hill
ae52ca43c2
Import translation work from https://crowdin.com/project/ublock 2023-05-19 13:06:38 -04:00
Raymond Hill
0442718efd
Render List stats below on mobile 2023-05-17 15:45:31 -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
03a1009b07
As per feedback on https://crowdin.com/project/ublock 2023-05-17 10:27:10 -04:00
Raymond Hill
07845196b7
Import translation work from https://crowdin.com/project/ublock 2023-05-17 10:25:27 -04:00
Raymond Hill
14637923fc
Fix remaining quirks in "Filter lists" pane
Do not sticky unchecked lists in search mode.

Propagate default status of a sublist upward to its parent
entry.
2023-05-17 10:05:19 -04:00
Raymond Hill
d6eacd8cf6
In search-mode, select only search-matched descendants
Context: "Filter lists" pane.
2023-05-17 09:21:14 -04:00
Raymond Hill
d515146d36
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:25:25 -04:00
Raymond Hill
af04821d7a
Rename "Malware domains" section to "Malware, security" 2023-05-16 12:23:41 -04:00
Raymond Hill
d27b3471e1
Import translation work from https://crowdin.com/project/ublock 2023-05-16 12:21:59 -04:00
Raymond Hill
9ea39886b6
Render List stats below on mobile 2023-05-16 12:10:40 -04:00
Raymond Hill
5ba3055bc7
Fix class name 2023-05-14 20:18:32 -04:00
Raymond Hill
5c5ccc78bc
Import translation work from https://crowdin.com/project/ublock 2023-05-14 10:07:36 -04:00
Raymond Hill
0b63a4c281
Minor code review 2023-05-14 10:05:42 -04:00
Raymond Hill
7bc06fec8c
Code maintenance: remove now unused ABP-related code path 2023-05-14 09:41:35 -04:00
Raymond Hill
a3a80e3b3f
Do not bail out when content-disposition is inline
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2656
2023-05-14 09:06:21 -04:00
Raymond Hill
1a9a8aae0c
Fix improperly unselecting imported lists
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/13enzvv/

When assessing which default lists to disable/enable after
updating from 1.48.x to 1.49.x, uBO has to ignore imported
lists, as these do not have a `off` property -- the
non-existence of this property was used to determine whether
a list was default or not. There needs to be an extra test for
whether the list is imported or not.
2023-05-11 11:46:31 -04:00
Raymond Hill
fc7b2898d2
Make list-search i18n aware where possible 2023-05-09 16:56:33 -04:00
Raymond Hill
578fc21bd9
Report injected scriptlets in troubleshooting information
This requires to rewrite portions of scriptlet filtering
code.
2023-05-09 12:44:14 -04:00
Raymond Hill
fd821e3473
Force all dev builds to use assets.dev.json 2023-05-08 08:23:19 -04:00
Raymond Hill
f6839f5a57
Keep reflecting search matches after applying changes 2023-05-08 07:08:45 -04:00
Raymond Hill
9808423845
Bring back list-per-group counts
Regression from:
- cbc0cbadaa
2023-05-07 19:07:21 -04:00
Raymond Hill
56092189d1
Fix rendering issue of row-filter icon in popup panel
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2640
2023-05-07 10:42:30 -04:00
Raymond Hill
88fb6b153d
Add "scriptlet" filter expression to logger
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2636
2023-05-07 09:35:48 -04:00
Raymond Hill
a6b13e6b9c
Fix hostname-detecting regex
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2639
2023-05-07 09:19:39 -04:00
Raymond Hill
bc02358610
Use a different surface color for scriptlets in logger
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2636
2023-05-06 18:56:00 -04:00
Raymond Hill
7f9c4ce45f
Import translation work from https://crowdin.com/project/ublock 2023-05-06 17:26:19 -04:00
Raymond Hill
cbc0cbadaa
Fix bad filter counts 2023-05-06 17:08:55 -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
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
2059f84826
Fine tune CSS in asset viewer for mobile
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2621#issuecomment-1529036289
2023-04-30 11:56:31 -04:00
Raymond Hill
5fd35ffb3c
Properly handle converted procedural filters in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2624
2023-04-29 15:22:40 -04:00
Raymond Hill
536bfb3387
Reminder that typeof null is 'object'
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2619#discussioncomment-5757274
2023-04-28 16:59:14 -04:00
Raymond Hill
c31e087946
Mind small screen size in asset viewer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2621
2023-04-28 16:57:06 -04:00
Raymond Hill
6d81614bd8
Fix and fine tune "Report a filter issue" page
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2619
2023-04-28 08:38:26 -04:00
Raymond Hill
ca2b016ee9
Warn against missing argument in linter 2023-04-28 07:59:50 -04:00
Raymond Hill
2e465d48c0
Improve rendering of troubleshooting info 2023-04-27 19:16:46 -04:00
Raymond Hill
ad969ec153
Import translation work from https://crowdin.com/project/ublock 2023-04-27 08:52:32 -04:00
Raymond Hill
354c060346
Minor HTML/CSS changes 2023-04-27 08:49:45 -04:00
Raymond Hill
8b1b8c4c7f
Fix test in last commit 2023-04-26 20:55:57 -04:00
Raymond Hill
b870c94651
Use in-memory availableFilterLists if populated 2023-04-26 20:52:39 -04:00
Raymond Hill
b8cfa382e8
Move hostname label to top
Related feedback:
- https://twitter.com/gorhill/status/1650912124003139599
2023-04-26 14:01:16 -04:00
Raymond Hill
2f387e8820
Import translation work from https://crowdin.com/project/ublock 2023-04-26 08:08:16 -04:00