Commit graph

2744 commits

Author SHA1 Message Date
Raymond Hill
651955b97c
Throw if mismatched size when unserializing an array buffer
An exception will be thrown if the length of an unserialized
array buffer does not match exactly the original size at
serialization time.
2020-02-04 09:55:02 -05:00
Raymond Hill
609e9a6428
Remove elision of leading wildcard in some filter patterns
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/882

Related commits:
- https://github.com/gorhill/uBlock/commit/a95ef16e064a
- https://github.com/gorhill/uBlock/commit/7971b223855d

Leading wildcards before valid token characters need to
be kept in order to respect the semantic of the filter.
A leading wildcard in such case changes the semantic of
a filter, i.e. two following filters are semantically
different:

    example/abc
    *example/abc

As a result, µBlock.BidiTrieContainer.indexOf() is now
able to deal with a needle of length zero -- which is
what happens in FilterPatternLeft(Ex) with filter
patterns starting with `*` (or `^*`) and followed by
valid token characters (0-9, a-z and %).
2020-02-03 14:09:37 -05:00
Raymond Hill
3ef999d44b
Enforce no scrollbars on body element
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/881
2020-02-03 10:51:30 -05:00
Raymond Hill
a95ef16e06
Fix token position value when removing leading wildcard
Related issue:
- https://www.reddit.com/r/uBlockOrigin/comments/ex8ggg/

Regression from:
- https://github.com/gorhill/uBlock/commit/7971b223855d
2020-02-02 10:05:15 -05:00
Raymond Hill
1d51927d2e
Fix handling of end-anchor in redirect patterns
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/872

An end-anchor was treated as literal `|` in the redirect
pattern to match instead of as a end-of-string condition.
2020-02-01 12:47:17 -05:00
Raymond Hill
ce055d0653
Import translation work from https://crowdin.com/project/ublock 2020-02-01 11:42:49 -05:00
Raymond Hill
4629732a69
Fine tune visuals of ruleset tools in popup panel 2020-02-01 11:36:14 -05:00
Raymond Hill
0627fcfb62
Fix broken row rendering for non-network-based URL
Reported internally by volunteers.

Regression from:
- https://github.com/gorhill/uBlock/commit/3a564c199260#diff-fd76b4e8f9d7bfb2e5e01510c9457633L367
2020-01-31 13:48:17 -05:00
Raymond Hill
fcc7781aef
Use proper popup URL 2020-01-30 12:43:41 -05:00
Raymond Hill
2b0316440e
First draft of popup panel for Firefox Preview
First draft of changes as discussed with Firefox
Preview people.

In order to allow testing/evaluating these changes,
the new advanced setting `uiFlavor` has been added.
Default to `unset`; and can currently only be set
to `fenix`.

The new setting takes effect at launch only. This
new setting is not to be mentioned in official
documentation for now.

This is ongoing work, not open to external feedback.
2020-01-25 09:24:59 -05:00
Raymond Hill
2e0a8951b8
Minor code review 2020-01-23 12:06:40 -05:00
Raymond Hill
043ae117c8
Decouple error handling of lists loading from selfie loading
This commit make it so that if an *unexpected* error is
thrown when trying to load the selfie at launch, the filter
lists will still be loaded as a result.
2020-01-21 10:52:13 -05:00
Raymond Hill
969dbecd49
Import translation work from https://crowdin.com/project/ublock 2020-01-10 11:13:55 -05:00
Raymond Hill
f8ec54c635
Fix compatibility issue with hosts files
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/847

IP address `0` is a valid synonym of `0.0.0.0`.
2020-01-10 11:07:31 -05:00
Raymond Hill
8704e4e620
Improve token extraction from regex-based filters
Tokens which are as long or longer than the max token
length possible do not need to have the prefix part
evaluated against special regex characters. This will
help increase the likelihood of extracting a valid
token from regex-based filters.

Actual case found in EasyPrivacy:

  /^https?:\/\/eulerian..*\/[a-z0-9]{2,12}\.js/$script

Before this commit, uBO was not able to extract a
valid token, while now uBO is able to extract `eulerian`
as a valid token (consequently the regex-based filter
will now be evaluated only when the token `euleria` is
found in a URL).
2020-01-09 10:09:51 -05:00
Raymond Hill
2cf79ef922
Minor code review 2020-01-04 09:32:28 -05:00
Raymond Hill
d0738c0835
Visually distinguish canonical names in popup panel
Further fine-tuning support for canonical names.

Aliased canonical names will be rendered blue
in the dynamic filtering pane of the popup panel.
2019-12-31 16:36:51 -05:00
Raymond Hill
e9abce61a0
Fix unescaped attr value in generated CSS selector
Related feedback:
- https://github.com/NanoAdblocker/NanoCore2/commit/5e625da8fe45#commitcomment-36625096
2019-12-31 16:14:50 -05:00
Raymond Hill
a518a9c1e4
Import translation work from https://crowdin.com/project/ublock 2019-12-30 10:04:54 -05:00
Raymond Hill
56cc2b1256
Support expanding/collpasing of specific domains
This is related to the list of domains/subdomains in
the dynamic filtering pane of the popup panel.

