Commit Graph

6663 Commits

Author SHA1 Message Date
Raymond Hill 1e40f50eb3
Add benchmark method to cosmetic filtering engine
To measure retrieval of site-specific selectors. From
uBO's own dev console:

    µBlock.cosmeticFilteringEngine.benchmark();
2019-05-12 11:41:47 -04:00
Raymond Hill fbb4950b5d
Make Firefox dev build auto-update 2019-05-11 17:52:39 -04:00
Raymond Hill 8ec0138739
Err... again: new revision for dev build 2019-05-11 17:48:58 -04:00
Raymond Hill 5d62782b3f
New (proper) revision for dev build 2019-05-11 17:46:58 -04:00
Raymond Hill db2e2ce0c9
New revision for dev build 2019-05-11 17:42:08 -04:00
Raymond Hill 57890d60ff
Fix incorrect use of `this` in static method
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/568

Regression from:
- 19ece97b0c
2019-05-11 17:40:55 -04:00
Raymond Hill 8a7e704080
Add support for `nth-ancestor` operator in HTML filtering
Also opportunitisically converted some code to
ES6's `class`.
2019-05-11 13:21:23 -04:00
Raymond Hill d42d86dd12
Make Firefox dev build auto-update 2019-05-11 10:53:03 -04:00
Raymond Hill 915c1f1f3c
Report resources blocked by `csp=` option in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/552
2019-05-11 10:40:34 -04:00
Raymond Hill 12bdd01595
Ensure "Ignore generic cosmetic filters" sticks on Fennec
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/blkudl/

The setting was not sticking at first-install time.
2019-05-11 09:04:13 -04:00
Raymond Hill 93576c096e
New revision for dev build 2019-05-10 18:55:55 -04:00
Raymond Hill 5c85c3ac8b
New revision for stable release 2019-05-10 17:32:44 -04:00
Raymond Hill ac1a323918
Import translation work from https://crowdin.com/project/ublock 2019-05-10 17:26:34 -04:00
Raymond Hill 6f0ec6129a
Make Firefox dev build auto-update 2019-05-06 15:19:23 -04:00
Raymond Hill e59bdb1485
Defuse `fixed` position on `body` element in element zapper
The `fixed` style property on the `body` element will be
defused if an overlay element is removed using the element
zapper.

Related:
- https://www.reddit.com/r/uBlockOrigin/comments/bktxtb/scrolling_doesnt_work/emlscyz
2019-05-06 13:32:55 -04:00
Raymond Hill 26237d6d40
Import translation work from https://crowdin.com/project/ublock 2019-05-06 11:39:41 -04:00
Raymond Hill bacb1e042b
New revision for dev build 2019-05-06 11:38:08 -04:00
Raymond Hill 9dfb570aa8
Use `browser_specific_settings` instead of `applications`
As per MDN's documentation, `applications` is a non-standard
alias for `browser_specific_settings` in `manifest.json`:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings#Browser_compatibility

Best to use the official manifest key.
2019-05-06 11:34:15 -04:00
Raymond Hill 3692bb4ada
Add HNTrieRef.dump() and STrieRef.dump() as dev tool
To be used at the console, as an investigation tool for
development purpose.

Using it to verify the content of the largest
FilterHostnameDict instance, I spotted an all-uppercase
hostname in the HNTrieRef instance:

µBlock.staticNetFilteringEngine.categories.get(0).get(0x10000000).dict.dump();

Thus the changes to static-net-filtering.js are to fix
the erroneous insertion of filters with uppercase
characters. The single instance found was a hostname entry
in Malware Domain List (TRIANGLESERVICESLTD dot COM).
2019-05-06 11:12:39 -04:00
Raymond Hill b654d883df
Revert "Add Energized Blu Go as stock multipurpose list"
I was made awars of license issue:
- https://github.com/AdroitAdorKhan/EnergizedProtection/issues/46

This reverts commit 0991a1138e.
2019-05-02 06:29:40 -04:00
Raymond Hill ca369d315e
Make Firefox dev build auto-update 2019-05-01 20:17:26 -04:00
Raymond Hill 21b19499a7
Nre revision for release candidate 2019-05-01 20:06:31 -04:00
Raymond Hill ce488d9fc8
Import translation work from https://crowdin.com/project/ublock 2019-05-01 20:05:16 -04:00
Raymond Hill 0e4fbefd07
Remove unecessary `null` placeholders FilterOriginHitSet et al.
The `null` placeholder are not necessary, we can just use
default arguments instead, and add the HNTrieContainer
references if and only if they are instanciated.
2019-05-01 18:54:11 -04:00
Raymond Hill a6816a52bb
Make Firefox dev build auto-update 2019-05-01 07:48:41 -04:00
Raymond Hill d295563e90
New revision for release candidate 2019-05-01 07:44:02 -04:00
Raymond Hill b87b242384
Use per-request secret rather than time-based secret
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/550
2019-05-01 07:41:04 -04:00
Raymond Hill 8f01bc7faf
Make Firefox dev build auto-update 2019-05-01 06:42:26 -04:00
Raymond Hill 5563f7fcc2
New revision for dev build 2019-05-01 06:38:23 -04:00
Raymond Hill 99212e3264
Code review: use function arrow properly 2019-05-01 06:35:47 -04:00
Raymond Hill 016625465e
Simplify a bit 9e43852 by using Array.every() 2019-04-30 16:18:40 -04:00
Raymond Hill 0714aceaaf
Simplify secret generation introduced in 9e4385243c 2019-04-30 15:19:10 -04:00
Raymond Hill e23cb71b1a
Make Firefox dev build auto-update 2019-04-30 14:56:26 -04:00
Raymond Hill 854b10eeae
New revision for dev build 2019-04-30 14:50:57 -04:00
Raymond Hill 9e4385243c
Web accessible secrets can be used for at most one second
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/550

Related Chromium issue (I can't access it):
- https://bugs.chromium.org/p/chromium/issues/detail?id=957866

Findings so far: affects browsers based on Chromium 74.
I could not reproduce the issue with either Chromium 73 or
Google Chrome 75.

This commit is a mitigation: to prevent sites from using
uBO's internal WAR secret for tracking purpose. A secret
can be used for at most one second, after which a new secret
is generated.

The original issue related to the implementation of
secret-gated web accessible resources is:
- https://github.com/gorhill/uBlock/issues/2823
2019-04-30 14:36:07 -04:00
Raymond Hill 2cc60fb6e8
Make Firefox dev build auto-update 2019-04-30 10:15:19 -04:00
Raymond Hill 35aea15785
New revision for dev build 2019-04-30 10:10:00 -04:00
Raymond Hill 0991a1138e
Add Energized Blu Go as stock multipurpose list
Link to project page:
https://github.com/AdroitAdorKhan/EnergizedProtection
2019-04-30 09:35:10 -04:00
Raymond Hill 73e2f25e95
Add new cosmetic procedural operator: `:nth-ancestor(n)`
The purpose of this new `:nth-ancestor(n)` operator is to
lookup the nth ancestor relative to the currently selected
node.

It is essentially equivalent to `:xpath(..)`, where
ancestor distance is expressed as a number rather than a
sequence of slash-separated `..`.

The rationale to introduce this new procedural selector
is to have a low overhead way to accomplish ancestor
selection.
2019-04-30 09:02:14 -04:00
Raymond Hill 42bf659695
Revert "Order HNTrie nodes alphabetically to allow for early bailout"
This reverts commit f5f9e05071.
2019-04-30 07:00:52 -04:00
Raymond Hill f5f9e05071
Order HNTrie nodes alphabetically to allow for early bailout
This commit implements the alphabetical ordering of HNTrie
nodes, so as to make it possible to bail out early at
HNTrie.matches() time.

Contrary to what I expected, there is no performance gain
observed to HNTrie.matches() as per benchmarks -- I find
the results perplexing.

Because of this I will revert this commit immediately.
The purpose of this commit is to record the changes so
that I can bring them back to life in the future whenever
I want to investigate further.
2019-04-30 06:47:54 -04:00
Raymond Hill a73024ad7b
Make Firefox dev build auto-update 2019-04-29 18:14:01 -04:00
Raymond Hill 391bf9e44e
New revision for dev build 2019-04-29 18:10:22 -04:00
Raymond Hill adabb56dc9
Do not store impossible to match filters in HNTrie
Consider the two following filters:

    example.com
    www.example.com

This commit make it so that if the first filter is
already present in a given HNTrie, the second filter
will not be stored, since HNTrie will _always_
return the first filter as a match whenever the
hostname to match is example.com or any subdomain
of example.com.

The detection of such pointless filters is
virtually free when adding a hostname to an HNTrie
instance (given how data is stored in the trie), so
in practice no overhead is incurred to detect such
pointless filters.

The ability to ignore impossible to match filters
in HNTrie instances will _especially_ benefit those
using large hosts files.

Examples of how this helps using real configurations:

- Default lists:
  444 filters out of 100,382 were ignored as a result
  of this commit.

- Default lists + "Energized Ultimate Protection":
  283,669 filters out of 903,235 were ignored as a
  result of this commit.

Side note: There was no measurable difference between
the two configurations above in the performance of
the matching algorithm as reported by the built-in
benchmark tool.
2019-04-29 13:15:16 -04:00
Raymond Hill c4f9ae706a
Fix alternate code path introduced in 295f08da97 (oops) 2019-04-28 14:18:09 -04:00
Raymond Hill 295f08da97
Implement code path for when TextDecoder() is not available
The primary purpose is to unbreak
https://github.com/cliqz-oss/adblocker/tree/master/bench/comparison
2019-04-28 14:07:21 -04:00
Raymond Hill a207daee89
Make Firefox dev build auto-update 2019-04-28 11:22:48 -04:00
Raymond Hill 135049ef0b
New revision for dev build 2019-04-28 10:32:55 -04:00
Raymond Hill ac58b8e688
Make token hashes fit within a 32-bit integer
The staticNetFilteringEngine uses token hashes to store/lookup
filters into Map objects.

Before this commit, the tokens were encoded into token hashes
as JS numbers (not exceeding MAX_SAFE_INTEGER) using at most
the 8 first characters of the token.

With this commit, token hashes are now restricted to fit
into 32-bit integers, and are derived from at most the 7 first
characters. This improves filter look-up performance as per
built-in benchmark().
2019-04-28 10:15:15 -04:00
Raymond Hill 510cda0bc5
Support in logger's filter expression picker 2019-04-28 07:23:14 -04:00