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

3217 Commits

Author SHA1 Message Date
Raymond Hill
218f774ba0
Fix broken localized string in some languages
Reported as feedback at:
- https://crowdin.com/translate/ublock
2020-09-12 10:37:08 -04:00
Raymond Hill
b73b24ebb1
Fix slider's responsiveness to layout changes
Related commit:
- f01bda1159
2020-09-12 08:26:44 -04:00
Raymond Hill
f01bda1159
Rework visuals of element picker sliders
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/851
2020-09-12 07:28:46 -04:00
Raymond Hill
ead49e083a
Fix delete key handling in element zapper
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1237#issuecomment-690897502
2020-09-11 08:12:45 -04:00
Raymond Hill
f0ef680a86
Remove pointless test for parent node presence
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1240
2020-09-11 07:58:01 -04:00
Raymond Hill
df83a0847f
Forgot to commit last minute changes in element picker
Related commit:
- 260f762c83
2020-09-10 10:40:07 -04:00
Raymond Hill
6fd6f7f26b
Import translation work from https://crowdin.com/project/ublock 2020-09-10 10:39:30 -04:00
Raymond Hill
260f762c83
Add widget to control selector depth to element picker
Further iterating on the work done in following commit:
- 1268f0ae43

This commit adds a new widget to the element picker to
control the depth of a cosmetic filter selector. The
new widget is essentially just another way of selecting
the depth, which is still controllable through picking
one of the cosmetic filters in the list of candidates.
2020-09-10 10:32:53 -04:00
Raymond Hill
6f7801d433
Fix zapper not being able to remove SVG elements
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1237
2020-09-09 10:51:30 -04:00
Raymond Hill
d4182add6e
Add ability to outright remove/ignore "really bad lists"
In addition to what is deemed really bad lists by consensus,
some lists will also be labelled "really bad list"
temporarily so as to force-remove them from the set of
filter lists.

This will be the case for filter lists which are not
necessarily "bad lists" but which were once part of
uBO's stock filter lists and have been removed since
then for various reasons.

This will ensure that the majority of users who do not
modifies uBO's default listset will still have a
configuration which matches the official default listset.
2020-09-09 09:57:29 -04:00
Raymond Hill
1268f0ae43
Add element picker widget to control specificity
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/851

The ctrl key is no longer used to adjust specificity of
a candidate filter.

A new widget has been added to adjust the specificity of
a candidate filter to various level. The widget will be
visible as long as the candidate filter matches one entry
in the list of suggested candidate cosmetic filters.
2020-09-09 09:27:53 -04:00
Raymond Hill
1d723f990e
Import translation work from https://crowdin.com/project/ublock 2020-09-07 08:41:37 -04:00
Raymond Hill
35aefed926
Add support to chain :style() to procedural operators
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/382

Additionally, remnant code for pseudo-user stylesheets
has been removed. Related commit:
- 5c68867b92
2020-09-07 08:28:01 -04:00
Raymond Hill
4ce3ff2e04
Remove code for unused message 2020-09-03 10:56:29 -04:00
Raymond Hill
d23f9c6a8b
Isolate element picker's svg layers from page content
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1226

Related commit:
- 9eb455ab5e

In the previous commit, the element picker dialog was
isolated from the page content. This commit is to also
isolate the svg layers from the page content.

With this commit, there is no longer a need for an anonymous
iframe and the isolated world iframe is now directly
embedded in the page.

As a result, pages are now unable to interfere with any
of the element picker user interface. Pages can now only
see an iframe, but are unable to see the content of that
iframe. The styles applied to the iframe are from a user
stylesheet, so as to ensure pages can't override the
iframe's style properties set by uBO.
2020-09-03 10:27:35 -04:00
Raymond Hill
9eb455ab5e
Isolate element picker dialog from page content world
Related issues:
- https://github.com/gorhill/uBlock/issues/3497
- https://github.com/uBlockOrigin/uBlock-issues/issues/1215

To solve above issues, the element picker's dialog is now
isolated from the page content in which it is embedded.

