SafariConverterLib
SafariConverterLib copied to clipboard
CSS or exception rules does not work on `dood.wf`
It's related to https://github.com/AdguardTeam/AdguardFilters/issues/128326. The problem is seen in AdGuard for iOS / Safari.
There is anti-adblock script that check the elements and If the check fails, you will also get an ad-blocking message.
The rules below should work on Safari (Mac or iOS), but they do not.
There is hab function that returns true even when adding one of these types of rules.
CSS rule:
dood.wf#$#.ad.doubleclick.google-ad.adsbox.pub_300x250.pub_300x250m.pub_728x90.text-ad.textAd.text_ad.text_ads.text-ads.skyscraper.text-ad-links { display: block !important; }
Exceptions:
dood.wf#@#.ad
dood.wf#@#.doubleclick
dood.wf#@#.google-ad
dood.wf#@#.adsbox
dood.wf#@#.pub_300x250
dood.wf#@#.pub_300x250m
dood.wf#@#.pub_728x90
dood.wf#@#.text-ad
dood.wf#@#.textAd
dood.wf#@#.text_ad
dood.wf#@#.text_ads
dood.wf#@#.text-ads
dood.wf#@#.skyscraper
dood.wf#@#.text-ad-links
To reproduce this:
add an exception below
dood.wf,dood.la,dood.pm,dood.so,dood.to,dood.watch,dood.ws#@%#//scriptlet("abort-current-inline-script", "document.getElementsByClassName", "allow adblock") and one of the type of the rules above.
This is a normal behaviour on Chrome via AdGuard for Chrome (the same with AdGuard for Mac / Windows).
Screenshot:

According to @AdamWr research, it can be happened on any site.
@AdamWr could you please check if the issue is still there with the new AG for iOS?
Test page from the issue does not work, so I created a new one (I hope that it's similar to original one) and it looks like that unfortunately the problem still occurs (version 4.5.11 (1034)).
Link - https://jsfiddle.net/d2x4zfo3/1/
Code:
In case if it will be removed again:
<div class="ad doubleclick google-ad adsbox pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads skyscraper text-ad-links" style="display: block !important; width: 10px !important; height: 10px !important;">TEST</div>
<hr></hr>
<script>
const elString = '<div class="ad doubleclick google-ad adsbox pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads skyscraper text-ad-links" style="display: block !important; width: 10px !important; height: 10px !important;">TEST2</div>';
const div = document.createElement('div');
div.innerHTML = elString;
document.body.appendChild(div);
</script>
Steps to reproduce
- Add to user rules:
##.google-ad
- Go to - https://jsfiddle.net/d2x4zfo3/1/
There should be TEST and TEST2 displayed.
Screenshot
In Base filter we have a rule like:
#$#.pub_728x90.text-ad.textAd.text_ad.text_ads.text-ads.text-ad-links { display: block !important; }
but the problem is that ##.google-ad has higher priority in iOS app/Safari extension, so element is still hidden.
Oh, now it makes sense.
The issue may in theory be fixed if we switch to using browser.scripting.insertCSS in WebExtension as per this task: https://github.com/AdguardTeam/SafariConverterLib/issues/98
But we'll need to re-test it again.