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

Adblock.dll is not processing "$document" rules correctly. #17

Open
rjjiii opened this issue Jun 10, 2022 · 0 comments
Open

Adblock.dll is not processing "$document" rules correctly. #17

rjjiii opened this issue Jun 10, 2022 · 0 comments

Comments

@rjjiii
Copy link

rjjiii commented Jun 10, 2022

The $document rule for K-Meleon's adblock.dll doesn't work. If an adblock exception ends in "$document" then the adblocker should ignore all rules on the page. For example on this page:

https://canyoublockit.com/advanced-adblocker-test/web-banners/

I set a single rule in my adblockt.txt:
amazon

Expected result: block Amazon ads
Actual result: block Amazon ads

Then I put an exception for that same rule in adblock.txt:

amazon
@@amazon

Expected result: allow Amazon ads
Actual result: allow Amazon ads

And then I tried to use an exception to allow all everything from that site via adblock.txt

amazon
@@||canyoublockit.com^$document

Expected result: allow Amazon ads
Actual result: block Amazon ads

I can see the code in adblock.dll in adblock.cpp that handles exceptions. It has 2 sections that work to disable it for internal "chrome" pages and to disable it when its pref is set to disabled. There's a third section for the $document rule, the one with TYPE_DOCUMENT. I don't understand the language or the engine enough to trouble shoot the issue further:

	*_retval = nsIContentPolicy::ACCEPT;
	if (!aContext || aContentType == Policy::TYPE_DOCUMENT)
		return NS_OK;
	
	if (IsInWhiteList(aContentLocation))
		return NS_OK;

	if (rules.disabled())
		return NS_OK;
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

1 participant