Skip to content

Issue with googlesyndication-adsbygoogle #151

@AdamWr

Description

@AdamWr

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:

  1. 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
  1. 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

image

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]).

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions