1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-01 08:39:37 +02:00
Commit Graph

6895 Commits

Author SHA1 Message Date
Raymond Hill
e0fd9750d4
Further fix new setTimeout-if/setInterval-if scriptlets
Addtionally, a dedicated test page has been added:

https://gorhill.github.io/uBlock/tests/scriptlet-injection-filters-1.html
2019-08-25 09:03:24 -04:00
Raymond Hill
a7c852ca5d
Make Firefox dev build auto-update 2019-08-24 14:00:44 -04:00
Raymond Hill
4fbbbe2bb7
New revision for dev build 2019-08-24 13:57:55 -04:00
Raymond Hill
e0f0aedad6
Ability to negate delay in new setTimeout-if scriptlet
This also apply to setInterval-if. Thus to defuse
calls to setTimeout(fn, 1000), the filter could be:

    ##+js(stif, , !1000)

Meaning "allow setTimeout if the delay is not 1000".
2019-08-24 13:54:31 -04:00
Raymond Hill
e0b8cf24d1
Clear internal cache when loading redirect rules
Related commit:
- 3e5c9e00ab

This fix a regression: newly added redirect rules
could end up not being taken into account unless
uBO was restarted.
2019-08-24 13:48:50 -04:00
Raymond Hill
4a60810389
Make Firefox dev build auto-update 2019-08-23 11:38:56 -04:00
Raymond Hill
dee52eef47
Import translation work from https://crowdin.com/project/ublock 2019-08-23 11:35:50 -04:00
Raymond Hill
af0c37b59e
New revision for dev build 2019-08-23 11:34:05 -04:00
Raymond Hill
9f7e385a5c
Code review fix re. max string length in bidi-trie
Related commit:
- fb4e94f92c

A bidi-trie can't store strings longer than 255 characters
because the string segment lengths are encoded into a single
byte. This commit ensures only strings smaller than
256 characters are stored in the bidi-tries.
2019-08-23 11:30:10 -04:00
Raymond Hill
432aed493e
Make Firefox dev build auto-update 2019-08-22 17:26:48 -04:00
Raymond Hill
0450a1b892
New revision for dev build 2019-08-22 17:21:42 -04:00
Raymond Hill
fb4e94f92c
Fix spurious 256-char limit for filters stored in bidi-trie
Plain filters can be any length, while the bidi-trie was
assuming max length of 256. The origin of this error
is from when the bidi-trie code was originally imported
from the hntrie code as start to develop bidi-trie.

The erroneous code could cause issue when the following
conditions were met:
- Plain filter longer than 256 characters
- Free space in bidi-trie's character buffer was less
  than 256 bytes

Likely a rare occurrence, but some filter lists do contains
long plain filters, for example:

    https://gitlab.com/curben/urlhaus-filter/raw/master/urlhaus-filter.txt

Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/cs1y26/
2019-08-22 17:11:49 -04:00
Raymond Hill
87cb3502b2
Make Firefox dev build auto-update 2019-08-22 09:57:22 -04:00
Raymond Hill
eab745a254
New revision for dev build 2019-08-22 09:42:30 -04:00
Raymond Hill
c5536577b2
Add two scriptlets: setTimeout-if and setInterval-if
Usage is similar to that of raf-if introduced in
commit 6831967f5f.

The two new scriptlets are meant to replace:
- setTimeout-defuser
- setTimeout-logger
- setInterval-defuser
- setInterval-logger

setTimeout-logger and setInterval-logger have been
removed, since they are not to be used in production.

To log setTimeout and setInterval usage, respectively
(using aliases):
- ##+js(stif)
- ##+js(siif)

To defuse setTimeout unconditionally:
- ##+js(stif, !)

Usage of setTimeout-defuser and setInterval-defuser
is deprecated and will be removed in some future when
they are no longer in use.

