mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-18 17:02:27 +02:00
Fix cases of illegal invocation with nowoif
This commit is contained in:
parent
7362d526fb
commit
d39b6d058a
@ -74,15 +74,20 @@
|
|||||||
decoy.style.setProperty('width','1px', 'important');
|
decoy.style.setProperty('width','1px', 'important');
|
||||||
document.body.appendChild(decoy);
|
document.body.appendChild(decoy);
|
||||||
setTimeout(( ) => decoy.remove(), autoRemoveAfter * 1000);
|
setTimeout(( ) => decoy.remove(), autoRemoveAfter * 1000);
|
||||||
|
const noopFn = function(){};
|
||||||
return new Proxy(decoy.contentWindow || decoy , {
|
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; }
|
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);
|
||||||
target[prop] = value;
|
return Reflect.set(...arguments);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user