1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-19 19:52:51 +02:00
Commit Graph

8309 Commits

Author SHA1 Message Date
Raymond Hill
8985376b00
Fix timing issue with cached redirection to web accessible resources
Reported internally by @gwarser.

In rare occasion, a timing issue could cause uBO to redirect
to a web accessible resource meant to be used for another
network request. This is a regression introduced with the
following commit:

- 2e5d32e967

Additionally, I identified another issue which would cause
cached redirection to fail when a cache entry with redirection
to a web accessible resource was being reused, an issue which
could especially affect pages which are generated dynamically
(i.e. without full page reload).
2020-11-10 10:43:26 -05:00
Raymond Hill
fd419cf0a3
New revision for dev build 2020-11-10 08:59:34 -05:00
Raymond Hill
76ef4811a3
Fix queryprune for tabless requests
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-724693549
2020-11-10 08:58:39 -05:00
Raymond Hill
727aa95af0
Make Firefox dev build auto-update 2020-11-09 09:55:54 -05:00
Raymond Hill
876b9497e9
new revision for dev build 2020-11-09 07:00:04 -05:00
Raymond Hill
0196993828
Use buffer-like approach for filterUnits array
filterUnits is now treated as a buffer which is
pre-allocated and which will grow in chunks so as
to minimize memory allocations. Entries are never
released, just null-ed.

Additionally, move urlTokenizer into the static
network filtering engine, since it's not used
anywhere else.
2020-11-09 06:54:51 -05:00
Raymond Hill
76887c0716
Make Firefox dev build auto-update 2020-11-08 16:36:05 -05:00
Raymond Hill
db4f02199d
Convert filterSequences into a const variable
Making filterSequences constant allows to no longer
mind how the array is accessed in loops.
2020-11-08 16:00:24 -05:00
Raymond Hill
b5e937a934
New revision for dev build 2020-11-08 15:03:38 -05:00
Raymond Hill
50da6706a4
Code review of static network filtering engine
- Convert this.categories Map() into an array;

- Fix case of potentially using an invalid UintArray32
  (regression from latest changes)
2020-11-08 13:50:36 -05:00
Raymond Hill
96bfe3c9a7
Convert filterUnits into a const variable
Making filterUnits constant allows to no longer
mind how the array is accessed in loops.
2020-11-08 10:30:47 -05:00
Raymond Hill
dd8cce48a1
Make Firefox dev build auto-update 2020-11-08 09:11:12 -05:00
Raymond Hill
efc449dc31
New revision for dev build 2020-11-08 08:47:27 -05:00
Raymond Hill
13f92756be
Make json-prune scriptlet also trap Response.json() calls
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/jns1t4/white_screen_skip_ad_on_youtube/gbg4aq8/
2020-11-08 08:45:33 -05:00
Raymond Hill
87db640653
Make Firefox dev build auto-update 2020-11-07 13:40:59 -05:00
Raymond Hill
849990341c
New revision for dev build 2020-11-07 13:29:29 -05:00
Raymond Hill
cb91d167d1
Fine tune static network filtering engine code
Notably, defer the post-load optimization operations
to a few seconds after the filters have been all
loaded in memory -- this is not a critical step for
the filtering engine to work properly, hence this
can be delayed in order to ensure readiness as soon
as possible.
2020-11-07 13:25:01 -05:00
Raymond Hill
efea83a825
Incrementally improve static filtering parser
Most notably, the `denyallow=` option now requires
the presence of a valid `domain=` option to not be
rejected.

Using `denyallow=` without narrowing down using the
`domain=` option leads to catastrophic blocking
behvior, hence the requirement for a valid `domain=`
option.
2020-11-07 13:20:02 -05:00
Raymond Hill
7da92d3ad1
Make Firefox dev build auto-update 2020-11-06 19:05:45 -05:00
Raymond Hill
76a8e1316f
New revision for dev build 2020-11-06 18:31:15 -05:00
Raymond Hill
1d679143d2
Enable origin-hit coalescing optimisation for modifier filters
Related commit:
- b265f2644d

The optimization in the commit above was meant to
improve the performance of lookup operations of
modifier filters, but I forgot to enable the
optimisation for that class of filters.

This means this commit brings another significant
performance gain on top of the previous commit, as
shown by the built-in benchmark.

Additionally a few minor code rearrangements.
2020-11-06 18:24:46 -05:00
Raymond Hill
c38d7f5bf9
Make Firefox dev build auto-update 2020-11-06 13:55:39 -05:00
Raymond Hill
007d5a77ef
New revision for dev build 2020-11-06 12:26:46 -05:00
Raymond Hill
13d1f9ede5
Drop CSS styles already define in common.css 2020-11-06 12:26:12 -05:00
Raymond Hill
b265f2644d
Coallesce origin hit filters into their own bucket
Performance-related work.

There is a fair number of filters which can't be tokenized
in uBO's own filter lists. Majority of those filters also
declare a `domain=` option, examples:

    *$script,redirect-rule=noopjs,domain=...
    *$script,3p,domain=...,denyallow=...
    *$frame,3p,domain=...

Such filters can be found in uBO's asset viewer using the
following search expression:

    /^\*?\$[^\n]*?domain=/