Related issue:
- https://github.com/gorhill/uBlock/issues/284

Clicking on the empty space of a row will toggle
the visibility of the subdomains.

Additionally, the root context will always be visible
regardless of the expand/collspase state, along with
a visual indicator that a specific domain or subdomain
is the actual root context.  (the root context is the
hostname in which local rules are created).
2019-12-30 09:54:11 -05:00
Raymond Hill
2da8948928
Add basic syntax coloring to advanced settings pane 2019-12-24 10:04:18 -05:00
Raymond Hill
1bb524d12b
Still try to load filter lists after fatal error at launch
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/817#issuecomment-565730122

In case of a fatal error at launch, the loading of filter lists
could be skipped. With this commit uBO will still try to load
the filter lists, at least the default ones if no valid selfie
is present.
2019-12-14 11:14:00 -05:00
Raymond Hill
a0b5baacdd
Import translation work from https://crowdin.com/project/ublock 2019-12-08 11:12:15 -05:00
Raymond Hill
d90c8486aa
Fix reporting of csp-blocked resources in logger
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/552#issuecomment-561888900

Regression from:
- https://github.com/gorhill/uBlock/commit/7971b223855d
2019-12-04 19:23:57 -05:00
Raymond Hill
93015ca129
Import translation work from https://crowdin.com/project/ublock 2019-12-04 10:53:13 -05:00
Raymond Hill
34504a0a1a
Fix regex-like filter representation in logger
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/805#issuecomment-561500819

uBO was testing for regex-like plain patterns after
prepending `@@` in the case of exception filters, thus
preventing proper detection of regex-like plain
patterns. The filtering engine was not affected, only
the proper rendering of the filter in the logger was
affected.
2019-12-04 10:42:03 -05:00
Raymond Hill
082201d24a
Fix reverse lookup of entity-based cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/805
2019-12-04 10:10:07 -05:00
Raymond Hill
91e702cebb
Enable CNAME uncloaking by default
Advanced setting `cnameAliasList` has been removed.

New advanced settings:

cnameUncloak:
  Boolean
Default value:
  true
Description:
  Whether to CNAME-uncloak hostnames.

cnameIgnoreExceptions:
  Boolean
Default value:
  true
Description:
  Whether to bypass the uncloaking of network requests
  which were excepted by filters/rules. This is
  necessary so as to avoid undue breakage by having
  exception filters being rendered useless as a result
  of CNAME-uncloaking.
  For example, `google-analytics.com` uncloaks to
  `www-google-analytics.l.google.com` and both hostnames
  appear in Peter Lowe's list, which means exception
  filters for `google-analytics.com` (to fix site
  breakage) would be rendered useless as the uncloaking
  would cause the network request to be ultimately
  blocked.
2019-12-01 12:05:49 -05:00
Raymond Hill
8a1a8b103f
Improve neutered Google Analytics replacement scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/5132

The change in this commit make it so that it's no
longer required to have an exception filter for
`google-analytics.com/analytics.js` for the page to
render properly.
2019-12-01 10:40:05 -05:00
Raymond Hill
e98a4b1ace
Discard :: from parsed hosts files
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/800
2019-12-01 09:15:25 -05:00
Raymond Hill
0356e91ccb
Remove no longer used property 2019-12-01 09:01:20 -05:00
Raymond Hill
a16e4161de
Fine tune hostname uncloaking through CNAME-lookup
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/780

Related commit:
- https://github.com/gorhill/uBlock/commit/3a564c199260

This adds two new advanced settings:

- cnameIgnoreRootDocument
  - Default to `true`
  - Tells uBO to skip CNAME-lookup for root document.

- cnameReplayFullURL
  - Default to `false`
  - Tells uBO whether to replay the whole URL or just
    the origin part of it.
    Replaying only the origin part is meant to lower
    undue breakage and improve performance by avoiding
    repeating the pattern-matching of the whole URL --
    which pattern-matching was most likely already
    accomplished with the original request.

This commit is meant to explore enabling CNAME-lookup
by default for the next stable release while:

- Eliminating a development burden by removing the
  need to create a new filtering syntax to deal with
  undesirable CNAME-cloaked hostnames

- Eliminating a filter list maintainer burden by
  removing the need to find/deal with all base
  domains which engage in undesirable CNAME-cloaked
  hostnames

The hope is that the approach implemented in this
commit should require at most a few unbreak rules
with no further need for special filtering syntax
or filter list maintance efforts.
2019-11-23 13:07:23 -05:00
Raymond Hill
1b068c15fb
Fix token array being too small for very long URL
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/dzw57l/