Keep in mind that the new scriptlets function on a
whitelist basis, whereas the deprecated ones
function on a blacklist basis. Prefixing the needle
with `!` allow to use the new scriptlets on a
blacklist basis.
2019-08-22 09:32:46 -04:00
Raymond Hill
708e5004e8
Fix badly computed output size in µBlock.base64.encode()
This bug could cause losing 1 to 3 bytes of information
dropped from various internal buffers at encoding time.

Possibly related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/cs1y26/
2019-08-22 09:17:19 -04:00
Raymond Hill
29745481e6
Make Firefox dev build auto-update 2019-08-21 10:49:30 -04:00
Raymond Hill
14e3b2ad16
New revision for dev build 2019-08-21 10:38:58 -04:00
Raymond Hill
252ce421c9
Fix raf-if scriptlet: bad Proxy target
It was working nonetheless, which made me
miss the mistake.
2019-08-21 10:36:08 -04:00
Raymond Hill
e735cd6a3f
Import translation work from https://crowdin.com/project/ublock 2019-08-21 10:33:16 -04:00
Raymond Hill
6831967f5f
Add new scriptlet to defuse calls to requestAnimationFrame
Scriptlet name: `raf-if.js`

Usage: `example.com##+js(raf-if, !/(\d+){4}/)`

Argument: one single argument, which is the "needle" to
find in the stringified argument passed to
requestAnimationFrame.

requestAnimationFrame will be defused when:

- The needle is not prefixed with `!` and the needle
  does not match the stringified argument; OR
- The needle is prefixed with `!` and the needle
  matches the stringified argument.

The `raf-if.js` scriptlet will log calls to
requestAnimationFrame to the console when no parameter
is provided, i.e.:

    example.com##+js(raf-if)

Otherwise no logging occurs.
2019-08-21 10:13:23 -04:00
Raymond Hill
95b77c33eb
Make Firefox dev build auto-update 2019-08-19 09:06:46 -04:00
Raymond Hill
0fe88aebb1
New revision for dev build 2019-08-19 09:03:16 -04:00
Raymond Hill
5ad809c07d
Code review color badge code
Related commit:
- 07c950f1e5

Cache [blocking mode, color] pair for fast
lookup in subsequent calls.
2019-08-19 09:00:53 -04:00
Raymond Hill
9a9a43d0f6
Import translation work from https://crowdin.com/project/ublock 2019-08-18 10:47:51 -04:00
Raymond Hill
7c7be6c898
Add "Relax blocking mode" command to Opera manifest 2019-08-18 08:39:45 -04:00
Raymond Hill
07d50c03ab
Make Firefox dev build auto-update 2019-08-17 09:17:18 -04:00
Raymond Hill
32da35f8a1
New revision for dev build 2019-08-17 08:50:05 -04:00
Raymond Hill
bf3c92574e
Add support for special exception filter #@#+js()
The purpose is to wholly disable scriptlet injection
for a given site without having to create exceptions
for all matching scriptlet injection filters.

The following exception filter will cause scriptlet
injection to be wholly disable for `example.com`:

    `example.com#@#+js()`

Or to disable scriptlet injection everywhere:

    `#@#+js()`

The following form is meaningless and will be
ignored:

    `example.com##+js()`
2019-08-17 08:38:48 -04:00
Raymond Hill
1ac016bed7
Make Firefox dev build auto-update 2019-08-16 13:51:27 -04:00
Raymond Hill
d6033b4864
New revision for dev build 2019-08-16 13:48:08 -04:00
Raymond Hill
6c73bd78f4
Fix regression when generating data URI in redirect engine
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/cpxm1v/

Put back erroneously removed code which enable to
generate a `data` URI from already encoded resources.
2019-08-16 13:45:07 -04:00
Raymond Hill
71dae6b30c
Make Firefox dev build auto-update 2019-08-14 11:31:00 -04:00
Raymond Hill
20e123e541
New revision for dev build 2019-08-14 11:08:19 -04:00
Raymond Hill
d67340f14d
Add ability to escape comma in a scriptlet's list of arguments
An instance of `\,` will not be interpreted as an arguments
separator -- thus allowing the use of commas inside
argument values.
2019-08-14 11:02:01 -04:00
Raymond Hill
68ae847ba3
Add support for AdGuard's mp4 filter option
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/701#issuecomment-520884196

