Commit Graph

35 Commits

Author SHA1 Message Date
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 8c4249a870
Try to not rely on UA to lookup environment flavor
The environment flavor is used to by uBO to for self-configuration.

For users with spoofed UA at the `about:config` level, this might
cause uBO to misconfigure itself. Avoid UA and strictly rely on
browserInfo() for looking up environment parameters.
2019-02-12 11:11:58 -05:00
Raymond Hill 8be1aed04d
guard against future instances of issue fixed in #3721 2018-05-03 09:55:36 -04:00
Raymond Hill 5386558e68
fix https://www.reddit.com/r/uBlockOrigin/comments/8dkvqn/116_broken_loading_custom_filters_from_my_filters/ 2018-04-21 12:34:54 -04:00
Raymond Hill e2af7c5c55
code review: simplfy devbuild detection using webextFlavor 2018-04-14 06:09:36 -04:00
Raymond Hill 7ca6e8bfb3
code review: not a fan of deep indentation; detect Edge, Safari 2018-04-12 07:29:14 -04:00
Raymond Hill c34326cf4e
code review: further tuning filter list directives 2018-04-11 06:34:13 -04:00
Raymond Hill 93f49a61d7
add pre-processor directives to filter list compiler (https://github.com/AdguardTeam/AdguardBrowserExtension/issues/917) 2018-04-05 07:29:15 -04:00
Raymond Hill bf384e2bca
better evaluate vAPI.webextFlavor 2018-04-04 12:42:01 -04:00
gorhill 4f28301736
import fix to https://github.com/gorhill/uMatrix/issues/840 2017-12-05 08:42:26 -05: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 d6173b5d93
better fix #3057, as suggested 2017-09-26 16:35:06 -04:00
gorhill c74526a895
fix #3057 2017-09-26 16:09:35 -04:00
gorhill 0e078e536d
eliminate validation warning on AMO: avoid innerHTML 2017-08-11 14:26:15 -04:00
gorhill 6fb6b4ed98
fix #2824: use dummy localStorage if none available 2017-07-26 08:11:22 -04:00
gorhill b3d210c866
minor code review 2017-04-03 10:10:27 -04:00
gorhill 68ad90616b
fix #2499 2017-04-01 12:40:02 -04:00
gorhill 8e73fb32b5
fix https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10 2017-04-01 10:00:09 -04:00
gorhill 1b1e982835
minor code review 2017-03-25 09:19:57 -04:00
gorhill 921bdfeba7 minor changes: header stuff 2016-09-10 08:29:18 -04:00
gorhill 43a5ed735b admin storage is accessed only by main context 2015-10-21 13:30:04 -04:00
gorhill 892913d185 this fixes #832 2015-10-21 11:53:03 -04:00
gorhill 631443768f dom inspector: ébauche 2015-06-26 00:08:41 -04:00
gorhill facef0dc05 this fixes many addon validation warnings 2015-05-17 13:02:56 -04:00
gorhill ed88939a63 this fixes #792 2015-03-14 14:12:05 -04:00
Deathamns 2e076f7e4e Remove unnecessary fallback code for downloading 2015-03-12 12:09:45 +01:00
Chris 03797626cf Fix vAPI.download across all platforms 2015-03-11 17:54:32 -06:00
gorhill 60e36c0ffe this helps #993 2015-03-11 19:48:00 -04:00
gorhill 65cb46c845 #685: code review 2015-02-12 12:25:19 -05:00
Deathamns bc7434cf5c Chrome: bypass options_ui 2015-02-12 18:15:07 +01:00
Deathamns b4ea545412 Implement vAPI.insertHTML
The purpose of this API is basically to satisfy AMO reviewers in the
future, since the use of innerHTML with variables (i.e., not plain text) will
be rejected without any questions.

Since this is not a problem for browsers other than Firefox, they will
use simple innerHTML assignment, however safe-parsing could be implemented
for them too.
2015-01-13 07:30:07 +01:00
Deathamns b301ac031e Popup related changes 2015-01-13 07:29:44 +01:00
Deathamns ecdee65fda Add license headers, plus some code styling 2015-01-13 07:29:16 +01:00
Raymond Hill f149b2e340 jshint 2014-11-24 20:20:21 -02:00
Raymond Hill a430e526b6 use "platform" as suggested in #360 2014-11-24 14:49:11 -02:00