Some filter buckets will contain many of those filters, for
instance one of the bucket holding untokenizable `redirect=`
filters has over 170 entries, which must be all visited when
collating all matching `redirect=` filters.

When a bucket contains many such filters, I found that it's
worth to extract all the non-negated hostname values from
`domain=` options into a single hntrie and perform a pre-test
at match() time to find out whether the current origin of a
network request matches any one of the collected hostnames,
so as to avoid iterating through all the filters.

Since there is rarely a match() for vast majority of network
requests with `domain=` option, this pre-test saves a good
amount of work, and this is measurable with the built-in
benchmark.
2020-11-06 12:04:03 -05:00
Raymond Hill
fe2c4a4914
Use secure.fanboy.co.nz instead of fanboy.co.nz
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/8166
2020-11-06 06:22:34 -05:00
Raymond Hill
d037d9dced
Update Fanboy URLs
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/8166
2020-11-06 06:17:37 -05:00
Raymond Hill
1ef1e02b86
Fine tune CodeMirror search highlight rendering 2020-11-05 06:04:37 -05:00
Raymond Hill
7a48c9f187
Make Firefox dev build auto-update 2020-11-04 08:25:42 -05:00
Raymond Hill
c5db4c56f3
New revision for dev build 2020-11-04 07:52:06 -05:00
Raymond Hill
19331f1ab5
Fine tune latest changes for performance
Related commits:
- 157cef6034
- 1e2eb037e5
2020-11-04 07:50:51 -05:00
Raymond Hill
04b02f8044
Make Firefox dev build auto-update 2020-11-03 10:35:59 -05:00
Raymond Hill
881c066849
New revision for dev build 2020-11-03 09:31:27 -05:00
Raymond Hill
157cef6034
Re-classify redirect= option as a modifier option
This commit moves the parsing, compiling and enforcement
of the `redirect=` and `redirect-rule=` network filter
options into the static network filtering engine as
modifier options -- just like `csp=` and `queryprune=`.

This solves the two following issues:

- https://github.com/gorhill/uBlock/issues/3590
- https://github.com/uBlockOrigin/uBlock-issues/issues/1008#issuecomment-716164214

Additionally, `redirect=` option is not longer afflicted
by static network filtering syntax quirks, `redirect=`
filters can be used with any other static filtering
modifier options, can be excepted using `@@` and can be
badfilter-ed.

Since more than one `redirect=` directives could be found
to apply to a single network request, the concept of
redirect priority is introduced.

By default, `redirect=` directives have an implicit
priority of 0. Filter authors can declare an explicit
priority by appending `:[integer]` to the token of the
`redirect=` option, for example:

    ||example.com/*.js$1p,script,redirect=noopjs:100

The priority dictates which redirect token out of many
will be ultimately used. Cases of multiple `redirect=`
directives applying to a single blocked network request
are expected to be rather unlikely.

Explicit redirect priority should be used if and only if
there is a case of redirect ambiguity to solve.
2020-11-03 09:15:26 -05:00
Raymond Hill
1b44bf276a
Make Firefox dev build auto-update 2020-11-02 08:20:41 -05:00
Raymond Hill
04b064cd38
New revision for dev build 2020-11-02 07:43:17 -05:00
Raymond Hill
9c43a48445
URLSearchParams() can't be iterated as a Map()
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-720434320
2020-11-02 07:41:21 -05:00
Raymond Hill
c05e78b886
Make Firefox dev build auto-update 2020-11-02 05:26:11 -05:00
Raymond Hill
d536c7ab11
Use const when value does not change 2020-11-02 04:57:42 -05:00
Raymond Hill
c7bed84ab8
New revision for dev build 2020-11-02 04:55:59 -05:00
Raymond Hill
5468b92643
Built-in redirect token none must be seen as valid
Related feedback:
- 1727585faa (commitcomment-43787843)
2020-11-02 04:52:47 -05:00
Raymond Hill
f76471f56b
Fix bad pruning logic
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760#issuecomment-720140135
2020-11-02 04:51:40 -05:00
Raymond Hill
76ea126c12
Make Firefox dev build auto-update 2020-11-01 06:35:29 -05:00
Raymond Hill
c9f8878921
New revision for dev build 2020-11-01 06:28:19 -05:00
Raymond Hill
c75b27c052
Fix top document partyness
Reported internally.

Regression from:
- 1e2eb037e5

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760
2020-11-01 06:25:26 -05:00
Raymond Hill
ba57cdd096
Make Firefox dev build auto-update 2020-10-31 14:00:44 -04:00
Raymond Hill
d6c6071fc4
New revision for dev build 2020-10-31 13:48:44 -04:00
Raymond Hill
64dc5f7807
Fix wrongly reported network filter options in logger
Regression from:
- 1e2eb037e5

Related feedback:
- 1e2eb037e5 (commitcomment-43759481)
2020-10-31 13:47:35 -04:00
Raymond Hill
aae08d519f
Make Firefox dev build auto-update 2020-10-31 11:30:30 -04:00
Raymond Hill
55b893e943
New revision for dev build 2020-10-31 11:09:00 -04:00