The `mp4` filter option will be converted to `redirect=noopmp4-1s`
internally, and `media` type will be assumed.
2019-08-13 12:30:11 -04:00
Raymond Hill
40cdcea5ef
Make Firefox dev build auto-update 2019-08-13 08:58:11 -04:00
Raymond Hill
52925ba2f9
Support disabling advanced setting cacheControlForFirefox1376932
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/229#issuecomment-520810161

Setting `cacheControlForFirefox1376932` to `unset` will
prevent modification of the `Cache-Control` header.
2019-08-13 08:49:37 -04:00
Raymond Hill
970164e78d
New revision for dev build 2019-08-13 08:36:49 -04:00
Raymond Hill
3e5c9e00ab
Add support for AdGuard's empty option
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/701

The filter option `empty` is converted to `redirect=empty`
by uBO internally; however unlike when the `redirect=`
option is used expressly, the `empty` option does not
require a resource type.

When `empty` is used, only network requests which are meant
to return a text response will be redirected to an empty
response body by uBO -- so `empty` will not work for
resources such as images, media, or other binary resources.
2019-08-13 08:16:21 -04:00
Raymond Hill
2c39a1af02
Extend pseudo-elements support byond ::before/::after
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/6069#issuecomment-520254292
2019-08-11 16:32:49 -04:00
Raymond Hill
aa85cddb7b
Make Firefox dev build auto-update 2019-08-11 14:04:49 -04:00
Raymond Hill
9c2054aab0
new revision for dev build 2019-08-11 14:02:13 -04:00
Raymond Hill
ffa6f6c8f9
Import translation work from https://crowdin.com/project/ublock 2019-08-11 14:00:53 -04:00
Raymond Hill
07c950f1e5
Review icon badge color management
Related commit & feedback:
- 7ff750eaf6

The color value for the icon badge is now
"attached" to the blocking profile value.
Additionally, as per feedback, `3p` rules
will be relaxing before master JavaScript
switch rules.
2019-08-11 13:55:39 -04:00
Raymond Hill
d5d643869c
Make Firefox dev build auto-update 2019-08-10 11:18:05 -04:00
Raymond Hill
ce4d0bb15b
New revision for dev build 2019-08-10 11:12:10 -04:00
Raymond Hill
7ff750eaf6
Reflect blocking mode in badge color of toolbar icon
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/cmh910/

Additionally, the `3p` rule has been made distinct from
`3p-script`/`3p-frame` for the purpose of
"Relax blocking mode" command.

The badge color will hint at the current blocking mode.
There are four colors for the four following blocking
modes:
- JavaScript wholly disabled
- All 3rd parties blocked
- 3rd-party scripts and frames blocked
- None of the above

The default badge color will be used when JavaScript is not
wholly disabled and when there are no rules for `3p`,
`3p-script` or `3p-frame`.

A new advanced setting has been added to let the user choose
the badge colors for the various blocking modes,
`blockingProfileColors`. The value *must* be a sequence of
4 valid CSS color values that match 6 hexadecimal digits
prefixed with`#` -- anything else will be ignored.
2019-08-10 10:57:24 -04:00
Raymond Hill
5e1f4d7906
Invalidate browser's memory cache after using element picker
Related reports:
- https://www.reddit.com/r/uBlockOrigin/comments/cj7g7m/
- https://www.reddit.com/r/uBlockOrigin/comments/cnq0bi/

The browser cache will be invalidated only when creating
static network filter through the element picker.

As per @gwarser's arguments in favor of implementing
usage of webRequest.handlerBehaviorChanged():
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/handlerBehaviorChanged
2019-08-09 09:31:20 -04:00
Raymond Hill
aa701484e7
Make Firefox dev build auto-update 2019-08-07 09:58:34 -04:00