The highly interactive, mouse-driven part of the element
picker is still visible by the page content.
2020-09-01 12:32:12 -04:00
Raymond Hill
43dba2bd0e
StaticFilteringParser.analyzeExtra() has no argument 2020-09-01 09:57:38 -04:00
Raymond Hill
90743532f1
Add missing colon 2020-09-01 09:52:44 -04:00
Raymond Hill
db008f45dc
Import translation work from https://crowdin.com/project/ublock 2020-08-30 07:56:11 -04:00
Raymond Hill
3bbed7be33
Do not use letter-spacing for non-bolded text
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1044#issuecomment-682920219
2020-08-29 08:32:40 -04:00
Raymond Hill
1369b137d5
Import translation work from https://crowdin.com/project/ublock 2020-08-28 15:34:14 -04:00
Raymond Hill
d2195b4246
Fix rule sorting quirk in "My rules" pane
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1055
2020-08-27 07:04:37 -04:00
Raymond Hill
45cce88d8b
Import translation work from https://crowdin.com/project/ublock 2020-08-27 06:41:58 -04:00
Raymond Hill
ef62398fd9
Add translations for ne wsort widget in "My rules"
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1055
2020-08-27 06:36:29 -04:00
Raymond Hill
405c3e1a84
Add visual hint for last selected entry in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/47
2020-08-26 11:01:37 -04:00
Raymond Hill
817b87e9fc
Fine tune collapsed sections behavior 2020-08-25 14:26:44 -04:00
Raymond Hill
51ab3e6c52
Fix misaligned label 2020-08-25 13:46:36 -04:00
Raymond Hill
532ed5c390
Add ability to collpase unchanged rules in _My rules_ pane
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/604
2020-08-25 13:23:30 -04:00
Raymond Hill
fdbde27357
Fix default sort quirk
Related feedback:
- dd655473f6 (commitcomment-41730014)
2020-08-24 14:46:25 -04:00
Raymond Hill
0e9d4714e9
Mibor: better variable name 2020-08-24 12:40:36 -04:00
Raymond Hill
dd655473f6
Add ability to sort rules in _My rules_ pane
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1055
2020-08-24 12:39:07 -04:00
Raymond Hill
e33642da66
Import translation work from https://crowdin.com/project/ublock 2020-08-22 09:07:20 -04:00
Raymond Hill
4150c17f4a
Add concept of "really bad list" to badlists infrastructure
This commit adds concept of "really bad list" to the
badlists infrastructure. Really bad lists won't be
fetched from a remote server, while plain bad list
will be fetched but won't be compiled.

A really bad list is denoted by the `nofetch` token
following the URL.

Really bad lists can cause more serious issues such
as causing undue launch delays because the remote
server where a really bad list is hosted fails to
respond properly and times out.

Such an example of really bad list is hpHosts which
original server no longer exist.
2020-08-22 08:43:16 -04:00
Raymond Hill
23f08f0274
Add support for blocklist of filter lists
Many filter lists are known to cause serious filtering
issues in uBO and are not meant to be used in uBO.

Unfortunately, unwitting users keep importing these
filter lists and as a result this ends up causing
filtering issues for which the resolution is always
to remove the incompatible filter list.

Example of inconpatible filter lists:
- Reek's Anti-Adblock Killer
- AdBlock Warning Removal List
- ABP anti-circumvention filter list

uBO will use the following resource to know
which filter lists are incompatible:
- https://github.com/uBlockOrigin/uAssets/blob/master/filters/badlists.txt

Incompatible filter lists can still be imported into
uBO, useful for asset-viewing purpose, but their content
will be discarded at compile time.
2020-08-21 11:57:20 -04:00
Raymond Hill
f6d1c6402f
Add support for removal of cloud storage entries 2020-08-21 09:18:33 -04:00
Raymond Hill
db79672355
Fix layout issue with cloud storage widget
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1217
2020-08-21 08:57:47 -04:00
Raymond Hill
394a61570c
Use modern popup panel in logger
The logger was still embedding the now deprecated popup
panel.
2020-08-21 08:23:36 -04:00
Raymond Hill
b98b2fc52b
Slightly improve nowoif scriptlet
Returns proxied self is no window object can
be returned.
2020-08-18 10:28:45 -04:00
Raymond Hill
cb6486859c
Further fine tune nowoif scriptlet 2020-08-18 09:11:40 -04:00
Raymond Hill
d544543ab5
Add argument to nowoif scriptlet
When a 3rd argument was provided, the scriplet would
log information related to window popup operations,
regardless of the value of the argument.

The 3rd argument is now parsed in a formal manner. It
is meant to be one or more space-separated tokens which
are used to fine tune the behavior of the scriptlet.

Tokens:

log:
  Cause the scriptlet to log information regarding
  how window.open() is used by the page on which the
  scriptlet is used. Useful only to filter creators.

obj:
  Use an `object` element instead of `iframe` element
  (default) as a decoy to be used in place of a popup
  window, when the page requires a valid `window`
  instance to be returned.
