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

##x:has-text({) and ##x:has-text([) no support backslash #2316

Closed
8 tasks done
krystian3w opened this issue Oct 6, 2022 · 5 comments
Closed
8 tasks done

##x:has-text({) and ##x:has-text([) no support backslash #2316

krystian3w opened this issue Oct 6, 2022 · 5 comments

Comments

@krystian3w
Copy link

krystian3w commented Oct 6, 2022

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is not a support issue or a question. For any support, questions or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

I detected one uBo Annoyances filter no longer works in uBo dev 1.44.5b12: https://github.com/uBlockOrigin/uAssets/blob/7246847cc17438dc7a2ad5c494667574f5627daf/filters/annoyances.txt#L4483

world4.eu##style:has-text(body:after{content:):remove()

A specific URL where the issue occurs.

N/A - filter can by outdated

Steps to Reproduce

  1. open uBo Annoyances preview
  2. found line world4.eu##style:has-text(body:after{content:):remove()
  3. line is reddish

Expected behavior

Support backslash instead rewrite to to regex: /body:after\{content:/

IMO no need improve gorhill/uBlock@a71b71e - I mean support legacy version without edit filter file.

Actual behavior

Filter marked as invalid and no remove "node".

uBO version

1.44.5b12

Browser name and version

Firefox 106b8

Operating System and version

Windows 10

@gorhill
Copy link
Member

gorhill commented Oct 6, 2022

Use quotes when there are characters tripping the parser:

world4.eu##style:has-text("body:after{content:"):remove()

@krystian3w
Copy link
Author

OK, maybe someone remember create PR with second line after stable CSSTree Parser.

@gorhill
Copy link
Member

gorhill commented Oct 6, 2022

This works too to prevent the parser from tripping:

##style:has-text(body\:after\{content\:):remove()

However uBO would have to remove the backslashes. Currently in 1.44.4 it does it only for parentheses ( and ).

@gorhill
Copy link
Member

gorhill commented Oct 6, 2022

I mean support legacy version without edit filter file

It's just not possible, the parser refuses to parse when it encounters weird characters sequences sometimes found in has-text or xpath -- it's not the parser's fault, it works according to CSS parsing specs. The real issue is technical debt from how this was implemented in uBO. In the big picture, there is only a handful of filters affected, which filters could very well be obsolete, and if not the simple fix is to use quotes. Throwing more code to avoid this is just not realistic, the best move is to not keep carrying on the technical debt.

@krystian3w krystian3w closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2022
@krystian3w
Copy link
Author

krystian3w referenced this issue in uBlockOrigin/uAssets Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants