Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement cosmetic filtering #47

Merged
merged 36 commits into from
Nov 22, 2019
Merged

Implement cosmetic filtering #47

merged 36 commits into from
Nov 22, 2019

Commits on Nov 18, 2019

  1. add module for cosmetic filters

    add CosmeticFilter fields
    
    add cosmetic mask fields
    antonok-edm committed Nov 18, 2019
    Configuration menu
    Copy the full SHA
    90824c1 View commit details
    Browse the repository at this point in the history
  2. cosmetic filter rule parsing implementation

    add tests for parsing cosmetic rules with simple selectors
    
    implement is_simple_*selector methods
    
    Finish cosmetic filter parsing implementation
    
    The only thing missing from here is CSS rule validation. Generally, a
    DOM is used for that purpose in Javascript-based implementations.
    antonok-edm committed Nov 18, 2019
    Configuration menu
    Copy the full SHA
    462534c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    73afe91 View commit details
    Browse the repository at this point in the history
  4. break entity/hostname parsing into separate function

    break rule parsing after '#' separator into separate function
    
    remove support for `script:inject()`
    
    It appears that `script:inject()` is no longer in use; the newer `+js()`
    syntax is preferred.
    
    Ref: https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#scriptlet-injection
    antonok-edm committed Nov 18, 2019
    Configuration menu
    Copy the full SHA
    85c2b03 View commit details
    Browse the repository at this point in the history
  5. add framework for CSS parsing error checking

    reduce code duplication in tests
    
    add tests for hostname parsing
    
    add tests for href selectors
    
    The Cliqz implementation does not flag `href$=` selectors, so I've left
    those unflagged as well.
    
    add tests for entities
    
    as well as fixes for associated logical errors
    
    add tests for injected scripts
    
    add style specifier tests
    
    add tests for unicode and unsupported syntax
    
    disallow unhide and script inject rules without hostname constraints
    
    prevent generic style rules
    
    prohibit double-negated cosmetic filters
    
    remove href flag from cosmetic filters
    antonok-edm committed Nov 18, 2019
    Configuration menu
    Copy the full SHA
    77c382a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e6160aa View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    91a0716 View commit details
    Browse the repository at this point in the history
  8. implement CSS selector validation

    Rather than pulling in an entire CSS styling library as a dependency,
    this ensures that the syntax of supplied CSS selectors is valid, without
    concern for the textual content of individual tokens. As new
    pseudo-selectors are added to the W3C spec, this implementation should
    still function as intended.
    
    add tests for bad CSS selector inputs
    
    protect against urls appearing in `:style()` filters
    
    See uBlockOrigin/uBlock-issues#668
    antonok-edm committed Nov 18, 2019
    Configuration menu
    Copy the full SHA
    00b74cf View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2019

  1. implement cosmetic filter matching

    add tests for matching util functions
    
    add tests for cosmetic filter matching
    
    use iterators instead of loops during matching
    
    document cosmetic filter rule matching functions
    
    rename hash lists in cosmetic filter matching function
    
    update matching algorithm for batch queries
    
    simplify test matching implementation
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    47129a1 View commit details
    Browse the repository at this point in the history
  2. rework id and class flags to be more similar to uBlock Origin

    add selector to key convertion tests
    
    Currently, `escaped_characters` and `escape_codes` fail because there is
    no handling for these at the moment.
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    f6b8fd0 View commit details
    Browse the repository at this point in the history
  3. implement escape sequence parsing

    add key to existing tests
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    df56646 View commit details
    Browse the repository at this point in the history
  4. add cosmetic filter cache

    store complex selector strings instead of entire rules
    
    add function to allow retrieving rules for new classes and ids
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    af4932e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7f513d5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    19d92ad View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    0bbcf32 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8ddcc70 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    018eec5 View commit details
    Browse the repository at this point in the history
  10. allow efficiently adding single rules with a lazy-evaluated base styl…

    …esheet
    
    harden CosmeticFilterCache thread safety across FFI
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    87d80bb View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    b4f0f39 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    c996a9f View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3db6ce5 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    1b973f6 View commit details
    Browse the repository at this point in the history
  15. initial implementation of hostname rule db

    add struct for keeping track of exceptions per-hostname
    
    add type for returning information specific to a hostname
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    6435fe1 View commit details
    Browse the repository at this point in the history
  16. rework cosmetic filter cache to support exceptions, styles, and scrip…

    …t injects
    
    tests for exceptions and base stylesheet
    
    fix hidden_generic_rule implementation
    
    add tests for hidden generic rules
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    a4b0ac7 View commit details
    Browse the repository at this point in the history
  17. finish exception storage implementation

    add tests for style and script inject exceptions
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    21ffb01 View commit details
    Browse the repository at this point in the history
  18. take exceptions into account for class and id stylesheets

    tests for class and id stylesheets with exceptions
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    301a8be View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    08a5498 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    f79b3a6 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    831bcd0 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    8431ad3 View commit details
    Browse the repository at this point in the history
  23. use a hashSet for misc generic selectors

    return a single injectable script instead of a Vec
    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    d306fcd View commit details
    Browse the repository at this point in the history
  24. add once_cell dependency

    antonok-edm committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    1946fad View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    9ced4b8 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    ce3448e View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    809a611 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    a2045a6 View commit details
    Browse the repository at this point in the history