mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-05 18:32:30 +01:00
Detect/prevent the creation of already existing iframe tags
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/786 A case of web page embedding multiple times the `adsbygoogle.js` script was causing the neutered, replacement script to create a huge amount of iframes in the DOM. The scriptlet has been modified to check if an iframe tag already exist and skip the creation if so.
This commit is contained in:
parent
18b6a6ba18
commit
bdd4a5bf5a
@ -37,10 +37,12 @@
|
||||
const css = 'height:1px!important;max-height:1px!important;max-width:1px!important;width:1px!important;';
|
||||
for ( let i = 0; i < phs.length; i++ ) {
|
||||
const fr = document.createElement('iframe');
|
||||
fr.id = 'aswift_' + (i+1);
|
||||
const id = `aswift_${(i+1)}`;
|
||||
if ( document.querySelector(`iframe#${id}`) !== null ) { continue; }
|
||||
fr.id = id;
|
||||
fr.style = css;
|
||||
const cfr = document.createElement('iframe');
|
||||
cfr.id = 'google_ads_frame' + i;
|
||||
cfr.id = `google_ads_frame${i}`;
|
||||
fr.appendChild(cfr);
|
||||
document.body.appendChild(fr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user