mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
Improved window intercepting.
This commit is contained in:
parent
68fb7730b9
commit
e686b14106
14
lib/frame.js
14
lib/frame.js
@ -81,10 +81,6 @@
|
||||
|
||||
var interceptedWindows = new WeakMap();
|
||||
function interceptWindow(window){
|
||||
if (!enabled || interceptedWindows.get(window)){
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
var href = window.location.href;
|
||||
}
|
||||
@ -95,6 +91,10 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!enabled || interceptedWindows.get(getWrapped(window))){
|
||||
return false;
|
||||
}
|
||||
|
||||
message("intercepting window", window);
|
||||
intercept(
|
||||
{subject: window},
|
||||
@ -112,7 +112,9 @@
|
||||
configureable: true,
|
||||
get: exportFunction(function(){
|
||||
var window = oldContentWindowGetter.call(this);
|
||||
if (window){
|
||||
interceptWindow(window);
|
||||
}
|
||||
return window;
|
||||
}, window)
|
||||
}
|
||||
@ -126,14 +128,16 @@
|
||||
configureable: true,
|
||||
get: exportFunction(function(){
|
||||
var document = oldContentDocumentGetter.call(this);
|
||||
if (document){
|
||||
interceptWindow(document.defaultView);
|
||||
}
|
||||
return document;
|
||||
}, window)
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
interceptedWindows.set(window, true);
|
||||
interceptedWindows.set(getWrapped(window), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user