mirror of https://github.com/gorhill/uBlock.git
Fix nowoif decoy
Related issue: - https://github[.]com/uBlockOrigin/uAssets/issues/6019
This commit is contained in:
parent
8dd500357d
commit
94650e260e
|
@ -40,7 +40,7 @@
|
||||||
targetResult = false;
|
targetResult = false;
|
||||||
pattern = pattern.slice(1);
|
pattern = pattern.slice(1);
|
||||||
}
|
}
|
||||||
autoRemoveAfter = parseInt(arg2);
|
autoRemoveAfter = parseInt(arg2, 10);
|
||||||
if ( isNaN(autoRemoveAfter) ) {
|
if ( isNaN(autoRemoveAfter) ) {
|
||||||
autoRemoveAfter = -1;
|
autoRemoveAfter = -1;
|
||||||
}
|
}
|
||||||
|
@ -66,17 +66,18 @@
|
||||||
return target.apply(thisArg, args);
|
return target.apply(thisArg, args);
|
||||||
}
|
}
|
||||||
if ( autoRemoveAfter < 0 ) { return null; }
|
if ( autoRemoveAfter < 0 ) { return null; }
|
||||||
const iframe = document.createElement('iframe');
|
const decoy = document.createElement('object');
|
||||||
iframe.src = url;
|
decoy.data = url;
|
||||||
iframe.style.setProperty('display','none', 'important');
|
decoy.style.setProperty('height','1px', 'important');
|
||||||
iframe.style.setProperty('height','1px', 'important');
|
decoy.style.setProperty('position','fixed', 'important');
|
||||||
iframe.style.setProperty('width','1px', 'important');
|
decoy.style.setProperty('top','-1px', 'important');
|
||||||
document.body.appendChild(iframe);
|
decoy.style.setProperty('width','1px', 'important');
|
||||||
setTimeout(( ) => iframe.remove(), autoRemoveAfter * 1000);
|
document.body.appendChild(decoy);
|
||||||
if ( arg3 === '' ) { return iframe.contentWindow; }
|
setTimeout(( ) => decoy.remove(), autoRemoveAfter * 1000);
|
||||||
return new Proxy(iframe.contentWindow, {
|
return new Proxy(decoy.contentWindow || decoy , {
|
||||||
get: function(target, prop) {
|
get: function(target, prop) {
|
||||||
log('window.open / get', prop, '===', target[prop]);
|
log('window.open / get', prop, '===', target[prop]);
|
||||||
|
if ( prop === 'closed' ) { return false; }
|
||||||
return target[prop];
|
return target[prop];
|
||||||
},
|
},
|
||||||
set: function(target, prop, value) {
|
set: function(target, prop, value) {
|
||||||
|
|
Loading…
Reference in New Issue