1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00

Revert latest changes

Related commit:
- d39b6d058a
- 94650e260e
This commit is contained in:
Raymond Hill 2020-08-16 06:03:34 -04:00
parent d39b6d058a
commit 6dca8969b0
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -40,7 +40,7 @@
targetResult = false; targetResult = false;
pattern = pattern.slice(1); pattern = pattern.slice(1);
} }
autoRemoveAfter = parseInt(arg2, 10); autoRemoveAfter = parseInt(arg2);
if ( isNaN(autoRemoveAfter) ) { if ( isNaN(autoRemoveAfter) ) {
autoRemoveAfter = -1; autoRemoveAfter = -1;
} }
@ -66,28 +66,22 @@
return target.apply(thisArg, args); return target.apply(thisArg, args);
} }
if ( autoRemoveAfter < 0 ) { return null; } if ( autoRemoveAfter < 0 ) { return null; }
const decoy = document.createElement('object'); const iframe = document.createElement('iframe');
decoy.data = url; iframe.src = url;
decoy.style.setProperty('height','1px', 'important'); iframe.style.setProperty('display','none', 'important');
decoy.style.setProperty('position','fixed', 'important'); iframe.style.setProperty('height','1px', 'important');
decoy.style.setProperty('top','-1px', 'important'); iframe.style.setProperty('width','1px', 'important');
decoy.style.setProperty('width','1px', 'important'); document.body.appendChild(iframe);
document.body.appendChild(decoy); setTimeout(( ) => iframe.remove(), autoRemoveAfter * 1000);
setTimeout(( ) => decoy.remove(), autoRemoveAfter * 1000); if ( arg3 === '' ) { return iframe.contentWindow; }
const noopFn = function(){}; 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];
const r = Reflect.get(...arguments);
if ( typeof r === 'function' ) {
return noopFn.bind(null);
}
return r;
}, },
set: function(target, prop, value) { set: function(target, prop, value) {
log('window.open / set', prop, '=', value); log('window.open / set', prop, '=', value);
return Reflect.set(...arguments); target[prop] = value;
}, },
}); });
} }