Commit graph

139 commits

Author SHA1 Message Date
Raymond Hill
93f80eedfa
Refactor runtime storage of specific cosmetic filters
This was a TODO item:
- 07cbae66a4/src/js/cosmetic-filtering.js (L375)

µBlock.staticExtFilteringEngine.HostnameBasedDB has been
re-factored to accomodate the storing of specific cosmetic
filters.

As a result of this refactoring:

- Memory usage has been further decreased
- Performance of selector retrieval marginally
  improved
- New internal representation opens the door
  to use a specialized version of HNTrie, which
  should further improve performance/memory
  usage
2019-05-14 08:52:34 -04:00
Raymond Hill
1e40f50eb3
Add benchmark method to cosmetic filtering engine
To measure retrieval of site-specific selectors. From
uBO's own dev console:

    µBlock.cosmeticFilteringEngine.benchmark();
2019-05-12 11:41:47 -04:00
Raymond Hill
f10b100379
Fix the handling of pseudoclass-based generic cosmetic filters
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/464

Regression from:
261ef8c510 (diff-3b15596213ed9ba37fb5b8bb1402a6c2R599)

Pseudoclass-based generic cosmetic filters were improperly seen
as invalid following the regression.
2019-04-21 07:49:44 -04:00
Raymond Hill
ed5d63df69
Grand refactoring of the logger
Performance-related work: the logger data has been decoupled
from the DOM -- inspired from CodeMirror's way of efficiently
handling large amout of text data.

This decoupling now makes the logger highly efficient CPU- and
memory-wise, and open the way to more possibilities.

Ability to configure some aspect of the logger behavior and
visuals:
- The hard-coded limit of 5000 entries has been
  removed and is now replaced with a variety of
  user-configurable settings to enforce the discarding of
  logger entries.
- Some columns in the logger output can now be hidden.

The filter list look-up feature has been merged into the
existing overlay dialog used to create URL rules or static
filters, as an entry in a new "Details" pane.

Other issues addressed during refactoring:
- https://github.com/uBlockOrigin/uBlock-issues/issues/280
- https://github.com/gorhill/uBlock/issues/1999

The minimum version supported on Firefox has been bumped
up to 55.0.
2019-01-12 16:36:20 -05:00
Raymond Hill
f35dff2c9d
Code review related to performance in main content script
- Avoid concatenating with empty array: though the concatenated
  array is empty, this still forces the creation of a whole new
  array as per semantic of Array.prototype.concat().
  <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat>

- Do not convert arrays to strings when sending data to
  main process in surveyPhase1(): I no longer see any benefit
  doing so in profiling data (if I recall properly this was
  benefiting Firefox, but I can't remember for sure anymore why
  I chose to do so back then).
2018-12-29 16:34:46 -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
261ef8c510
Add support for procedural :not to HTML filtering
Related issue: <https://github.com/gorhill/uBlock/issues/3683>

Additionally, improve compile-time error reporting in the logger
2018-12-15 10:46:17 -05:00
Raymond Hill
9b27a98f90
Fix https://github.com/gorhill/uBlock/issues/3654
Additionally, there has been refactoring work done regarding
filtering context used throughout uBO, motivated by the fix
here.
2018-12-13 12:30:54 -05:00
Raymond Hill
bf28a83e2d
code review re cd7b1c0eb4 2018-12-03 08:07:54 -05:00
Raymond Hill
cd7b1c0eb4
fix https://github.com/uBlockOrigin/uBlock-issues/issues/325 2018-12-02 21:41:28 -05:00
Raymond Hill
75d9cf3055
fix https://github.com/uBlockOrigin/uBlock-issues/issues/313 2018-11-26 12:02:32 -05:00
Raymond Hill
d5ddf837fa
fix a generic exception preventing a lowly-generic complex cosmetic filter from being applied 2018-09-09 13:15:43 -04:00
Raymond Hill
06fe7e6871
code review for static extended filtering, notably:
- use domain-derived integer hash to store filters

- remove code meant for firefox/legacy

- properly handle subdomains of entity-based filters
2018-09-09 08:10:09 -04:00
Raymond Hill
dcd98f4efa
fix load-time race condition for high-generic cosmetic filters
potentially causing high-generic cosmetic filters to not be applied
because the MRU cache contains an empty list of high-generic filters
when there is a query from a content script for cosmetic filters
before they are fully loaded and ready.
2018-07-16 09:30:36 -04:00
Raymond Hill
ab867dedf5
improve in-memory storage of specific cosmetic filters + more ES6
- collate together specific filters with same base domain
- replace string-based hash to integer-based hash
- revisit code to benefit from ES6-specific syntax
2018-05-31 10:41:03 -04:00
Raymond Hill
48426469de
code review of 5386558e68 2018-04-22 10:01:33 -04:00
Raymond Hill
5386558e68
fix https://www.reddit.com/r/uBlockOrigin/comments/8dkvqn/116_broken_loading_custom_filters_from_my_filters/ 2018-04-21 12:34:54 -04:00
Raymond Hill
c0387835fa
code review: modernize old code 2018-04-05 15:22:19 -04:00
Raymond Hill
ec56165d0d
new script:inject syntax, use only when next release is *very* widespread 2018-03-06 09:09:53 -05:00
Raymond Hill
51fc60223a
fix #3450 2018-01-20 09:10:23 -05:00
Raymond Hill
6219866b53
fix #3430 (regression) 2018-01-12 09:33: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
4f5f3652ed
code review re last commit b446f9f8bd 2017-12-22 11:56:27 -05:00
Raymond Hill
b446f9f8bd
fix regression reported in dec0b80a72 (commitcomment-26435928) by partially reverting changes from 4a09c9f866 2017-12-22 11:45:07 -05:00
Raymond Hill
607968de7f
code review: cache most-recently-used pre-filled scriptlets 2017-12-21 17:05:25 -05:00
Raymond Hill
4a09c9f866
improve slightly pre-parsing of ##script:... filters 2017-12-17 10:28:12 -05:00
Raymond Hill
dec0b80a72
fix #2877 2017-12-17 08:09:47 -05:00
gorhill
f71d3689a9
fix case 2 of #3199 2017-11-04 23:51:44 -04:00
gorhill
cbff97f8e7
code review: improve caching of high generics with exceptions 2017-10-29 13:58:46 -04:00
gorhill
d60edbfae1
code review last commit: oops 2017-10-26 06:23:57 -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
ed5dba432a
fix https://discourse.mozilla.org/t/support-ublock-origin/6746/606 2017-10-24 09:09:10 -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
8c33720d16
fix #3111 2017-10-08 23:47:23 -04:00
gorhill
49c19f2dcc
remove stray console.log used for development purpose 2017-10-06 13:47:39 -04:00
gorhill
c49ba60f0b
minor code review 2017-10-05 08:38:34 -04:00
gorhill
bd18fe3901
fix #2793: user-friendlier normalization 2017-10-04 13:20:43 -04:00
gorhill
ca299a394f
code review fix as per https://github.com/gorhill/uBlock/issues/2793#issuecomment-333269387 2017-09-30 10:18:41 -04:00
gorhill
8559669e89
fix #2755 2017-09-28 12:53:05 -04:00
gorhill
43512277c6
fix #2835 2017-07-31 17:03:09 -04:00
gorhill
f3e6057e07
fix #2598: refactor to address the cause rather than the symptoms 2017-05-25 17:46:59 -04:00
gorhill
be9d76f43d
fix #2624 2017-05-20 15:35:19 -04:00
gorhill
fcf43d972e
tentatively fix issue reported in #2612 re. FFox 24.8.1 2017-05-19 10:12:55 -04:00
gorhill
5f63398af8
fix regression reported at http://forums.mozillazine.org/viewtopic.php?p=14748380#p14748380 2017-05-17 17:40:55 -04:00
gorhill
0232382695
refactor static network filtering, add support for csp injection 2017-05-12 10:35:11 -04:00
gorhill
cf123b9264
fix #2448 2017-03-13 13:03:51 -04:00