Commit Graph

6482 Commits

Author SHA1 Message Date
Raymond Hill 43ecffc295
Fix overzealous strict blocking (regression)
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/536

Regression from:
- 3f3a1543ea (diff-522a16ddeed280252d7c3a351261b441R2767)
2019-04-21 09:17:31 -04:00
Raymond Hill cb18ec54f0
Make Firefox dev build auto-update 2019-04-21 08:04:17 -04:00
Raymond Hill 918116af52
New revision for dev build 2019-04-21 08:00:50 -04:00
Raymond Hill f10b100379
Fix the handling of pseudoclass-based generic cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/464

Regression from:
261ef8c510?diff=unified#diff-3b15596213ed9ba37fb5b8bb1402a6c2R599

Pseudoclass-based generic cosmetic filters were improperly seen
as invalid following the regression.
2019-04-21 07:49:44 -04:00
Raymond Hill 59f4fd1f43
Make Firefox dev build auto-update 2019-04-21 06:20:55 -04:00
Raymond Hill fae91c7c55
New revision for dev build 2019-04-21 06:15:13 -04:00
Raymond Hill 7735b35e21
Fix uncaught rejected promise in assets.fetchText()
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/534

Regression from
a52b07ff6e
2019-04-21 06:12:20 -04:00
Raymond Hill 1c63aa719d
Make Firefox dev build auto-update 2019-04-20 19:29:47 -04:00
Raymond Hill 605adfe689
New revision for dev build 2019-04-20 19:25:34 -04:00
Raymond Hill 97f91f8be9
Small code review of a52b07ff6e 2019-04-20 19:10:34 -04:00
Raymond Hill f0d5205bd7
Discard existing lines when importing from file in "My filters"
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/519
2019-04-20 18:57:16 -04:00
Raymond Hill 1de75ced5c
Make Firefox dev build auto-update 2019-04-20 17:53:36 -04:00
Raymond Hill ca7745697a
New revision for dev build 2019-04-20 17:33:48 -04:00
Raymond Hill 537271f26b
Fix how `*$`, `|https://`, `http://` filters are reported in logger
This was a regression introduced in
3f3a1543ea

Reported in issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/528#issuecomment-485163348
2019-04-20 17:25:32 -04:00
Raymond Hill a52b07ff6e
Make `userResourcesLocation` able to support multiple URLs
The URLs must be space-separated.

Reminders:
- The additional resources will be updated at the same time
  the built-in resource file is updated
- Purging the cache of 'uBlock filters' will also purge the
  cache of the built-in resource file -- and hence force a
  reload of the user's custom resources if any

Related issues:
- https://github.com/gorhill/uBlock/issues/3307
- https://github.com/uBlockOrigin/uAssets/issues/5184#issuecomment-475875189

Addtionally:
- Opportunitically promisified assets.fetchText()
- Fixed https://github.com/gorhill/uBlock/issues/3586
2019-04-20 17:16:49 -04:00
Raymond Hill d9fe40f1ce
Make Firefox dev build auto-update 2019-04-20 09:36:16 -04:00
Raymond Hill 78dcf5949a
New revision for dev build 2019-04-20 09:33:01 -04:00
Raymond Hill fa83744b58
Use a sequence of base 64 numbers to encode array buffers
The purpose of using a custom base128 encoder is to
convert array buffers into strings, to allow a direct
string-to-array buffer conversion at load time:

  string => array buffer

Whereas a JSON array would require an extra step:

  JSON array as string => JS array => array buffer

Turns out that the current use of a custom base128 encoding
results in a significantly larger selfie storage usage when
converting array buffers into strings.

Speculation: possibly the browser convert the strings to
save into JSON strings internally. Since the custom base128
encoder is likely to cause the resulting string to contain
a lot of unprintable ASCII characters, these will need to
be escaped when converted to JSON -- escaped characters
occupy more space than non-escaped ones.

Using a sequence of base 64 numbers means only printable
will be present in the output string, hence no escaping
necessary. I have observed significant reduction in
storage usage for selfie purpose.
2019-04-20 09:06:54 -04:00
Raymond Hill a0c4183cad
Make Firefox dev build auto-update 2019-04-19 17:15:21 -04:00
Raymond Hill 69cb5d8abd
Import translation work from https://crowdin.com/project/ublock 2019-04-19 17:07:27 -04:00
Raymond Hill b08e6b009f
New revision for dev build 2019-04-19 17:02:04 -04:00
Raymond Hill 3f3a1543ea
Add HNTrie-based filter classes to store origin-only filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/528#issuecomment-484408622

Following STrie-related work in above issue, I noticed that a large
number of filters in EasyList were filters which only had to match
against the document origin. For instance, among just the top 10
most populous buckets, there were four such buckets with over
hundreds of entries each:

- bits: 72, token: "http", 146 entries
- bits: 72, token: "https", 139 entries
- bits: 88, token: "http", 122 entries
- bits: 88, token: "https", 118 entries

These filters in these buckets have to be matched against all
the network requests.

In order to leverage HNTrie for these filters[1], they are now handled
in a special way so as to ensure they all end up in a single HNTrie
(per bucket), which means that instead of scanning hundreds of entries
per URL, there is now a single scan per bucket per URL for these
apply-everywhere filters.

Now, any filter which fulfill ALL the following condition will be
processed in a special manner internally:

- Is of the form `|https://` or `|http://` or `*`; and
- Does have a `domain=` option; and
- Does not have a negated domain in its `domain=` option; and
- Does not have `csp=` option; and
- Does not have a `redirect=` option

If a filter does not fulfill ALL the conditions above, no change
in behavior.

A filter which matches ALL of the above will be processed in a special
manner:

