If node type of adElemChildNodes[0] or adElemChildNodes[1] is not an "Element", then tagName of it may returns undefined and in this case redirect=googlesyndication-adsbygoogle doesn't work correctly.
|
&& adElemChildNodes[0].tagName.toLowerCase() === 'iframe' |
|
&& adElemChildNodes[1].tagName.toLowerCase() === 'iframe' |
Steps to reproduce:
- Add these rules:
example.org#%#AG_onLoad(function() { var el = document.querySelector('p'); el.insertAdjacentHTML('beforeend', '<div></div>'); el.classList.add('adsbygoogle'); var s = document.createElement('script'); s.setAttribute('type', 'text/javascript'); s.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; document.getElementsByTagName('head')[0].appendChild(s); });
||pagead2.googlesyndication.com/pagead/js/adsbygoogle.js$redirect=googlesyndication-adsbygoogle,domain=example.org
- Go to - https://example.org/
$redirect=googlesyndication-adsbygoogle doesn't work correctly, because adElemChildNodes[0] is a "text node" and adElemChildNodes[0].tagName returns undefined.
Screenshot

I guess that it could be fixed by using nodeName instead of tagName or checking if adElemChildNodes[0].nodeType === 1 (the same for adElemChildNodes[1]).
If node type of
adElemChildNodes[0]oradElemChildNodes[1]is not an "Element", thentagNameof it may returnsundefinedand in this caseredirect=googlesyndication-adsbygoogledoesn't work correctly.Scriptlets/src/redirects/googlesyndication-adsbygoogle.js
Line 49 in 42f8439
Scriptlets/src/redirects/googlesyndication-adsbygoogle.js
Line 52 in 42f8439
Steps to reproduce:
$redirect=googlesyndication-adsbygoogledoesn't work correctly, becauseadElemChildNodes[0]is a "text node" andadElemChildNodes[0].tagNamereturnsundefined.Screenshot
I guess that it could be fixed by using
nodeNameinstead oftagNameor checking ifadElemChildNodes[0].nodeType === 1(the same foradElemChildNodes[1]).