Scriptlets
Scriptlets copied to clipboard
Improve `googlesyndication-adsbygoogle` — adsbygoogle.push
googlesyndication-adsbygoogle breaks game here - https://html5.gamedistribution.com/d4ac0ead7ff5403eb3aa6ab620b0b959/
Steps to reproduce:
- Add these rules:
html5.gamedistribution.com#@%#//scriptlet('prevent-element-src-loading', 'script','pagead2.googlesyndication.com')
||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$redirect=googlesyndication-adsbygoogle,domain=html5.gamedistribution.com
2, Go to - https://html5.gamedistribution.com/d4ac0ead7ff5403eb3aa6ab620b0b959/ 3. Click on a "Play" button
Game doesn't start.
If I understand correctly, the problem is with adsbygoogle.push function, here:
https://github.com/AdguardTeam/Scriptlets/blob/fdef488c1f529ce85f87d441eafbf0422b3d8336/src/redirects/googlesyndication-adsbygoogle.js#L35
it looks like that game doesn't start if argument in function is undefined and it throws error.
TypeError: Cannot read properties of undefined (reading 'breakStatus')
Screenshot


So, changing:
arg[key].call();
to for example:
arg[key].call(this, {});
should fixes it.