Commit Graph

8485 Commits

Author SHA1 Message Date
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
Raymond Hill f5459d4546
Make Firefox dev build auto-update 2020-10-28 06:10:28 -04:00
Raymond Hill ee3956f14b
Import translation work from https://crowdin.com/project/ublock 2020-10-27 13:10:54 -04:00
Raymond Hill 4e5550f0c6
New revision for dev build 2020-10-27 13:08:27 -04:00
Raymond Hill a1aa9bd54f
Disable button until benchmark session is completed 2020-10-27 13:07:05 -04:00
Raymond Hill 4059a92838
Fine tune built-in benchmark
Additionally, add a button in the About pane
to launch benchmark sessions. The button will
be available only when advanced setting
`benchmarkDatasetURL` is set and pointing to
a valid dataset.
2020-10-27 12:59:31 -04:00
Raymond Hill e5b932335c
Make Firefox dev build auto-update 2020-10-25 13:25:32 -04:00
Raymond Hill 47c9ea039d
New revision for dev build 2020-10-25 13:09:04 -04:00
Raymond Hill 0bbf5b52ab
Improve token extraction from regex-based filters 2020-10-25 13:06:26 -04:00
Raymond Hill ed2ad57dca
Ensure no-large-element styling is removed 2020-10-25 08:05:26 -04:00
Raymond Hill f122e0b34b
Make Firefox dev build auto-update 2020-10-24 08:36:12 -04:00
Raymond Hill 7bed85fb6c
Import translation work from https://crowdin.com/project/ublock 2020-10-24 08:29:45 -04:00
Raymond Hill 516696a60c
Increase search style priority in CodeMirror editors 2020-10-24 08:26:38 -04:00
Raymond Hill 470a3bd55f
New revision for dev build 2020-10-23 07:32:28 -04:00
Raymond Hill a1a008098c
More fine tuning of no-large-media-elements content script
Related issue:
- https://github.com/gorhill/uBlock/issues/1390
2020-10-23 07:29:14 -04:00
Raymond Hill 2b5a853d8c
Fix regex to validate URL of imported lists
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1306
2020-10-23 06:25:08 -04:00
Raymond Hill 61ac9a5b6e
Make Firefox dev build auto-update 2020-10-22 09:51:11 -04:00
Raymond Hill 37b195f61d
Remove all event handlers from no-large-media-elements content scripts
Related issue:
- https://github.com/gorhill/uBlock/issues/1390
2020-10-22 09:01:59 -04:00
Raymond Hill 902fd51522
New revision for dev build 2020-10-22 08:48:44 -04:00