2020-08-17 09:47:40 -04:00
Raymond Hill
b33065e198
Fine tune nowoif scriptlet 2020-08-16 17:14:26 -04:00
Raymond Hill
a546a5e1ba
Fix typo 2020-08-16 13:24:10 -04:00
Raymond Hill
071b15cf94
Improve nowoif scriptlet
Related issue:
- https://github.com/uBlockOrigin/uAssets/issues/ 6019
2020-08-16 13:18:40 -04:00
Raymond Hill
d8b6b31eca
Add support for cloud storage compression
Cloud storage is a limited resource, and thus it
makes sense to support data compression before
sending the data to cloud storage.

A new hidden setting allows to toggle on
cloud storage compression:

name: cloudStorageCompression
default: false

By default, this hidden setting is `false`, and a
user must set it to `true` to enable compression
of cloud storage items.

This hidden setting will eventually be toggled
to `true` by default, when there is good confidence
a majority of users are using a version of uBO
which can properly handle compressed cloud storage
items.

A cursory assessment shows that compressed items
are roughly 40-50% smaller in size.
2020-08-16 11:59:27 -04:00
Raymond Hill
6dca8969b0
Revert latest changes
Related commit:
- d39b6d058a
- 94650e260e
2020-08-16 06:03:34 -04:00
Raymond Hill
d39b6d058a
Fix cases of illegal invocation with nowoif 2020-08-15 10:31:48 -04:00
Raymond Hill
0435257c16
Be sure pageStoreFromTabId() is defined before message handlers 2020-08-14 15:32:08 -04:00
Raymond Hill
2afcc13ca6
Add widget to convey the amount of sync storage in use 2020-08-14 15:29:25 -04:00
Raymond Hill
ba833d3391
Use EasyList as nominal reference for filter creation 2020-08-14 10:15:14 -04:00
Raymond Hill
94650e260e
Fix nowoif decoy
Related issue:
- https://github[.]com/uBlockOrigin/uAssets/issues/6019
2020-08-14 09:52:20 -04:00
Raymond Hill
24ef0cb753
Fix typo in comment 2020-08-13 09:40:43 -04:00
Raymond Hill
00b790ce72
Add support for more !#if pre-parser directive tokens
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1205
2020-08-13 09:32:34 -04:00
Raymond Hill
45f26d7319
Better parsing of hosts file system addresses
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/877
2020-08-10 10:56:28 -04:00
Raymond Hill
b01cc6ca4f
Fix cloud storage errors not reported in user interface
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/i6e7lr/
2020-08-10 08:30:52 -04:00
Raymond Hill
79ccd23ccf
Also remove references to remove scriptlets
Related commit:
- 7c22a31294
2020-08-06 11:40:18 -04:00
Raymond Hill
7c22a31294
Remove experimental click-to-load disqus scriptlets
As per AMO reviewer:

> We will need you to remove the remote scripts in
>
> web_accessible_resources\disqus_embed.js - line 48
> web_accessible_resources\disqus_forums_embed.js - line 44

Related issue:
- https://github.com/gorhill/uBlock/issues/1899
2020-08-06 09:30:34 -04:00
Raymond Hill
f574a7e74d
Remove more cases of svg/use
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1196
2020-08-06 09:05:10 -04:00
Raymond Hill
290f3d124f
Fix stray <symbol> in path attribute
Related commit:
- 12be265e7d
2020-08-05 12:10:03 -04:00
Raymond Hill
12be265e7d
Fix performance issue with SVG-based icons in dashboard
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1196

For yet unknown reasons, in Chromium 84 the rendering of
`svg/use`-based icons in the dashboard causes page load
stall and undue high memory usage when the dashboard is
opened, especially the Filter list pane.

The fix in this commit is to avoid using `svg/use` and to
directly create and insert the `path` element defining an
icon.
2020-08-05 11:36:54 -04:00
Raymond Hill
dae25b0bae
Fix regression breaking filters with --prefixed pseudo-elements
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/89#issuecomment-668701495
2020-08-04 16:00:22 -04:00
Raymond Hill
4c6ee1e0d3
Fix broken :spath operators starting with >
Related feedback:
- 7dd48a6c8c (r41180568)

Regression from:
- 7dd48a6c8c
2020-08-04 11:30:04 -04:00
Raymond Hill
0d266218d0
Import translation work from https://crowdin.com/project/ublock 2020-08-04 10:28:09 -04:00
Raymond Hill
e44af458c0
Fine tune visuals of CodeMirror's search feature
Added a dotted box around found text occurrences,
as just pale yellow to highlight the text is not
enough to visually distinguish from surrounding text.

