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
18
lib/frame.js
18
lib/frame.js
@ -81,10 +81,6 @@
|
|||||||
|
|
||||||
var interceptedWindows = new WeakMap();
|
var interceptedWindows = new WeakMap();
|
||||||
function interceptWindow(window){
|
function interceptWindow(window){
|
||||||
if (!enabled || interceptedWindows.get(window)){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
}
|
}
|
||||||
@ -95,6 +91,10 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!enabled || interceptedWindows.get(getWrapped(window))){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
message("intercepting window", window);
|
message("intercepting window", window);
|
||||||
intercept(
|
intercept(
|
||||||
{subject: window},
|
{subject: window},
|
||||||
@ -112,7 +112,9 @@
|
|||||||
configureable: true,
|
configureable: true,
|
||||||
get: exportFunction(function(){
|
get: exportFunction(function(){
|
||||||
var window = oldContentWindowGetter.call(this);
|
var window = oldContentWindowGetter.call(this);
|
||||||
interceptWindow(window);
|
if (window){
|
||||||
|
interceptWindow(window);
|
||||||
|
}
|
||||||
return window;
|
return window;
|
||||||
}, window)
|
}, window)
|
||||||
}
|
}
|
||||||
@ -126,14 +128,16 @@
|
|||||||
configureable: true,
|
configureable: true,
|
||||||
get: exportFunction(function(){
|
get: exportFunction(function(){
|
||||||
var document = oldContentDocumentGetter.call(this);
|
var document = oldContentDocumentGetter.call(this);
|
||||||
interceptWindow(document.defaultView);
|
if (document){
|
||||||
|
interceptWindow(document.defaultView);
|
||||||
|
}
|
||||||
return document;
|
return document;
|
||||||
}, window)
|
}, window)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
interceptedWindows.set(window, true);
|
interceptedWindows.set(getWrapped(window), true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user