mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
parent
d6916b013e
commit
2c5b00a55d
@ -52,7 +52,7 @@
|
||||
logging.message("check url %s for block mode %s", url, blockMode);
|
||||
switch (url.protocol){
|
||||
case "about:":
|
||||
if (url.href === "about:blank"){
|
||||
if (url.pathname === "blank"){
|
||||
logging.message("use regular mode on about:blank");
|
||||
break;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ Version 1.10:
|
||||
-
|
||||
|
||||
fixes:
|
||||
-
|
||||
- always protect about:blank
|
||||
|
||||
known issues:
|
||||
- if a data URL is blocked the page action button does not appear
|
||||
|
@ -86,9 +86,28 @@ const iframeAPI = function(){
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "window.open",
|
||||
name: "removed iframe",
|
||||
prepare: async function openWindow(){
|
||||
const newWindow = window.open("/");
|
||||
const iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
const iframeWindow = iframe.contentWindow;
|
||||
document.body.removeChild(iframe);
|
||||
console.log("window of iframe directly after removing", iframeWindow);
|
||||
return new Promise(function(resolve){
|
||||
window.setTimeout(function(){
|
||||
console.log("window of iframe in timeout", iframeWindow);
|
||||
resolve(iframeWindow);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
["/", "about:blank", "about:blank#"].forEach(function(url){
|
||||
methods.push({
|
||||
name: "window.open " + url,
|
||||
prepare: async function openWindow(){
|
||||
const newWindow = window.open(url);
|
||||
if (newWindow){
|
||||
return {
|
||||
window: newWindow,
|
||||
@ -106,11 +125,12 @@ const iframeAPI = function(){
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
});
|
||||
});
|
||||
|
||||
function getPerformer(callback){
|
||||
return async function perform(method){
|
||||
console.log("run iframe method", method.name);
|
||||
const api = await method.prepare();
|
||||
callback(api.window, method.name);
|
||||
api.cleanup();
|
||||
|
Loading…
x
Reference in New Issue
Block a user