Commit Graph

6930 Commits

Author SHA1 Message Date
Raymond Hill 7e8822cfc5
Import translation work from https://crowdin.com/project/ublock 2019-09-10 16:44:14 -04:00
Raymond Hill 1e7e6f86a6
Reuse existing Set/Map when calling scriptletFilteringEngine.retrieve
Reuse permanent instances instead. The trailing `$` is
used to denote these variables are register-like
instances, i.e. their content is valid only for the
duration of the call. (From now on I will use this
convention throughout the code base.)
2019-09-10 13:59:28 -04:00
Raymond Hill a73dd0a9f2
Fix entity-based lookup in html & scriptlet filtering
Entity-based filters where not properly looked-up if
they used subdomains. Example:

- `example.*##^script` => ok

- `www.example.*##^script` => failed on `https://www.example.com/`
2019-09-10 10:51:34 -04:00
Raymond Hill ed94692238
Make Firefox dev build auto-update 2019-09-09 14:24:54 -04:00
Raymond Hill a94f5cc155
New revision for dev build 2019-09-09 14:16:56 -04:00
Raymond Hill 2fd86a66fc
Add json-prune.js scriptlet
The scriptlet will trap calls to JSON.parse, and
if the result of the parsing is an Object, it
will remove specified properties from the result
before returning to the caller.

Usage:

    ##+js(json-prune, arg1, [arg2])

Where:

- arg1: a list of space-separated properties to remove

- arg2: optional, a list of space-separated properties
        which must be all present for the pruning to
        occur

Example:

    ##+js(json-prune, enabled, adpath config)

A property in a list of properties can be a chain
of properties, example: adpath.url.first
2019-09-09 14:06:23 -04:00
Raymond Hill 4792e0e291
Coalesce tab reloads in burst "relax blocking mode" ops
Quickly firing "Relax blocking mode" commands will
cause the tab to reload only once.
2019-09-08 12:52:28 -04:00
Raymond Hill ad0315a4cd
Make Firefox dev build auto-update 2019-09-07 12:26:11 -04:00
Raymond Hill b74b8821d6
New revision for dev build 2019-09-07 09:31:25 -04:00
Raymond Hill df276a664d
New revision for dev build 2019-09-07 08:33:15 -04:00
Raymond Hill 3eeaba45d9
Cherry-picked ac7825c789 2019-09-07 08:31:32 -04:00
Raymond Hill a488e1f053
Make Firefox dev build auto-update 2019-09-06 13:07:40 -04:00
Raymond Hill c796561742
New revision for dev build 2019-09-06 13:04:45 -04:00
Raymond Hill c8c2e11d09
Prevent reload if updated version is higher than current
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/717

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/717#issuecomment-528921730
2019-09-06 13:03:06 -04:00
Raymond Hill c55288281c
Make Firefox dev build auto-update 2019-09-06 11:51:52 -04:00
Raymond Hill 8f319e3ceb
Import translation work from https://crowdin.com/project/ublock 2019-09-06 11:48:01 -04:00
Raymond Hill 596619b260
New revision for dev build 2019-09-06 11:45:19 -04:00
Raymond Hill bcf5ac1fee
Add advanced setting to control logger popup type
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/663

The advanced setting `loggerPopupType` has been added, to
control the type of window to be used when the logger is
launched as a separate window.

The default value is `popup`, it can be changed to any of
the values documented at:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/CreateType
2019-09-06 11:41:07 -04:00
Raymond Hill 5688888ec1
Remove pointless local scoping 2019-09-06 10:38:17 -04:00
Raymond Hill 35854e4baf
Use more descriptive name for raf-if.js
Related feedback:
- 6831967f5f (commitcomment-34979880)
2019-09-06 09:40:04 -04:00
Raymond Hill 59bdf2b4cc
Prevent uBO from being reloaded mid-session
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/717

Just registering a onUpdateAvailable() listener prevents
the browser from reloading the extension mid-session.

Ref:
- https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onUpdateAvailable
2019-09-04 10:24:24 -04:00
Raymond Hill b5e34f12fc
Make Firefox dev build auto-update 2019-09-02 08:50:35 -04:00
Raymond Hill 7a8ad5afd8
New revision for dev build 2019-09-02 08:46:25 -04:00
Raymond Hill aee6b2d1cb
Fix regression in filter compilation in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/715

Regression from fix to issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/710
2019-09-02 08:43:49 -04:00
Raymond Hill b488334d61
Make Firefox dev build auto-update 2019-09-01 13:14:18 -04:00
Raymond Hill c231bb8694
New revision for dev build 2019-09-01 13:00:18 -04:00
Raymond Hill ca9b29c7ec
Distinguish between priviledge and unprivileged messages
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/710

Messages from unprivileged ports (i.e. from content scripts)
are no longer relayed to message handlers which are to be
strictly used to execute privileged code.

The last remaining case of unprivileged messages which
should be converted into a privileged ones will be taken
care of when the following issue is fixed:
- https://github.com/gorhill/uBlock/issues/3497
2019-09-01 12:43:12 -04:00
Raymond Hill ac56aabd7c
New revision for stable release 2019-08-30 09:58:38 -04:00
Raymond Hill ed2fc4a7bb
Import translation work from https://crowdin.com/project/ublock 2019-08-30 09:29:11 -04:00
Raymond Hill 9f6e369cd2
Make Firefox dev build auto-update 2019-08-25 09:46:03 -04:00
Raymond Hill 883aad50b1
New revision for dev build 2019-08-25 09:42:14 -04:00
Raymond Hill e3043fadc7
Fix console logging ability in setTimeout-if
Regression from e0fd9750d4
2019-08-25 09:38:08 -04:00
Raymond Hill 14e60f5e2d
Make Firefox dev build auto-update 2019-08-25 09:15:48 -04:00
Raymond Hill 254a356079
New revision for dev build 2019-08-25 09:11:25 -04:00
Raymond Hill 1d805fb9da
Add support for `!#if false` in list directive processor
To more easily comment out blocks of filters.
2019-08-25 09:08:41 -04:00
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