Iterating through found text occurrences will now
ensure they are vertically positioned in the middle
of the editor.
2020-08-04 10:14:38 -04:00
Raymond Hill
59496cfa45
Restore visual of input field on Firefox 2020-08-03 14:30:30 -04:00
C0rn3j
3fed25a52d
Use ISO8061 dates in filter comments 2020-08-03 10:30:36 -04:00
Raymond Hill
50bf999a12
Fine tune CodeMirror editor's search widget
Code review following latest changes.

Also, move the input field to the left so that it
renders properly on smaller displays and does not
jump around when the result position/count numbers
change.

This also makes it easier to add more functionality
to the editor's toolbar in the future.
2020-08-03 08:55:02 -04:00
Raymond Hill
d654a5d6cf
Fix search operation broken by search worker going away
Related commit:
- 23332400f5

Since the search worker can go away after its time-to-live
elapsed, we may need to pass again the haystack on which
search operations are performed.
2020-08-02 12:46:52 -04:00
Raymond Hill
23332400f5
Improve annotations for search operations in CodeMirror editor
Before this commit, CodeMirror's add-on for search occurrences
was limited to find at most 1000 first occurrences, because of
performance considerations.

This commit removes this low limit by having the search
occurrences done in a dedicated worker. The limit is now
time-based, and highly unlikely to ever be hit under normal
condition.

With this change, all search occurrences are gathered,
and as a result:

- All occurrences are reported in the scrollbar instead of
just the 1,000 first

- The total count of all occurrences is now reported, instead
of capping at "1000+".

- The current occurrence rank at the cursor or selection
position is now reported -- this was not possible to report
this before.

The number of occurrences is line-based, it's not useful to
report finer-grained occurences in uBO.
2020-08-02 12:18:01 -04:00
Raymond Hill
90c7e79f4f
Consolidate filter list reverse lookup code into a single file
Since it's possible to execute specific code paths according
to whether the context is that of a worker or not, it's possible
to keep the main/thread code in a single file. Keeping the
main/worker code paths into a single file is more convenient
for both code maintenance and code review.
2020-08-01 10:32:40 -04:00
Raymond Hill
7dd48a6c8c
Allow :upward() operator to select html element
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/hvwwj0/element_hiding_by_url_not_by_domain_is_it_possible/fyzykw0/
2020-07-30 11:58:49 -04:00
Raymond Hill
aa37166ae7
Code review re. content scripts in about:blank frames
Related commit:
- 3b72c7cb04
2020-07-29 07:38:49 -04:00
Raymond Hill
3632c1821e
Tabs opened from about:newtab are not popup candidates
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1184
2020-07-29 07:13:08 -04:00
Raymond Hill
9447829eb1
Fix regression causing logger to fail to report cosmetic filters
Related commit:
- 5c68867b92
2020-07-27 13:30:57 -04:00
Raymond Hill
3df978ffd5
Make usage of space more strict in network filter patterns
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1118

Usage of space in network filter patterns will now be
strictly interpreted as the filter being a hosts file
entry.

Usage of space in any other scenario will cause the
pattern of the network filter to be rejected as
erroneous.
2020-07-27 10:20:11 -04:00
Raymond Hill
e98ea7ea9b
Instantiate procedural filterer instance on demand only
The procedural filterer will be instantiated only when
needed, i.e. only when there are actual procedural
filters to enforce.
2020-07-24 19:08:48 -04:00
Raymond Hill
3b72c7cb04
Ensure about: frames use proper origin
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/688

`about:` frames need to lookup and use the inherited
origin from their parent browsing context for proper
lookup of cosmetic filters.
2020-07-24 18:50:12 -04:00
Raymond Hill
72cfc3218a
Import translation work from https://crowdin.com/project/ublock 2020-07-24 12:42:21 -04:00
Raymond Hill
5c68867b92
Deprecate pseudo user styles code
The pseudo user styles code served only browsers based
on Chromium 65 and earlier -- Chromium 66 supports
native user styles and was first released more than two
years ago.

In Chromium-based browsers, the pseudo user styles code
is being unconditionally injected in every page/frame
just in case the browser is version 65 or earlier.

Removing pseudo user styles reduce uBO's main content
script in Chromium-based browsers by more than 20K.

Related thread:
- https://github.com/NanoAdblocker/NanoCore/issues/348#issuecomment-653646507
2020-07-22 10:21:16 -04:00
Raymond Hill
3839d05a99
Auto-update most obsolete asset first
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1165
2020-07-21 07:50:36 -04:00
Raymond Hill
f55c891d54
Avoid returning a value when injected as content script 2020-07-20 17:28:33 -04:00
Raymond Hill
c805950ecf
Fix the logging of cosmetic filters in about:blank frames
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1164
2020-07-20 08:27:00 -04:00
Raymond Hill
85aef306d1
vAPI.tabs.executeScript() can't throw
Related commit:
- aed850978e

