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

remove-attr/remove-class regex/quoted syntax #364

Open
antonok-edm opened this issue May 16, 2024 · 3 comments
Open

remove-attr/remove-class regex/quoted syntax #364

antonok-edm opened this issue May 16, 2024 · 3 comments
Assignees
Labels
uBO-parity pending features that are already available in uBO

Comments

@antonok-edm
Copy link
Collaborator

Followup to 00b250e, which added support for :remove-attr and :remove-class but not the quoted or regex'd variants.

@antonok-edm antonok-edm added the uBO-parity pending features that are already available in uBO label May 16, 2024
@antonok-edm antonok-edm self-assigned this May 16, 2024
@thirumurugan-git
Copy link

Hi @antonok-edm ,

I’d like to contribute to resolving this issue. Could you please share your plans for addressing it?

As it stands, remove_classes and remove_attrs in UrlSpecificResources manage the removal of attributes and classes for specific URLs. These properties are hash maps where the key is a selector and the value is a vector of attributes or classes to be removed.

Is the issue related to parsing, or is it about setting the type (e.g., regex or quoted syntax) in the UrlSpecificResources object for the remove_attrs and remove_classes properties? Could you please elaborate?

Thank you!

@antonok-edm
Copy link
Collaborator Author

@thirumurugan-git hi, thanks for your interest!

One thing to note is that there are significant changes coming here from the next branch, which I expect to be merged within a week or so. That includes support for procedural filters, but also reworks how these filters are represented (i.e. remove_classes and remove_attrs are just going to be stored in a flat array of procedural filters, each distinguished by an "action" field).

Aside from that - I believe the parsing part should be fairly simple. IIRC, I've just skipped over any filters where the remove-attr or remove-class field starts with a /. I wasn't sure what the best way to represent these filters was at the time, but I think the simplest thing is to stop skipping them and pass the strings directly as-is to the in-page content script, which can detect them and operate accordingly.

adblock-rust is used by a couple of other projects which may have their own content script implementations, but if you're interested in making that work specifically in Brave Browser, the relevant code is located here.

@thirumurugan-git
Copy link

Hi @antonok-edm ,

Thank you for your prompt response. I believe this issue will be addressed in your next branch, as you have methods like forbid_regex_or_quoted_args to tackle it. If it isn’t resolved in the next branch, I am ready to fix it post-merge.

Could you share a good starting point for contributing to the adblocker? I plan to add support for AdGuard syntax, which is currently lacking in adblock-rust. Do you have any suggestions for this?

I understand that starting after the next branch merge might be more efficient due to the major modifications to the procedural filter. Do you think adding support for AdGuard syntax would be feasible without waiting for this merge?

Also, could you list the projects currently using this adblocker so I can code with those in mind?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
uBO-parity pending features that are already available in uBO
Projects
None yet
Development

No branches or pull requests

2 participants