Commit graph

4834 commits

Author SHA1 Message Date
Raymond Hill
60ed584fc1
Import translation work from https://crowdin.com/project/ublock 2025-01-15 10:06:48 -05:00
Raymond Hill
ab0f4ba0d4
[mv3] Fix conversion of filters with important option
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/266
2025-01-10 10:25:15 -05:00
Raymond Hill
f8975e3a6a
Better integrate latest eslint version 2025-01-10 10:25:15 -05:00
Fanboynz
4b12247da1
Add decline value to cookie.js (#3933) 2025-01-10 09:21:19 -05:00
Raymond Hill
2266473336
Fix regression in trusted-replace-argument scritplet
Related feedback:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/859#discussioncomment-11751928

Regression from:
adced29b5b
2025-01-06 20:04:22 -05:00
Raymond Hill
b617926c1c
Improve abort-on-stack-trace scriptlet
Related feedback:
https://github.com/uBlockOrigin/uAssets/issues/26704#issuecomment-2569381462
2025-01-04 20:29:19 -05:00
Raymond Hill
551c6bc6eb
Improve href-sanitizer scriptlet
Related issue:
https://github.com/uBlockOrigin/uAssets/issues/26709#issuecomment-2569993803
2025-01-04 20:23:53 -05:00
Raymond Hill
7c530198c8
Import translation work from https://crowdin.com/project/ublock 2025-01-01 08:20:45 -05:00
Fanboynz
62178de756
Add granted and done cookie values (#3932) 2024-12-30 08:27:50 -05:00
Raymond Hill
61922da24b
[mv3] Extend strict-blocking coverage; improve URL-skip behavior
This extends coverage of strict-blocking to pattern-based filters
with `doc` filter option.

When proceeding with a URL-skip URL present, no temporary bypass
will be created when the "Don't warn me again about this site" is
left unchecked. The idea is to avoid the intermediate redirects
if we navigate again on the same strict-blocked site, while a
temporary bypass would prevent this.

uBO's "Badware risks" list has been spinned off as its own list.
The idea is that should a site be strict-blocked from that list,
we would want to know the strict-block is due to the
"Badware risks" list.
2024-12-29 16:38:56 -05:00
Raymond Hill
c92a518218
Fix deserialization of ArrayBuffer shared by multiple TypedArrays
Deserialization failed to restore proper ArrayBuffer when used by
multiple TypedArrays.

This didn't affect uBO since this specific code path was never
taken.
2024-12-26 19:14:20 -05:00
Raymond Hill
cb6c11ab6f
Improve trusted-suppress-native-method scriptlet
As per AdGuard's documentation `/.../` is a valid matcher, to
match a string argument against a regex pattern.
2024-12-26 08:10:13 -05:00
Raymond Hill
42638f0e44
Fix regression in href-sanitizer scriptlet
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2531#issuecomment-2561968581

Regression from:
https://github.com/gorhill/uBlock/commit/9bf8d53ebe
2024-12-25 14:26:00 -05:00
Raymond Hill
a7aa755f18
Improve urlskip= filter option
New step: `#`, to extract the hash part of a URL.

Example, URL:
https://example.com/#aHR0cHM6Ly9naXRodWIuY29tL3VCbG9ja09yaWdpbi8=

Filter:
||example.com^$urlskip=# -base64

As a result, navigate to https://github.com/uBlockOrigin/
2024-12-24 08:59:28 -05:00
Raymond Hill
fd481a37bf
Import translation work from https://crowdin.com/project/ublock 2024-12-22 10:36:47 -05:00
Raymond Hill
7494eaf621
Improve parse-properties-to-match scriptlet helper
Related issue:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/831#discussioncomment-11637436

If the property name contains unexpected characters, assume that
the `:` is not a separator.
2024-12-21 11:27:03 -05:00
Raymond Hill
a17a8ac04b
Import translation work from https://crowdin.com/project/ublock 2024-12-20 14:28:23 -05:00
Raymond Hill
9bf8d53ebe
Improve href-sanitizer scriptlet
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3487

Add support for `urlskip=` syntax by internally reusing `urlskip=`
code.
2024-12-20 10:12:33 -05:00
Fanboynz
791a2b08e1
Add all/none in set-local/cookie (#3928)
* Add all/none in set-local/cookie

* Add functional cookie value
2024-12-16 08:26:36 -05:00
Raymond Hill
9fbc23abfc
Import translation work from https://crowdin.com/project/ublock 2024-12-15 15:38:40 -05:00
Raymond Hill
9c75814525
Use code quotes for filters in logger export feature 2024-12-14 09:03:32 -05:00
Raymond Hill
8ba71f09d7
Improve quote usage in filter options and scriptlets
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-2540436382

Using quotes in filter option values is meant to remove ambiguity
when the value contains special characters. This was not working when
the value started with `$`. For example, fixes usage of quotes in:

  $removeparam='$deep_link'

Also, fixed logger output for scriptlets using empty parameters
in quotes.
2024-12-13 10:54:01 -05:00
Raymond Hill
9b2cf0169a
Improve trusted-suppress-native-method scriptlet
Add ability to log stack trace when verbose mode is enabled.
2024-12-12 10:18:42 -05:00
Raymond Hill
7ed3470844
Improve trusted-suppress-native-method scriptlet
Add support for the `stack` parameter.
2024-12-11 08:47:10 -05:00
Raymond Hill
2ccb01973e
Fix regression in set-constant scriptlet
Regression from 3417fe3d5d
2024-12-09 08:22:21 -05:00
Raymond Hill
7daa45e49f
Revert "Fix regression in set-constantscriptlet"
This reverts commit b7441bb9c0.
2024-12-09 08:19:43 -05:00
Raymond Hill
b7441bb9c0
Fix regression in set-constantscriptlet
Regression from https://github.com/gorhill/uBlock/commit/3417fe3d5d
2024-12-09 08:05:47 -05:00
Raymond Hill
6c6ac6c7a7
Import translation work from https://crowdin.com/project/ublock 2024-12-08 16:58:23 -05:00
Raymond Hill
56ba93700c
[mv3] Ensure no generic cosmetic filters end up in specific realm
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/254

Cosmetic filters with only negated hostnames would end up being
classified as specific, while in reality the filter is generic, with
specific exceptions.

This commit fixes the improper classification. Enforcing specific
exception filters in the generic realm is still an issue to
address.
2024-12-08 08:37:29 -05:00
Raymond Hill
4ed97bb513
Update JSDoc documenation 2024-12-06 12:04:21 -05:00
Raymond Hill
3417fe3d5d
Improve trusted-replace-argument scriptlet
As discussed with filter list maintainers.
2024-12-06 11:53:42 -05:00
Raymond Hill
36db7f8327
Block media elements unconditionally when max size is set to 0
Related feedback:
https://old.reddit.com/r/uBlockOrigin/comments/1h7x9nj/
2024-12-06 10:15:42 -05:00
Raymond Hill
38390bab9c
[mv3] Add urlskip support for strict-blocked page + extra info
Add information about which ruleset caused a page to be strict-
blocked.

Whenever possible, add ability to URL-skip an incoming redirect
in a strict-blocked page.

Add new default list: "30-day Phishing Domain List"
2024-12-05 12:56:25 -05:00
Raymond Hill
07484ceed1
Import translation work from https://crowdin.com/project/ublock 2024-12-05 09:10:46 -05:00
Raymond Hill
a86e802afc
Add advanced setting noScriptingCSP
Related discussion:
https://github.com/uBlockOrigin/uBlock-issues/issues/2642#issuecomment-2520096503

Specify which CSP directive to inject when no-scripting switch is
toggled on. If this hidden setting is changed, uBO will not try
to spoof `noscript` elements.

For internal use at the moment, not to be documented.
2024-12-05 09:04:31 -05:00
Raymond Hill
ea1b1abaee
Import translation work from https://crowdin.com/project/ublock 2024-12-04 19:43:40 -05:00
Raymond Hill
076e9fa73e
Visually separate scriptlet parameters in active line
This makes it easier to see how parameters are parsed internally,
in order to make it easier to distinguish commas as separator and
literal commas meant to be part of a parameter.

Related discussion:
https://github.com/uBlockOrigin/uBlock-discussions/discussions/865#discussioncomment-11461980
2024-12-04 10:48:55 -05:00
Raymond Hill
aa05cb32c6
[mv3] Implement strict blocking
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/214

This implements basic functionality for strict blocking, i.e. the
ability to block navigation to undesirable websites. This is a
first implementation, which converts only filters that are plain
hostnames.

Unlike with uBO, it is not possible to know from which ruleset a
blocking rule originates. Nonetheless, users will have to make a
choice as to whether navigation should proceed or not.

A setting has been added to the dashboard to wholly enable/disable
strict blocking. It is enabled by default.

Potential future improvements, pending investigation on feasability
in an MV3 framework:
- Extend coverage to explicit `document` filters
- Leverage and use `urlskip=` filters in the blocking page in order
  to proceed while bypassing unwanted redirects.
2024-12-03 16:41:34 -05:00
Raymond Hill
d7df6cda4a
Import translation work from https://crowdin.com/project/ublock 2024-12-01 19:46:29 -05:00
Raymond Hill
b1a00145bd
Mitigate potentially delayed execution of scriptlets in Firefox
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3452

Use blob-based injection only when direct injection fails because
of a page's CSP. This is a mitigation until a better approach is
devised.

Such future better approach to investigate:

- Use `MAIN` world injection supported by contentScript.register()
  since Firefox 128
- Investigate registering script to inject ahead of time thru
  some heuristic
2024-11-29 10:13:39 -05:00
Raymond Hill
3b7fa79a68
Improve prevent-setTimeout/prevent-setInterval scriptlet
Add support for range for the `delay` paramater:

---

@param [delay]
A value to match against the delay. Can be a single value for exact match,
or a range:
- `min-max`: matches if delay >= min and delay <= max
- `min-`: matches if delay >= min
- `-max`: matches if delay <= max
No delay means to match any delay value.
Prepend with `!` to reverse the match condition.

---

As discussed with filter list maintainers.
2024-11-28 11:47:28 -05:00
Raymond Hill
4d525f1a55
Move assets/resources into src/js/ 2024-11-27 16:47:11 -05:00
Raymond Hill
adced29b5b
Improve trusted-replace-argument scriptlet
As discussed with filter list maintainers, added ability to
partially replace an argument using the `repl:` prefix. Updated
documentation:

---

@scriptlet trusted-replace-argument.js

@description
Replace an argument passed to a method. Requires a trusted source.

@param propChain
The property chain to the function which argument must be replaced when
called.

@param argposRaw
The zero-based position of the argument in the argument list. Use a negative
number for a position relative to the last argument.

@param argraw
The replacement value, validated using the same heuristic as with the
`set-constant.js` scriptlet.
If the replacement value matches `json:...`, the value will be the
json-parsed string after `json:`.
If the replacement value matches `repl:/.../.../`, the target argument will
be replaced according the regex-replacement directive following `repl:`

@param [, condition, pattern]
Optional. The replacement will occur only when pattern matches the target
argument.

---

Aditionally, more scriptlets moved into their own files.
2024-11-27 15:53:50 -05:00
Raymond Hill
50ddedb992
Import translation work from https://crowdin.com/project/ublock 2024-11-24 10:24:08 -05:00
Raymond Hill
4a8efe1ed8
Replace all instances, not just the first one 2024-11-20 08:07:52 -05:00
Raymond Hill
bcc058eba7
Add -safebase64 directive in urlskip=
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3206#issuecomment-2487392846
2024-11-20 07:53:52 -05:00
Raymond Hill
3aac2a7c97
Import translation work from https://crowdin.com/project/ublock 2024-11-19 13:44:25 -05:00
Raymond Hill
77ed83ff2f
Improve urlskip= filter option
Automatically upgrade `http:` to `https:` in the resulting URL.

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/3206#issuecomment-2480930555
2024-11-18 14:19:21 -05:00
Raymond Hill
f9ce06977d
[mv3] Fix removeparam potentially causing invalid DNR rules 2024-11-18 14:05:19 -05:00
Raymond Hill
c95b08d760
Import translation work from https://crowdin.com/project/ublock 2024-11-18 10:24:08 -05:00