1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00
Commit Graph

8303 Commits

Author SHA1 Message Date
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
Raymond Hill
1e2eb037e5
Add new filter option queryprune=
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/760

The purpose of this new network filter option is to remove
query parameters form the URL of network requests.

The name `queryprune` has been picked over `querystrip`
since the purpose of the option is to remove some
parameters from the URL rather than all parameters.

`queryprune` is a modifier option (like `csp`) in that it
does not cause a network request to be blocked but rather
modified before being emitted.

`queryprune` must be assigned a value, which value will
determine which parameters from a query string will be
removed. The syntax for the value is that of regular
expression *except* for the following rules:

- do not wrap the regex directive between `/`
- do not use regex special values `^` and `$`
- do not use literal comma character in the value,
  though you can use hex-encoded version, `\x2c`
- to match the start of a query parameter, prepend `|`
- to match the end of a query parameter, append `|`

`queryprune` regex-like values will be tested against each
key-value parameter pair as `[key]=[value]` string. This
way you can prune according to either the key, the value,
or both.

This commit introduces the concept of modifier filter
options, which as of now are:

- `csp=`
- `queryprune=`

They both work in similar way when used with `important`
option or when used in exception filters. Modifier
options can apply to any network requests, hence the
logger reports the type of the network requests, and no
longer use the modifier as the type, i.e. `csp` filters
are no longer reported as requests of type `csp`.

Though modifier options can apply to any network requests,
for the time being the `csp=` modifier option still apply
only to top or embedded (frame) documents, just as before.
In some future we may want to apply `csp=` directives to
network requests of type script, to control the behavior
of service workers for example.

A new built-in filter expression has been added to the
logger: "modified", which allow to see all the network
requests which were modified before being emitted. The
translation work for this new option will be available
in a future commit.
2020-10-31 10:42:53 -04:00
Raymond Hill
ba2ef925e9
Fix incorrect reset value
This could cause spurious error messages in dev console of
content page.
2020-10-31 10:18:42 -04:00
Raymond Hill
eb7d60441b
Make Firefox dev build auto-update 2020-10-29 08:25:18 -04:00
Raymond Hill
a8ddccb303
New revision for dev build 2020-10-29 06:56:41 -04:00
Raymond Hill
f406105238
New revision for dev build 2020-10-29 06:03:25 -04:00
Raymond Hill
2b88c8b545
Fix incorrect count in built-in benchmark 2020-10-29 06:01:04 -04:00