No need to mind rejected promise after all,
vAPI.tabs.executeScript() is designed to
not fail -- I had forgotten about this.
2020-07-19 18:38:35 -04:00
Raymond Hill
aed850978e
Mind discarded status of tabs when internally handling them
Related discussion:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1652925#c19

Content scripts should not be injected in discarded tabs, and
a discarded tab should treated as if it does not exist.
2020-07-19 17:41:13 -04:00
Raymond Hill
221983646e
Injects user styles and content scripts in about:blank frames
Related issues:
- https://github.com/uBlockOrigin/uBlock-issues/issues/688
- https://github.com/uBlockOrigin/uBlock-issues/issues/1164

`match_about_blank` is now used for content scripts and
user styles.
2020-07-19 09:06:19 -04:00
Raymond Hill
fb0a442a9a
Fix improperly initialized counter
Related discussion:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1167

Related commit:
- feabfe3793
2020-07-19 09:01:45 -04:00
Raymond Hill
9880b9c18f
Fix too small magnifier
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1092

As a result of earlier redesign, the magnifier ended
up being too small. The size of the magnifier will now
be dependent on the default font size instead of the
parent font size.
2020-07-18 09:50:59 -04:00
Raymond Hill
0549bfaf00
Do not implicitly strict-block when pattern contains no token char
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1147
2020-07-18 09:40:38 -04:00
Raymond Hill
f69231d2c2
Import translation work from https://crowdin.com/project/ublock 2020-07-18 07:59:43 -04:00
Raymond Hill
feabfe3793
Do let grow subframe dictionary grow unbound
Related discussion:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1652925

It's not clear the code here will fix the reported
issue, but I did identify that the subframe
dictionary of a very long-lived web page can
theoretically grow unbound.
2020-07-18 07:44:26 -04:00
Raymond Hill
3789259fc9
Consider an empty pattern with anchors to be dubious
Related issue:
- https://github.com/ryanbr/fanboy-adblock/issues/1384
2020-07-17 10:08:08 -04:00
Raymond Hill
d5dcf4e9b6
Fix improper handling of srcset in element picker
Regression from:
- 16727d68c8

The issue was causing the element picker to being
unable to select elements with no valid `srcset`
property.

Test case -- trying to select one of the embedded
frames in the following page would fail:
- http://raymondhill.net/ublock/tiles1.html
2020-07-13 11:46:38 -04:00
Raymond Hill
d49a9dce66
Fix spurious rejection of some AdGuard redirect filters
Lines in AdGuard filter lists have trailing `\r`
characters, and these caused the redirect engine
compile code to reject as invalid the redirect
token.

This is trivially fixed by trimming the raw option
strings before parsing it in the redirect engine.
2020-07-13 09:33:38 -04:00
Raymond Hill
ba0d4f8a38
Fix the reporting of invalid static extended filters in the logger
This is a regression caused by the re-factoring necessary
to support the new static filtering parser code.
2020-07-12 13:00:18 -04:00
Raymond Hill
2eec28520f
Fix improper rejecting fitlers with $all,~document options
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1134#issuecomment-657122472
2020-07-12 10:39:57 -04:00
Raymond Hill
fc84a30cce
Mind \b in regex-based filters when trying to extract token
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1145#issuecomment-657036902
2020-07-11 10:32:04 -04:00
Raymond Hill
e44a568278
Add CoreMirror's code-folding ability to list editor/viewer
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1134

CodeMirror's code folding reference:
- https://codemirror.net/doc/manual.html#addon_foldcode

This commit adds support for code-folding to the filter
list editor/viewer.

The following blocks of code are foldable by clicking the
corresponding marker in the gutter:

- !#if/#endif blocks
- !#include blocks

Addtionally, the following changes:

- The `!#include` line is now preserved when importing a
  sublist
- The `!#if` directives will be syntax-colored according
  to whether they evaluate to true or false on the current
  platform
- Double-clicking on a foldable line in the gutter will
  select the content of the foldable block
- Minor visual improvement to matching brackets
2020-07-10 08:01:39 -04:00
Raymond Hill
ebf7fb145e
Fine tune auto-completion for !#if directives
Auto-completion will work only for uBO's own
tokens, compatibility-related tokens[1] will not be
taken into account for auto-completion.