Each token requires two slots in the token indices
array. This commit fixes uBO breaking when dealing
with very long URLs with lot of distinct tokens in
them.
2019-11-22 23:51:39 -05:00
Raymond Hill
68e1b58bb6
Trim trailing spaces from string values in advanced settings 2019-11-20 11:45:10 -05:00
Raymond Hill
563aed0d93
Code review for dns lookup code
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/780

- Handle DNS lookup failure

- Skip DNS lookup for non network-based URLs

- Benchmark code to be able to provide an estimate
  based on objective measurements regarding added
  overhead when DNS lookup is enabled
  (quick answer: a complete non-issue)
2019-11-20 10:45:17 -05:00
Raymond Hill
3a564c1992
Add ability to uncloak CNAME records
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/780

New webext permission added: `dns`, which purpose is
to allow an extension to fetch the DNS record of
specific hostnames, reference documentation:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/dns

The webext API `dns` is available in Firefox 60+ only.

The new API will enable uBO to "uncloak" the actual
hostname used in network requests. The ability is
currently disabled by default for now -- this is only
a first commit related to the above issue to allow
advanced users to immediately use the new ability.

Four advanced settings have been created to control the
uncloaking of actual hostnames:

cnameAliasList: a space-separated list of hostnames.
Default value: unset => empty list.
Special value: * => all hostnames.
A space-separated list of hostnames => this tells uBO
to "uncloak" the  hostnames in the list will.

cnameIgnoreList: a space-separated list of hostnames.
Default value: unset => empty list.
Special value: * => all hostnames.
A space-separated list of hostnames => this tells uBO
to NOT re-run the network request through uBO's
filtering engine with the CNAME hostname. This is
useful to exclude commonly used actual hostnames
from being re-run through uBO's filtering engine, so
as to avoid pointless overhead.

cnameIgnore1stParty: boolean.
Default value: true.
Whether uBO should ignore to re-run a network request
through the filtering engine when the CNAME hostname
is 1st-party to the alias hostname.

cnameMaxTTL: number of minutes.
Default value: 120.
This tells uBO to clear its CNAME cache after the
specified time. For efficiency purpose, uBO will
cache alias=>CNAME associations for reuse so as
to reduce calls to `browser.dns.resolve`. All the
associations will be cleared after the specified time
to ensure the map does not grow too large and too
ensure uBO uses up to date CNAME information.
2019-11-19 12:05:33 -05:00
Raymond Hill
bdd4a5bf5a
Detect/prevent the creation of already existing iframe tags
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/786

A case of web page embedding multiple times the
`adsbygoogle.js` script was causing the neutered,
replacement script to create a huge amount of iframes
in the DOM.

The scriptlet has been modified to check if an iframe
tag already exist and skip the creation if so.
2019-11-19 08:49:38 -05:00
Raymond Hill
2884b54bf4
Import translation work from https://crowdin.com/project/ublock 2019-11-18 11:29:54 -05:00
Raymond Hill
eec31fca8b
Save magic compiled/selfie format values in cache storage
Related issue:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1588916

Due to browser behavior changes during development,
uBO can end up using obsolete cached compiled filter
lists or selfie.

Saving magic format values in the cache storage
itself ensure uBO will properly detect actually
obsolete compiled lists/selfie.
2019-11-14 08:22:28 -05:00
Raymond Hill
4d8250ab04
Ensure +/- symbols are same width in popup panel 2019-11-12 08:16:33 -05:00
Raymond Hill
e2fdc1b94b
Support keyboard shortcut to open popup panel
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/dt47s0/
2019-11-09 09:53:31 -05:00
Raymond Hill
7bf5ac0ca2
Code review of commit 4b34d29384
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/778

Related commit:
- 4b34d29384

Mind that `report-uri` or `report-to` could be
used somewhere in a hostname.
2019-11-09 07:32:19 -05:00
Raymond Hill
e008ca6307
Import translation work from https://crowdin.com/project/ublock 2019-11-09 07:07:07 -05:00
Raymond Hill
4b34d29384
Fix regex used to detect forbidden CSP directives
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/778
2019-11-09 06:59:59 -05:00
Raymond Hill
067ef5843c
Ensure that typeof of href attribute is string
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/777
2019-11-08 09:30:59 -05:00
Raymond Hill
ffae19270f
Coallesce mousemove events
Related commit:
- d1995778ff

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/615
2019-11-06 07:01:13 -05:00
Raymond Hill
d1995778ff
Allow element picker dialog to be moved around
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/615

There is a grab area under the text area, to be used
to move the dialog around.
2019-11-05 12:03:48 -05:00
Raymond Hill
522249bcb5
Fix test against opener tab id in popup filtering code
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/774

Regression from:
- f204d24bf4
2019-11-04 13:34:44 -05:00
Raymond Hill
ec5191004c
Use encodeURIComponent instead of btoa
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/772
2019-11-04 13:12:40 -05:00
Raymond Hill
da253bf80c
Use type="search" for search input fields
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/768

So that the input fields can gain extra built-in
browser widgets useful in search fields.
2019-11-03 13:14:29 -05:00