1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-06 02:42:33 +01:00
Commit Graph

38 Commits

Author SHA1 Message Date
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
ed7e34fb07
Refactor selfie generation into a more flexible persistence mechanism
The motivation is to address the higher peak memory usage at launch
time with 3rd-gen HNTrie when a selfie was present.

The selfie generation prior to this change was to collect all
filtering data into a single data structure, and then to serialize
that whole structure at once into storage (using JSON.stringify).

However, HNTrie serialization requires that a large UintArray32 be
converted into a plain JS array, which itslef would be indirectly
converted into a JSON string. This was the main reason why peak
memory usage would be higher at launch from selfie, since the JSON
string would need to be wholly unserialized into JS objects, which
themselves would need to be converted into more specialized data
structures (like that Uint32Array one).

The solution to lower peak memory usage at launch is to refactor
selfie generation to allow a more piecemeal approach: each filtering
component is given the ability to serialize itself rather than to be
forced to be embedded in the master selfie. With this approach, the
HNTrie buffer can now serialize to its own storage by converting the
buffer data directly into a string which can be directly sent to
storage. This avoiding expensive intermediate steps such as
converting into a JS array and then to a JSON string.

As part of the refactoring, there was also opportunistic code
upgrade to ES6 and Promise (eventually all of uBO's code will be
proper ES6).

Additionally, the polyfill to bring getBytesInUse() to Firefox has
been revisited to replace the rather expensive previous
implementation with an implementation with virtually no overhead.
2019-02-14 13:33:55 -05:00
Raymond Hill
4da340384a
Update publicSuffixLibrary to latest (WASM-able) version
See https://github.com/gorhill/publicsuffixlist.js
2019-02-10 12:19:05 -05:00
Raymond Hill
9b27a98f90
Fix https://github.com/gorhill/uBlock/issues/3654
Additionally, there has been refactoring work done regarding
filtering context used throughout uBO, motivated by the fix
here.
2018-12-13 12:30:54 -05:00
Raymond Hill
9039874fc9
refactor some webRequest-related code (now that firefox legacy is out of the way) 2018-10-28 10:58:25 -03:00
Raymond Hill
938d54b1f7
remove unused code meant for Firefox/legacy 2018-08-18 07:51:46 -04:00
Raymond Hill
38aabc937a
reorganize cache storage compression; workaround fix for #2812 2018-08-11 10:39:43 -04:00
Raymond Hill
3923520b87
remove no longer needed platform-dependent polyfill.js 2018-04-27 08:36:38 -04:00
Raymond Hill
455bf281f0
fix #3391 2018-01-02 23:06:16 -05:00
Raymond Hill
a9f68fe02f
Fix #3069, and consequently #3374, #3378.
A new filtering class has been created: "static extended filtering".
This new class is an umbrella class for more specialized filtering
engines:
- Cosmetic filtering
- Scriptlet filtering
- HTML filtering

HTML filtering is available only on platforms which support modifying
the response body on the fly, so only Firefox 57+ at the moment.

With the ability to modify the response body, HTML filtering has
been introduced: removing elements from the DOM before the source
data has been parsed by the browser.