The reason is to not have the compatibility-related
tokens get in the way of auto-completion in order
to not inconvenience uBO's filter list maintainers.

[1] `adguard_ext_chromium`, `adguard_ext_firefox`,
    etc.
2020-07-09 08:09:51 -04:00
Raymond Hill
83c01fb352
Add syntax highlighting/auto-completion for preparsing directives
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1134

Invalid values for `!#if ...` will be highlighted as errors.

Auto completion is now supported for both the directives
themselves and the valid values for `!#if ...`.

For examples, when pressing ctrl-space:

- `!#e` will auto-complete to `!#endif`
- `!#i` will offer to choose between `!#if ` or `!#include `
- `!#if fir` will auto-complete to `!#if env_firefox`

Additionally, support for some of AdGuard preparsing
directives, i.e. `!#if adguard` is now a valid and will be
honoured -- it always evaluate to `false` in uBO.
2020-07-08 09:52:27 -04:00
Raymond Hill
18a5f41a04
Better processing of Expires directive in filter list
In case of invalid `Expires` value -- i.e. `NaN` -- do
not use `1` as default value, just let uBO pick the
value according to the global default (which is `5` as
of commit time).
2020-07-06 08:31:53 -04:00
Raymond Hill
dc64cfbd97
Fix properly reporting invalid filter options
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1134

Specifically;

- `beacon`, `ping`, and `websocket` cannot be redirected;
- it's ok to not specify a type when redirecting to `empty`
  resource;
- `csp=` option can't be mixed with other types, redirec
  directives, and more `csp=` options.
2020-07-05 14:11:15 -04:00
Raymond Hill
cd1a3d22cd
Or just simplify by combining both conditions... 2020-07-05 09:17:06 -04:00
Raymond Hill
37f5b3d642
Minor code review re. element picker
Avoid potentially adding element twice to the
resultset.
2020-07-05 09:12:45 -04:00
Raymond Hill
16727d68c8
Fix parsing of srcset attribute in element picker
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1071

Additionally, match unconditionally against `srcset` attribute
when trying to find matching elements in the page. For example,
sometimes an img element may set both `src` and `srcset`
properties, they should not be deemed mutually exclusive.
2020-07-05 08:44:14 -04:00
Raymond Hill
a7bedb46a0
Add more types to other filter expression in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/584

`csp` and `doc` have been added to "other" filter expression
in the logger.
2020-07-04 15:14:08 -04:00
Raymond Hill
0da34f7edf
Handle properly Unicode characters in static network filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/772

Unicode characters inside hostname part of a filter will
be converted to punycode.

Unicode characters anywhere else in the pattern will be
percent-encoded.

Unicode characters which cannot be encoded will cause a
filter to be invalid.
2020-07-04 14:47:33 -04:00
Raymond Hill
a85a908f09
Compile scriptlet filters to their canonical, unaliased name
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1031
2020-07-04 11:02:31 -04:00
Raymond Hill
000886002d
Fix regression in reverse lookup of cosmetic filters
Related commit:
- d1715fb19f
2020-07-04 10:11:53 -04:00
Raymond Hill
d1715fb19f
Fix logger's reverse-lookup of selectors with no \w characters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1139
2020-07-03 14:32:12 -04:00
Raymond Hill
941898e54e
Fix highligthing of FQDN match in logger
Related feedback:
- https://github.com/uBlockOrigin/uAssets/issues/7619#issuecomment-653010310

Also fixed strict-blocking of URL using FQDN.
2020-07-03 14:28:03 -04:00
Raymond Hill
ab45466445
Fix bad extension name as a result of Crowdin mixup
Not sure how this happened.
2020-07-03 08:55:06 -04:00
Raymond Hill
3adb239443
Use "Trusted sites" instead of "Whitelist"
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1114

For now I picked "Trusted sites", unless someone comes up with
a better expression to refer to sites onwhich uBO is disabled.
2020-07-03 08:50:49 -04:00
Raymond Hill
aab3812089
Ignore !#include directives within inactive !#if/!#endif blocks
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1113
2020-07-03 08:43:40 -04:00
Raymond Hill
a6355cecea
Output built-in benchmark results regardless of consoleLogLevel 2020-07-02 12:39:40 -04:00
Raymond Hill
c6397e3d30
Fix handling of non-punycodable Unicode characters
Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1118#issuecomment-650730158
2020-06-28 08:28:29 -04:00
Raymond Hill
a08cdd721a
Fix edge case involving filter with a single wildcard
This fix the case of the following filter:

    trk*.vidible.tv

Not matching:

    https://trk.vidible.tv/trk/.vidible.tv

The wildcard is supposed to match any number of
characters, including zero characters. The issue
is that the code was not matching zero characters.

This is due to an incorrect comparison in
BidiTrieContainer.indexOf(), causing the code to
bail out before testing for the zero character
condition.
2020-06-27 07:58:46 -04:00
Raymond Hill
b4a06e9fe8
Import translation work from https://crowdin.com/project/ublock 2020-06-25 17:28:51 -04:00
Raymond Hill
db198b0904
Fix regression in pure hostname filters with wildcard
The regression broke filters of the form:

    ||trk*.vidible.tv^

The new parser will eventually interpret differently
wildcard characters when they are used in a manner
meant to represent only hostname-valid characters,
but this will come in a future version -- for now
the default meaning must be preserved until the
static network filtering engine is modified to
enforce the new interpretation.
2020-06-25 17:13:42 -04:00
Raymond Hill
ec4de80345
Revert "Reject downloaded lists which are deemed truncated"
This reverts commit de219dae26.
2020-06-21 13:31:13 -04:00
Raymond Hill
63f1b866e7
Import translation work from https://crowdin.com/project/ublock 2020-06-21 08:17:18 -04:00
Raymond Hill
86d28b57c3
Outright reject patterns with more than one space character
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1118

This is not a complete fix for the reported issue, but this
should catch many reported cases of invalid filters in the
wild.
2020-06-21 08:08:18 -04:00
Raymond Hill
de219dae26
Reject downloaded lists which are deemed truncated
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/hbpo86/

For unknown reasons at this point, it appears some users
end up with a truncated version of EasyList, leading to
improper blocking in uBO.

This commit adds a heuristic to discard a downloaded list
when its new size is more than 25% smaller than the
currently cached version.
2020-06-19 11:35:44 -04:00
Raymond Hill
5295bd2280
Import translation work from https://crowdin.com/project/ublock 2020-06-18 08:00:53 -04:00
Raymond Hill
3f9c5b9bc4
Fix regression in syntax highlighting
Specifically, fix trailing comments improperly
rendered as filter option.

Regression from:
- https://github.com/gorhill/uBlock/commit/6d8b310d9422#diff-fb99537d908d0afc8d76e7c98bbc9fea
2020-06-17 12:32:52 -04:00
Raymond Hill
bbf1cb22a0
Improve auto-completion heuristics
Related commit:
- 3e72a47c1f
2020-06-17 08:12:47 -04:00
Raymond Hill
001e1ea21e
Fix syntax-highlighting of regex-based filters
Regression from:
- https://github.com/gorhill/uBlock/commit/6d8b310d9422#diff-fb99537d908d0afc8d76e7c98bbc9fea
2020-06-16 18:56:26 -04:00
Raymond Hill
aa000e282e
Add auto-completion for procedural operators
Related commit:
- 3e72a47c1f
2020-06-16 08:59:55 -04:00
Raymond Hill
c9cfd62c21
Add auto-completion capability for filter options
Related commit:
- 3e72a47c1f

Use ctrl-space to auto-complete filter options and
`redirect=` resources in _"My filters"_ pane.
2020-06-15 19:05:39 -04:00
Raymond Hill
2a167586c6
Import translation work from https://crowdin.com/project/ublock 2020-06-15 09:22:41 -04:00
Raymond Hill
3e72a47c1f
Add support for auto-completion in _My filters_ pane
This commit adds CodeMirror's auto-completion capability
to the _My filters_ pane.

Currently, auto-completion is available for scriptlet
tokens: pressing ctrl-space while the text cursor is
positioned where a scriptlet token should appear will
cause auto-completion to kick-in. In case of ambiguity,
CodeMirror's widget to pick a specific scriptlet will
appear.
2020-06-15 09:15:13 -04:00
Raymond Hill
f8b0ee0fdc
Fix validation of redirect rules with empty resource
The `empty` resource is a special case, it does not
require a network type to be present to be valid.
2020-06-15 07:40:18 -04:00
Raymond Hill
cb5437b161
Support redirect rules with no pattern
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/977

No pattern will imply `*` for the redirect destination
part of the rule.
2020-06-14 15:09:35 -04:00
Raymond Hill
0e32e4391d
Add ability to comment out block of filters
Pressing Tab in _My filters_ will toggle the
commenting out of filters in the current
selection or current line if no selection.
2020-06-14 14:02:33 -04:00
Raymond Hill
6d8b310d94
Minor code review of static filtering parser
Rename `l` property to `len`, to avoid ambiguity as
`l` could mean _left_ or _length_. Typically `l` is
to be used for _left_ (whereas `r` is to be used for
_right_).

