1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 22:27:12 +02:00
Commit Graph

2529 Commits

Author SHA1 Message Date
Raymond Hill
d66cd1116c
Fix not properly resetting needle buffer in createTrieFromStoredDomainOpt()
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1902

The cached needle didn't match the one stored in the
needle buffer when resetting the cached needle without
resetting the needle buffer.
2021-12-25 07:51:12 -05:00
Raymond Hill
e4a7df3fd9
Improve auto-completion in _"My filters"_ editor 2021-12-19 08:17:06 -05:00
Raymond Hill
e45d851f66
Store domain= option into trie container's character buffer
As the trie is not immediately created, in order to speed up
launch time, the `domain=` option was stored in the filterRefs
array until it was moved to the trie.

This commit instead stores the `domain=` option into the trie
container's character buffer.
2021-12-18 12:53:09 -05:00
Raymond Hill
47680c775d
Limit force-reload at launch to https-based pages
Related commit:
- a0a9497b4a
2021-12-18 12:24:55 -05:00
Raymond Hill
7ca2c8a9a7
Make loadBenchmarkDataset() compatible with more recent requests.json
The format of requests.json used in latest Cliqz benchmark code
has changed from the original one -- this commit makes the
dataset load code also compatible with the new format.

More recent dataset used in Cliqz benchmark code:
- https://github.com/mjethani/scaling-palm-tree

Cliqz benchmark code:
- https://github.com/ghostery/adblocker/tree/master/packages/adblocker-benchmarks
2021-12-18 11:44:01 -05:00
Raymond Hill
7da0ccd55b
Fine tune reporting of CFE internals 2021-12-18 11:35:50 -05:00
Raymond Hill
a0a9497b4a
Partially bring suspendTabsUntilReady out of experimental status
This commit will force-reload active tabs at launch for
environments not supporting suspend network request listeners,
or configured to not suspend network request listeners.
2021-12-18 11:26:50 -05:00
Raymond Hill
edab87b4bc
Fix potentially reporting wrong context in logger for ghide filters
Related discussion:
- https://github.com/uBlockOrigin/uAssets/issues/3100#issuecomment-996750389
2021-12-17 09:47:14 -05:00
Raymond Hill
df56fc55d2
Fine-tune static network filtering engine code
Refactored heuristics to collate set of origin-related
filter units are collated into a hostname trie, and
for better reuse of existing classes.

Generalized pre-test idea for bucket of filters, such
that in addition to origin-related filter units, there is
now a class to collate regex-based pattern-related units
into a new pre-test bucket class, FilterBucketIfRegexHits,
in order to test with a single regex test whether there is
a chance of a hit in the underlying bucket of filters.
Instances of these are rare, but at time of commit I found
this occurs with AdGuard France filter list.

Fine-tuned the "SNFE: Dump" output -- this new ability to
see the internal details of the SNFE has been really key
into finding/fixing issues during refactoring.
2021-12-16 09:12:43 -05:00
Raymond Hill
01f87e979e
Add ability to fold/unfold in devtools page 2021-12-14 09:58:38 -05:00
Raymond Hill
6c5dcb43da
Fix bad copy-paste 2021-12-13 13:13:49 -05:00
Raymond Hill
8887db1e70
Add ability to collapse/expand in uBO's devtools page 2021-12-13 10:47:53 -05:00
Raymond Hill
ba22735fcc
Add ability to dump internal details of cosmetic filtering engine
Related commit:
- 4d482f9133
2021-12-13 08:30:12 -05:00
Raymond Hill
edd11e16fa
Fix not reporting match-case properly in logger
Related feedback:
- 4d482f9133
2021-12-13 07:01:04 -05:00
Raymond Hill
99882cacd0
Truncate support information when too many lists are added
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1852
2021-12-12 11:31:31 -05:00
Raymond Hill
4d482f9133
Store regex filter pattern into bidi-trie buffer
As was done with generic pattern-based filters, the source
string of regex-based filters is now stored into the
bidi-trie (pattern) buffer.

Additionally, added a new "dev tools" page to more
conveniently peer into uBO's internals at run time, without
having to do so from the browser's dev console -- something
which has become more difficult with the use of JS modules.

The new page can be launched from the Support pane through
the "More" button in the troubleshooting section.

The benchmark button in the About pane has been moved to this
new "dev tools" page.

The new "dev tools" page is for development purpose only,
do not open issues about it.
2021-12-12 10:32:49 -05:00
Raymond Hill
3b7a265ee2
Ignore pointless trailling *^ in network filters
There are currently over 160 patterns with such pointless
trailing `*^` in uBO's filter lists, which ended up being
compiled as generic pattern filters (i.e. regex-based
internally), while the trailing `*^` accomplishes nothing
since it will always match the end of a URL ( `^` can
also match the end of URL).

This commit discards pointless trailing `*^` in patterns,
thus allowing most of those filters to be compiled as
plain pattern filters.

The syntax highlighter will reflect that a trailing
`*^` is pointless.
2021-12-11 09:45:25 -05:00
Raymond Hill
7a908d293f
Remove obsolete setting
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/1872
2021-12-11 05:56:34 -05:00
Raymond Hill
f9e4a10933
Adjust compile/selfie format verison 2021-12-10 08:05:45 -05:00
Raymond Hill
54074af029
Avoid counting important filters as two filters
Rearrange logic to instantiate and add `important` filters
to the block realm when compiled lists are loaded instead
of when lists are compiled.

Additionally, removed now unused properties following
commit 68e14793cc.
2021-12-10 07:56:15 -05:00
Raymond Hill
1490fd606b
Simplify often-executed regex 2021-12-10 07:47:21 -05:00
Raymond Hill
c71b7c7a42
Merge launchFromSelfie into launchToReadiness 2021-12-08 13:43:02 -05:00
Raymond Hill
d17d634b7c
Define new nobab scriptlet
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1863

As per internal discussion with team, best to have a simpler
scriplet, and which is hard-coded to work only on a specific
set of domains -- only those seen used by BAB.
2021-12-08 12:10:18 -05:00
Raymond Hill
2b2af1f20d
Store generic pattern string into bidi-trie buffer 2021-12-08 10:26:52 -05:00
Raymond Hill
72bb89495b
Change compiled list format to a saner block id management
Just use self-described readable section identifiers instead
of difficult-to-manage arbitrary integers.
2021-12-07 11:15:14 -05:00
Raymond Hill
68e14793cc
Remove classes specialized in handling single-wildcarded patterns
Turns out the various benchmarks show no benefits when compiling
filters whose pattern contains a single wildcard character into
specialized classes which threat the pattern as two sub-patterns,
and actually there is a slight improvement in performance as per
benchamrks when treating these patterns as generic ones.

This also fixes the following related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1207
2021-12-06 12:03:52 -05:00
Raymond Hill
55fc4ba5e5
Use effective frame URL for about:blank frames
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1858
2021-12-06 11:59:48 -05:00
Raymond Hill
d3fe0ccfe0
Fix regression with csp=, deprecate queryprune, etc
Fixed serious regression in previous dev build in applying
`csp=` filters. Reported internally by uBO team.

Promote usage of `removeparam` in code instead of `queryprune`,
which is to be deprecated.

Removed test against previously tested hostname in
FilterHostnameDict since as per various benchmark, the
test does not really help.

Remove serialization API in Node.js code as the API is now
present in SNFE itself.
2021-12-06 07:01:39 -05:00
Raymond Hill
7888e49c00
Fix race condition when loading from selfie
All the auxiliary data structures must be fully loaded before
the data structure used as entry point is populated. The race
condition could lead to a case of the entry point data structure
being populated while the auxiliary data structures are still
unpopulated, potentially causing exceptions to be thrown at
launch when the static network filtering engine is queried.

I haven't been able to reproduce such exceptions -- but it
could happen on browsers which do not support being suspended
at launch time (i.e. chromium-based browsers).

Additionally, added convenience methods to easily
serialize/unserialize when SNFE is used as a npm package.
2021-12-05 14:05:32 -05:00
Raymond Hill
634ffc9d14
Fix throttling of optimization cycles
This should help lower time-to-readiness when uBO
is launched on less powerful devices.
2021-12-05 09:07:02 -05:00
Raymond Hill
b78b277907
Add missing code to properly grow buffer
Related feedback:
- https://github.com/orgs/uBlockOrigin/teams/ublock-issues-volunteers/discussions/293

Related commit:
- 725e6931f5

Through all the changes, forgot to pay attention to scenarios
where the `filterData` needs to grow -- the buffer's defautl
size is set to accomodate default filter lists, and subscribing
to more lists would cause the static network filtering engine
to fail because the buffer was not resized when needed.
2021-12-04 17:06:09 -05:00
Raymond Hill
0df8986b52
Fix make lint warning 2021-12-04 11:48:17 -05:00
Raymond Hill
725e6931f5
Refactoring work in static network filtering engine
The original motivation is to further speed up launch time
for either non-selfie-based and selfie-based initialization
of the static network filtering engine (SNFE).

As a result of the refactoring:

Filters are no longer instance-based, they are sequence-of-
integer-based. This eliminates the need to create instances
of filters at launch, and consequently eliminates all the
calls to class constructors, the resulting churning of memory,
and so forth.

All the properties defining filter instances are now as much
as possible 32-bit integer-based, and these are allocated in a
single module-scoped typed array -- this eliminates the need
to allocate memory for every filter being instantiated.

Not all filter properties can be represented as a 32-bit
integer, and in this case a filter class can allocate slots
into another module-scoped array of references.

As a result, this eliminates a lot of memory allocations when
the SNFE is populated with filters, and this makes the saving
and loading of selfie more straightforward, as the operation
is reduced to saving/loading two arrays, one of 32-bit
integers, and the other, much smaller, an array JSON-able
values.

All filter classes now only contain static methods, and all
of these methods are called with an index to the specific
filter data in the module-scoped array of 32-bit integers.

The filter sequences (used to avoid the use of JS arrays) are
also allocated in the single module-scoped array of 32-bit
integers -- they used to be stored in their own dedicated
array.

Additionally, some filters are now loaded more in a deferred
way, so as reduce uBO's time-to-readiness -- the outcome of
this still needs to be evaluated, time-to-readiness is
especially a concern in Firefox for Android or less powerful
computers.
2021-12-04 11:16:44 -05:00
Raymond Hill
ccc4c7d41f
Log selfie-related events at launch time 2021-12-04 10:55:33 -05:00
Raymond Hill
1becd8ad18
Use removeparam, queryprune is deprecated 2021-12-04 10:52:24 -05:00
Raymond Hill
7428e117b5
Remove pointless setting from support information 2021-12-04 10:44:57 -05:00
Raymond Hill
5f7d005e3d
Fix pointless use of parenthesis in regex 2021-12-02 17:58:52 -05:00
Raymond Hill
99dfce0b44
Fix make lint warning 2021-12-02 17:58:17 -05:00
Raymond Hill
395a4e36a9
Officialize uiPopupConfig advanced setting
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1817#issuecomment-981104204
2021-11-28 10:35:50 -05:00
Raymond Hill
aad90eb323
More fine tuning of filter issue report feature 2021-11-28 07:47:16 -05:00
Raymond Hill
1408422cba
Fine tune new reporting feature
Add ability to bring back logger button in popup panel through
the advanced setting `uiPopupConfig`. Adding `+logger` token
to `uiPopupConfig` will bring back the logger icon in the mobile
version of the popup panel.

Additionally, the link to the logger in the Support pane will
take into account whether the <Shift> key is pressed, so as
to behave like the logger icon in the popup panel.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1847

The troubleshooting information has been further fine-tuned to
report popup panel data related to the reported page, for better
diagnosis by disclosing any customization to uBO which was
affecting the reported page.
2021-11-27 11:58:32 -05:00
Raymond Hill
74d1f90264
Allow reporter to select a choice of URLs to report
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1836

The URL to report can now be picked from a list of related
URLs in order to allow the reporter to publish edited version
of the reported URL.

Additionally, the hash, user name, and password which could be
present in a reported URL are always removed.
2021-11-26 12:23:18 -05:00
Raymond Hill
1ac9c5ceb7
Reject generic HTML block filters
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1844

Generic HTML block filters will by highlighted as invalid and
rejected by uBO at compile time.
2021-11-24 18:14:09 -05:00
Raymond Hill
2fae1ce90e
Remove ability to unredact
Unredacted settings is unlikely to be useful after all,
and removing the ability to unredact ensure users won't
mistakenly publish unredacted information.
2021-11-21 07:53:36 -05:00
Raymond Hill
5d51d172c4
Collapse config details by default 2021-11-20 09:38:00 -05:00
Raymond Hill
d49b979732
Add ability to label report as "nsfw" 2021-11-16 08:11:04 -05:00
Raymond Hill
45e5c87084
Fine tune filter issue reporter page
Added an entry to report popups.

Added extra information about how uBO launched.
2021-11-15 10:46:29 -05:00
Raymond Hill
c90b2e4d6f
Fix bad indentation in support data 2021-11-14 13:40:00 -05:00
Raymond Hill
50436ced61
Further fine-tune configuration information in Support pane 2021-11-14 08:13:43 -05:00
Raymond Hill
52063c8633
Force-close popup panel when reporting a filter issue
Necessary on Firefox.
2021-11-13 12:18:26 -05:00