A consequence of HTML filtering ability is to bring back script tag
filtering feature.
2017-12-28 13:49:02 -05:00
gorhill
5928996f2a
address #3193 2017-11-02 15:49:11 -04:00
gorhill
bbda2a9086
code review: preemptively address https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9 2017-10-27 14:22:45 -04:00
gorhill
0503f52b1e
remove unused source code 2017-10-23 13:35:11 -04:00
gorhill
a0c595d02d
fix #2950 2017-09-02 06:11:33 -04:00
gorhill
beb7933016
fix #2925 2017-08-29 18:32:00 -04:00
gorhill
39aeaa12a7
new feature: element zapper 2017-05-27 11:51:24 -04:00
Raymond Hill
3b9fd49c50 Assets management refactored (#2314)
* refactoring assets management code

* finalizing refactoring of assets management

* various code review of new assets management code

* fix #2281

* fix #1961

* fix #1293

* fix #1275

* fix update scheduler timing logic

* forward compatibility (to be removed once 1.11+ is widespread)

* more codereview; give admins ability to specify own assets.json

* "assetKey" is more accurate than "path"

* fix group count update when building dom incrementally

* reorganize content (order, added URLs, etc.)

* ability to customize updater through advanced settings

* better spinner icon
2017-01-18 13:17:47 -05:00
gorhill
a7fe367eec refactor where appropriate to make use of ES6 Set/Map (#1070)
At the same time, the following issues were fixed:
- #1954: automatically lookup site-specific scriptlets
- https://github.com/uBlockOrigin/uAssets/issues/23
2016-09-12 10:22:25 -04:00
gorhill
c27dea49da keep file naming consistent 2015-12-15 14:36:27 -05:00
gorhill
ea49484dd3 this fixes #1067 + partially fixes #1070 2015-12-15 10:40:40 -05:00
gorhill
72f5e44ec0 code review 2015-11-29 17:06:58 -05:00
gorhill
2aadc2a969 new redirect engine: this fixes #949 (the video ad part) 2015-11-23 07:52:50 -05:00
gorhill
8d294869fe this fixes #756 2015-09-30 09:33:38 -04:00
gorhill
060a43fe81 this addresses half of #58: find list(s) from which a static network filter originates 2015-06-11 12:12:23 -04:00
gorhill
b94d05d14f minor epicker dialog restyling 2015-05-26 08:43:46 -04:00
gorhill
284b4f62d1 dynamic url filtering 2015-05-21 14:15:17 -04:00
gorhill
361d2ac1a2 dissociate logging infrastructure from page stores 2015-04-23 18:23:03 -04:00
gorhill
67417c5cec cleaning up old stuff 2015-04-10 02:17:12 -04:00
gorhill
f2ff0edfaf this fixes #1013, #1062 (draft) 2015-03-27 13:00:55 -04:00
Chris
30eafed70a More µ to u 2015-03-09 22:00:48 -06:00
gorhill
7a5d09b4a2 this fixes #665 2015-02-04 18:06:31 -05:00
gorhill
084f092c33 re #550: use non-minified external libs 2015-01-30 08:04:52 -05:00
gorhill
0c152b2859 fixed flawed 1st-/3rd-party test 2015-01-08 10:37:19 -05:00
gorhill
1fe7045b92 too many changes for #433: branching so that I can commit and keep working on it 2014-12-28 10:07:43 -05:00
Raymond Hill
2e4c0a2bfe remove depending on vapi-appinfo.js 2014-12-01 14:25:33 -02:00
Deathamns
6d49ef0dac Avoid using Chrome's @@bidi_* type i18n messages
... for the sake of portability.

When including vapi-common.js in an HTML file, then the body element there
will have a "dir" attribute filled with the current locale's direction
(ltr or rtl).

The following languages are considered right-to-left: ar, he, fa, ps, ur.
Everything else is left-to-right.

After the "dir" attribute is set, we can decide in CSS which elements
should have different styling for rtl languages (e.g., body[dir=rtl] #id).
2014-11-09 17:40:40 +01:00
Deathamns
749b6f186d Use a dedicated file for storing extension info
Chrome has getManifest(), Safari doesn't have anything, Firefox has an
asynchronous API...
So, instead of using extension APIs, store the common informations
(extension name, version, homepage url) in a file (vapi-appinfo.js), which
can be included when it's needed (its data will be available at vAPI.app.____).
The file's content is updated each time the extension is being built, so
it shouldn't be modified manually.
2014-11-09 17:39:38 +01:00
Deathamns
5b79bf3536 Work on vendor API abstraction, and near complete Safari support 2014-11-09 17:39:12 +01:00