Additionally, add CodeMirror's bracket-matching and
bracket auto-closing to _My filters_ pane and and
bracket-matching to asset viewer page.
2020-06-14 12:05:42 -04:00
Raymond Hill
2523959f20
Better handling of separator errors in domain lists
Specifically, do not invalidate valid hostnames when
there are extraneous separators: that sort of error
will be visually highlighted but will not otherwise
prevent a filter from being properly enforced.
2020-06-13 17:04:42 -04:00
Raymond Hill
a211c2c95d
Convert selector compiler closured code into standalone class
This ensures proper garbage collection once the parser
is no longer referenced -- this is important now that
the parser is instantiated on-demand only.
2020-06-13 12:53:49 -04:00
Raymond Hill
0ec4c911dd
Fix improper handling of regex flags in search widget
Reported internally.

Potential regex flags are passed as is to RegExp contructor,
and in case of failure the query is deemed a plain text one.

Related commit:
- 8de67d22bd (diff-3f4aa453cefa49f6431f1bba3bb53a8e)
2020-06-13 11:13:48 -04:00
Raymond Hill
1a082e0581
Expand parser's ability to process static extended filtering
This commit moves some of the parsing logic of static
extended filtering into the static filtering parser; this
allows better syntax highlighting and creation-time
error-catching for cosmetic, HTML, and scriptlet filters.
2020-06-13 08:48:56 -04:00
Raymond Hill
681bd70116
Fix reverse lookup of generic cosmetic exception filters
Reported internally.
2020-06-11 07:18:45 -04:00
Raymond Hill
bfa6493abe
Import translation work from https://crowdin.com/project/ublock 2020-06-10 12:29:22 -04:00
Raymond Hill
6926030b68
Expand static parser to better detect invalid syntax
Specifically:

There can't be more than one `redirect` or `csp`
option.

There can be no type specified when there is a
`csp` option.

There must be one single network-related type when
there is a `redirect` option. Since `empty` and
`mp4` imply a `redirect` and a network-related
type, these can't be used along another `redirect`
or network-related type.

Related commit:
- 01b1ed9a98
2020-06-10 12:15:50 -04:00
Raymond Hill
d784fda98b
Fix matching of filters with trailing ^|
Related feedback:
- https://www.reddit.com/r/uBlockOrigin/comments/h08132/can_we_enable_javascript_on_the_homepage_but/ftkxvc5/

The right bound of the match needs to be incremented
when a trailing `^` matches a character.
2020-06-10 09:53:21 -04:00
Raymond Hill
bc7f149252
Minor code review of static parser code 2020-06-09 11:58:27 -04:00
Raymond Hill
08eca13364
Visually emphasize regex-based pattern
To help prevent mistakenly creating regex-based
patterns.
2020-06-08 12:39:31 -04:00
Raymond Hill
58c6baf0ba
Syntax highlight dubious patterns
Network filters with dubious patterns are discarded
by the static network filtering engine.
2020-06-08 08:53:29 -04:00
Raymond Hill
5752ad58b8
Code review of option iterator code
Related commit:
- 01b1ed9a98

Reuse returned item each time the iterator is
restarted.
2020-06-07 19:30:30 -04:00
Raymond Hill
41523d21db
Prepare static parser to better detect invalid filters
Additionally, syntax-color invalid regular expression.
2020-06-07 11:55:27 -04:00
Raymond Hill
7dc962281f
Set max token length on parser for consistent compilation
Reported internally. The issue could cause the logger
to be unable to successfully reverse-lookup a filter
list for a filter which had tokens longer than 6
characters followed by wildcard.

Regression from:
- 01b1ed9a98
2020-06-07 08:50:20 -04:00
Raymond Hill
f869348d1f
Fix string slice extraction from parser
Reported internally.

Regression from:
- 01b1ed9a98

The regression was made apparent be the fact that
AdGuard filter lists have lines ending with the
CR character.
2020-06-07 07:40:00 -04:00
Raymond Hill
0d1a532bfa
Disregard possible trailing carriage return characters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1101
2020-06-06 17:42:21 -04:00
Raymond Hill
b34e6da6ec
Split fetching settings/storage used in Settings pane
Computing storage-used figures can take longer than
usual sometimes when a lot of filter lists are enabled,
and this can cause the Settings pane to take longer to
be filled the first time it is opened. Fetching
settings and storage-used figures separately removes
that potential delay (they were fetched together in
a single Promise.all() call).
2020-06-06 08:45:24 -04:00