Commit graph

111 commits

Author SHA1 Message Date
Raymond Hill
bf99623a54
Add sanity checks
In rare circumstances, it's possible the content
script lose access to the background page, best
to check against this to avoid spurious console
errors.
2019-09-29 12:26:58 -04:00
Raymond Hill
917f3620e0
Revisit element picker arguments code
No need to store mouse coordinates in background
page, thus no need to post mouse coordinates
information for every click.

Rename/group element picker arguments and popup
arguments separately.
2019-09-18 12:17:45 -04:00
Raymond Hill
3224d9b5cc
Work toward modernizing code base: promisification
Swathes of code have been converted to use
Promises/async/await.

Related commits:
- 26235d80d0
- 0051f3b5c7
- eec53c0154
- 915687fddb
- 55cc0c6997
- e27328f931
2019-09-17 15:15:01 -04:00
Raymond Hill
c1bdc123f2
Fix use of sibling-related CSS syntax at prefix position
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/c6iem5/
2019-06-29 14:07:54 -04:00
Raymond Hill
8e7384ba84
Prevent duplicate inline-script entries in the logger
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/c4340z/filter_problem/ervpjd8/
2019-06-24 11:40:14 -04:00
Raymond Hill
41685f4cce
Replace exec with transpose in procedural filters
The purpose is to avoid having to iterate through
all input nodes at each operator implementation
level. The `transpose` method deals with only one
input node, and the iteration is performed by the
main procedural filtering entry points.

Additionally:
- Add `:spath` to HTML filtering
- Rename `:watch-attrs` to `:watch-attr`
  - `:watch=attrs` is deprecated and will be kept around
    until it is safe to remove it completely
2019-06-23 08:05:53 -04:00
Raymond Hill
b428a25c3f
Add new procedural operator: :min-text-length(x)
Where `x` is the minimal text length of the subject
DOM element. DOM elements whose text length is
greater than or equal to `x` will be selected.

The original rationale for such procedural cosmetic
operator[1] is to be able to remove inline script
elements according to a minimum text length using
HTML filtering.

[1] As a result of internal discussion with filter
    list maintainers @ uAssets.
2019-06-20 14:11:54 -04:00
Raymond Hill
1386429382
Fix regression in applying procedural cosmetic filters
Related commit:
- 3573b6b32c
2019-05-16 17:22:20 -04:00
Raymond Hill
3573b6b32c
Add ability to report exception cosmetic filters in the logger
Related issue:
- https://github.com/gorhill/uBlock/issues/127

Additionally, the extended exception filters in the
logger will be rendered with a line-through to more
easily distinguish them from non-exception ones.

Also, opportunistically converted revisited code to
ES6 syntax.
2019-05-16 13:44:49 -04:00
Raymond Hill
915c1f1f3c
Report resources blocked by csp= option in logger
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/552
2019-05-11 10:40:34 -04:00
Raymond Hill
73e2f25e95
Add new cosmetic procedural operator: :nth-ancestor(n)
The purpose of this new `:nth-ancestor(n)` operator is to
lookup the nth ancestor relative to the currently selected
node.

It is essentially equivalent to `:xpath(..)`, where
ancestor distance is expressed as a number rather than a
sequence of slash-separated `..`.

The rationale to introduce this new procedural selector
is to have a low overhead way to accomplish ancestor
selection.
2019-04-30 09:02:14 -04:00
Raymond Hill
15100459b3
Harden content script's message Port against spurious disconnections
Those spurious disconnections have been observed to occur at
uBO's launch time.

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/403

I have observed that this fixes an issue observed on Firefox 64
(current stable).

The reported Waterfox issue *may* be fixed as a result. If not,
the issue he still considered fixed as Waterfox is not
officially supported.
2019-01-27 17:07:40 -05:00
Raymond Hill
08261e3c15
Change DOM surveyor to time-based processing logic (from chunk-based)
The DOM surveyor will now use time-based logic to spread its work
over time. This allows the surveying to better scale down on
slower devices.

Additionally, the DOM surveyor code has been reworked to lower as
much as possible memory churning when collating nodes to survey.

This rework has been motivated after profiling the "monstrous DOM"
seen in the following page:
<https://doc.rust-lang.org/std/iter/trait.Iterator.html>

The idea is that making the DOM surveyor efficient on such
"monstrous DOM" case should make it efficient everywhere in
practice.
2018-12-31 11:50:40 -05:00
Raymond Hill
eb1428c8bb
Fix regression in the collapsing of blocked resources
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/356
2018-12-27 10:17:08 -05:00
Raymond Hill
8a88e9d931
Support CSS selectors mixed w/ operators in procedural cosmetic filters
Related issue:
- https://github.com/gorhill/uBlock/issues/3683

This commit further increases uBO's procedural cosmetic filters
Adguard's cosmetic filter syntax -- specifically those procedural
cosmetic filters where plain CSS selectors appeared following
a procedural oeprator (this was rejected as invalid by uBO).

Also, experimental support for `:watch-attrs` procedural
operator, as discussed in <https://github.com/uBlockOrigin/uBlock-issues/issues/341#issuecomment-449765525>.
Support may be dropped before next release depending on whether
a better solution is suggested.

