Adguardforsafari: Some JS and CSS (with advanced blocking extension) rules don't work

Created on 20 Mar 2019  路  12Comments  路  Source: AdguardTeam/AdGuardForSafari

In new build for Safari such rules don't work:

  • linkshrink.net:
    linkshrink.net#%#AG_onLoad(function() { setTimeout(function() {var click = document.getElementById("btd"); link = click.onclick.toString().split(";");var link2 = link[0].split(")"); var link3 = link2[1].split("("); document.location.href = revC(link3[2]); }, 300); });
    linkshrink.net#$##pause {display: none!important;}
    linkshrink.net#$##skip {display: block!important;}

  • lordfilms.tv
    lordfilms.tv#$#.wrap:has(> div) { margin-top: 0!important; }

  • mel.fm
    mel.fm#$#.b-pb-frontpage__240x400-banner { position: absolute!important; left: -3000px!important; }

  • filmitorrent.xyz
    filmitorrent.xyz#$#body { background: #000000!important; }
    filmitorrent.xyz#$#.content { margin-top: 0!important; }

  • 7days.ru
    7days.ru#%#AG_abortOnPropertyWrite('window.__AABStatus', true);

Bug High

All 12 comments

Could you check apkmirror too, please?
#%#Object.defineProperty(window, 'ranTwice', {set: function(){ throw new Error(); }});
looks like it doesn't work.

PS:
1.3.0 beta with Advanced enabled.

@Mizzick I moved this task back to in-progress

@superlex
#%#Object.defineProperty(window, 'ranTwice', {set: function(){ throw new Error(); }});
works fine on my side

@Mizzick
Does it work always?
Try reloading the page a couple of times: on my side, it stops working and doesn't work anymore until you restart Safari.

@superlex
Do you have any errors in browser console?

@Mizzick

- WebSocket network error: The operation couldn鈥檛 be completed. Connection refused
- The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.
- SyntaxError: Can't create duplicate variable: 'applyScripts'

(+ some 404 errors) but they are present when script works too.
Then, if I disable AdGuard Base filter and I add the script
#%#Object.defineProperty(window, 'ranTwice', {set: function(){ throw new Error(); }});
to my user filter, it never works.

@Mizzick
#%#AG_abortOnPropertyWrite('ranTwice');
should work as well (it works with Firefox), but it doesn't.

@superlex Please explain the way you check it?

@Mizzick
Adding it to my user filter.
Steps to reproduce:
1) disable all lists and user rules;
2) enable EasyList, AdGuard Spyware and AdGuard Annoyances (AdGuard Annoyances will define AG_abortOnPropertyWrite according to https://filters.adtidy.org/extension/safari/filters/14.txt ) ;
3) Add to user list

||googleads.g.doubleclick.net^$domain=apkmirror.com,important
||pagead2.googlesyndication.com^$domain=apkmirror.com,important

4) Go to
https://www.apkmirror.com/apk/google-inc/youtube/youtube-14-15-53-release/youtube-14-15-53-android-apk-download/ : a counter will appear ;
5) Add
apkmirror.com#%#AG_abortOnPropertyWrite('ranTwice');
to user filter: the counter will not appear on FireFox, it will again appear on Safari.
6) remove
apkmirror.com#%#AG_abortOnPropertyWrite('ranTwice');
and add
apkmirror.com#%#Object.defineProperty(window, 'ranTwice', {set: function(){ throw new Error(); }});
: the counter will not appear on FireFox, but it will on Safari .

  • SyntaxError: Can't create duplicate variable: 'applyScripts'

@Mizzick I am also seeing this in the browser console

@superlex
Somehow ranTwice seems to be protected.
apkmirror.com#%#Object.defineProperty(window, 'ranTwiceTest', {set: function(){ throw new Error(); }}); works fine.

So I guess, in this case we should find different solution to block this counter.

Safari and Firefox could work a bit different, we don't claim equal behaviour.

Thank you for the explanation Mizzick ;)

Was this page helpful?
0 / 5 - 0 ratings