1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00

Fix cases of illegal invocation with nowoif

This commit is contained in:
Raymond Hill 2020-08-15 10:31:48 -04:00
parent 7362d526fb
commit d39b6d058a
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -74,15 +74,20 @@
decoy.style.setProperty('width','1px', 'important');
document.body.appendChild(decoy);
setTimeout(( ) => decoy.remove(), autoRemoveAfter * 1000);
const noopFn = function(){};
return new Proxy(decoy.contentWindow || decoy , {
get: function(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) {
log('window.open / set', prop, '=', value);
target[prop] = value;
return Reflect.set(...arguments);
},
});
}