- The `domain=` option will be decomposed so as to create as many
  distinct filter as there is distinct value in the `domain=` option
- This also apply to the `badfilter` version of the filter, which
  means it now become possible to `badfilter` only one of the
  distinct filter without having to `badfilter` all of them.
- The logger will always report these special filters with only a
  single hostname in the `domain=` option.

***

[1] HNTrie is currently WASM-ed on Firefox.
2019-04-19 16:33:46 -04:00
Raymond Hill fd9df4b374
Make Firefox dev build auto-update 2019-04-18 08:35:43 -04:00
Raymond Hill 90cfbd5e24
New revision for dev build 2019-04-18 08:25:06 -04:00
Raymond Hill c9b55d48e3
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/531 2019-04-17 07:41:49 -04:00
Raymond Hill b70302c0fc
Cleanup comments following changes in 34f3cfe5e7 2019-04-16 19:20:56 -04:00
Raymond Hill 34f3cfe5e7
Add filterClassHistogram() method to µBlock.staticNetFilteringEngine
As a development tool for investigation purpose. To use, enter the
following at uBO's dev console:

    µBlock.staticNetFilteringEngine.filterClassHistogram()
2019-04-16 19:01:14 -04:00
Raymond Hill 4940cda154
Categorize `google` as a bad token for map key purpose
In the static network filtering engine, `google` token is too
generic and probably leads to too many false positives, beside
causing too large filter bucket.
2019-04-16 06:52:13 -04:00
Raymond Hill 60858b6719
Fix handling of backslashes in string expressions for `:has-text()` 2019-04-15 18:56:28 -04:00
Raymond Hill a594b3f3d1
Add µBlock.staticNetFilteringEngine.bucketHistogram() as investigative dev tool
Additionally, lower the treshold of trieability to 4 for FilterPlainPrefix1.
2019-04-15 11:45:33 -04:00
Raymond Hill 5b202b9d5c
Make Firefox dev build auto-update 2019-04-14 18:37:10 -04:00
Raymond Hill f47f7c00d8
New revision for dev build 2019-04-14 18:33:35 -04:00
Raymond Hill 53860c3ad2
Forgot to add `lij` re. https://github.com/uBlockOrigin/uBlock-issues/issues/501 2019-04-14 18:30:57 -04:00
Raymond Hill c9c21f9cbf
Add more languages for list selection at install/reset time
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/501

Also, the handling of 3-letter language codes has been fixed.
2019-04-14 18:20:57 -04:00
Raymond Hill 7652808806
Improve handling of srcset-based images in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/517
2019-04-14 17:37:48 -04:00
Raymond Hill b73480b4c5
Update fix for https://github.com/uBlockOrigin/uBlock-issues/issues/468
As suggested by @jspenguin2017:
https://github.com/uBlockOrigin/uBlock-issues/issues/468#issuecomment-482863195
2019-04-14 16:57:09 -04:00
Raymond Hill c229003d31
Performance + code maintenance work on static network filtering engine
Implement a plain string trie container class: STrieContainer.

Make use of STrieContainer where beneficial

  Some filter buckets can grow quite large, and in such case
  coalescing "trieable" filter classes into a single trie reduces
  lookup performance and memory usage.

  For instance, at time of commit, the filter bucket for the
  `ad` keyword contains 919 entries[1].

  Coalescing trieable filters of the same class into a single plain
  string trie reduced the size of the bucket into 50 entries + two
  tries which are scanned only once each whenever the bucket is
  visited.

  [1] Enter the following code at uBO's dev console:
      µBlock.staticNetFilteringEngine.categories.get(0).get(µBlock.urlTokenizer.tokenHashFromString('ad'))

Refactor static network filtering engine code to make use of
ES6's syntactic sugar `class`.

Change first auto-update run from 7 to 5 minutes.
2019-04-14 16:45:20 -04:00
Raymond Hill 92c5f17b78
Improve usefulness of FilterContainer.benchmark()
Add ability to test/record results. This allows to compare against
output after code changes to detect and more accurately report
regressions.
2019-04-14 09:44:24 -04:00
Raymond Hill 813d96175d
Fix https://github.com/uBlockOrigin/uBlock-issues/issues/468 2019-04-13 08:10:55 -04:00
Raymond Hill d2cb0f17ea
Report block count in benchmark()
The block count can be used for testing against regression after
code changes.
2019-04-12 10:19:38 -04:00
Raymond Hill 563f6fddde
Import translation work from https://crowdin.com/project/ublock 2019-04-08 12:36:19 -03:00
Noelle Leigh 0bb7b76338 Fixed wrong method for number of elements in a Map (#3755) 2019-04-06 16:42:24 -03:00
Raymond Hill 1cd781796e
Make Firefox dev build auto-update 2019-04-03 13:39:27 -03:00
Raymond Hill ecc2274fec
New revision for dev build 2019-04-03 13:21:43 -03:00
Raymond Hill 1a7a3298e2
Be prepared to deal with failure to read user settings
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/507
2019-04-03 13:18:47 -03:00
Raymond Hill 48ac4b21c6
Make Firefox dev build auto-update 2019-04-03 10:57:38 -03:00
Raymond Hill 24dced810f
New revision for dev build 2019-04-03 10:45:41 -03:00
Raymond Hill 7bf83fad5e
New revision for stable release 2019-04-03 00:20:26 -03:00
Raymond Hill f47ad8366e
Fix https://github.com/NanoAdblocker/NanoCore/issues/257 2019-04-03 00:18:16 -03:00
Raymond Hill d505adfa38
Upgrade CodeMirror to 5.45 2019-03-31 00:31:29 -03:00