Additionally, the usual opportunistic refactoring toward ES6
syntax.
2018-12-26 10:45:19 -05:00
Raymond Hill
d2a7ada0b0
fix https://github.com/uBlockOrigin/uBlock-issues/issues/341 2018-12-14 17:55:22 -05:00
Raymond Hill
8f05a2f8d3
fix https://github.com/uBlockOrigin/uBlock-issues/issues/341, and further work for https://github.com/gorhill/uBlock/issues/3683 2018-12-14 15:25:18 -05:00
Raymond Hill
3c85c03194
fix #308, #3436, https://github.com/uBlockOrigin/uBlock-issues/issues/155
<https://github.com/gorhill/uBlock/issues/3436>: a new per-site switch
has been added, no-scripting, which purpose is to wholly disable/enable
javascript for a given site. This new switch has precedence over all
other ways javascript can be disabled, including precedence over dynamic
filtering rules.

The popup panel will report the number of script resources which have
been seen by uBO for the current page. There is a minor inaccuracy to
be fixed regarding the count, and which fix requires to extend request
journaling.

<https://github.com/gorhill/uBlock/issues/308>: the `noscript` tags will
now be respected when the new no-scripting switch is in effect on a given
site.

A default setting has been added to the _Settings_ pane to
disable/enable globally the new no-script switch, such that one can
work in default-deny mode regarding javascript execution.

<https://github.com/uBlockOrigin/uBlock-issues/issues/155>: a new
hidden setting, `requestJournalProcessPeriod`, has been added to
allow controlling the delay before uBO internally process it's
network request journal queue. Default to 1000 (milliseconds).
2018-08-31 18:47:02 -04:00
Raymond Hill
4a57825411
code review: remove scriplet js text after injection (see https://github.com/uBlockOrigin/uBlock-issues/issues/53#issuecomment-394024828) 2018-06-01 18:41:27 -04:00
Raymond Hill
0c5e2eb7ee
code review for c5d8588118: mind about:blank et al. iframes 2018-05-20 06:49:12 -04:00
Raymond Hill
b4306e3297
code reivew of c5d8588118: immediate scriptlets injection works well only on Chromium-based browsers for now 2018-05-18 10:19:14 -04:00
Raymond Hill
04d84cf92a
fix #3397 2018-01-03 13:59:38 -05:00
Raymond Hill
ec29c9a127
fix #3382 2017-12-31 16:05:23 -05:00
Raymond Hill
17dfec5759
fix #3372 2017-12-30 18:55:01 -05:00
Raymond Hill
a9f68fe02f
Fix #3069, and consequently #3374, #3378.
A new filtering class has been created: "static extended filtering".
This new class is an umbrella class for more specialized filtering
engines:
- Cosmetic filtering
- Scriptlet filtering
- HTML filtering

HTML filtering is available only on platforms which support modifying
the response body on the fly, so only Firefox 57+ at the moment.

With the ability to modify the response body, HTML filtering has
been introduced: removing elements from the DOM before the source
data has been parsed by the browser.

A consequence of HTML filtering ability is to bring back script tag
filtering feature.
2017-12-28 13:49:02 -05:00
Raymond Hill
ca8917149d
fix #3341 2017-12-13 08:02:55 -05:00
gorhill
958a7c20ed
fix #3335 2017-12-10 15:03:03 -05:00
gorhill
374e157b11
fix #3159 2017-11-14 15:03:20 -05:00
gorhill
2db377f577
code review: lower timer delay = less risk of large backlog 2017-10-31 06:47:39 -04:00
gorhill
25e2452722
code review: use for..of instead of for(..;..;..) 2017-10-28 16:50:44 -04:00
gorhill
bbda2a9086
code review: preemptively address https://bugzilla.mozilla.org/show_bug.cgi?id=1408996#c9 2017-10-27 14:22:45 -04:00
gorhill
44ce44aa42
code review: early injection of lookred up generic cosmetic filters when possible 2017-10-26 06:18:03 -04:00
gorhill
6b65e3f406
code review: avoid reinjecting already injected low generic cosmetic filters 2017-10-25 11:42:18 -04:00
gorhill
9952e12aff
fine tune DOM surveyor 2017-10-24 16:38:51 -04:00
gorhill
2bea51cc63
fix silly regression regarding the DOM surveyor 2017-10-24 07:55:35 -04:00
gorhill
a76f5b15ac
fix https://github.com/gorhill/uBlock/issues/3160#issuecomment-338509997 2017-10-23 12:21:37 -04:00
gorhill
6e18829f02
add to #2984: fix regressions, as per feedback and code review 2017-10-23 09:01:00 -04:00
gorhill
4f7aab695c
fix #3160 2017-10-22 08:59:29 -04:00
gorhill
6112a68faf
fix #2984 2017-10-21 13:43:46 -04:00
gorhill
e7e390d2e2
fix #3077 2017-10-01 07:56:28 -04:00
gorhill
2660bee0d2
fix #2919 2017-09-05 19:49:48 -04:00
gorhill
c31d29c2e3
fix bad test: regression from fdcc9515 2017-08-24 17:54:27 -04:00
gorhill
63be43a365
shield content script against exceptions in injected scriptlets 2017-08-21 12:04:35 -04:00
gorhill
a1350b8cff
fix #2882 2017-08-17 09:54:01 -04:00
gorhill
fdcc9515dc
fix #2029 2017-08-17 08:25:02 -04:00
gorhill
d1c752da29
fix bad English in comment 2017-08-16 18:06:04 -04:00
gorhill
797082a36c
fix #2552 2017-08-16 14:10:41 -04:00
gorhill
eb3519b075
fix #2839 2017-08-03 10:18:05 -04:00
gorhill
0d892a8856
fix #2810 2017-07-23 09:56:43 -04:00
gorhill
d337abe504
minor code review 2017-06-22 14:36:45 -04:00