1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-23 05:10:27 +01:00

Allow all "about:" sites

This commit is contained in:
kkapsner 2015-04-09 11:08:31 +02:00
parent 69e454bde6
commit 4bcdfb9fb7
2 changed files with 9 additions and 5 deletions

Binary file not shown.

View File

@ -241,6 +241,10 @@
// Communication with main.js // Communication with main.js
function checkAbout(){
return document.location.protocol === "about:");
}
function checkPDF(blocking){ function checkPDF(blocking){
if (document.contentType.match(/\/pdf$/i)){ if (document.contentType.match(/\/pdf$/i)){
self.port.emit("isPDF", blocking); self.port.emit("isPDF", blocking);
@ -250,32 +254,32 @@
} }
self.port.on("block", function(force){ self.port.on("block", function(force){
if (force || !checkPDF("block")){ if (force || !checkAbout() || !checkPDF("block")){
blockMode.getContext.status = "block"; blockMode.getContext.status = "block";
blockMode.readAPI.status = "allow"; blockMode.readAPI.status = "allow";
} }
}); });
self.port.on("ask", function(force, askOnce){ self.port.on("ask", function(force, askOnce){
if (force || !checkPDF("askVisible")){ if (force || !checkAbout() || !checkPDF("askVisible")){
blockMode.getContext.status = "ask"; blockMode.getContext.status = "ask";
blockMode.getContext.askStatus.askOnce = askOnce; blockMode.getContext.askStatus.askOnce = askOnce;
blockMode.readAPI.status = "allow"; blockMode.readAPI.status = "allow";
} }
}); });
self.port.on("blockReadout", function(force){ self.port.on("blockReadout", function(force){
if (force || !checkPDF("blockReadout")){ if (force || !checkAbout() || !checkPDF("blockReadout")){
blockMode.getContext.status = "allow"; blockMode.getContext.status = "allow";
blockMode.readAPI.status = "block"; blockMode.readAPI.status = "block";
} }
}); });
self.port.on("fakeReadout", function(force){ self.port.on("fakeReadout", function(force){
if (force || !checkPDF("fakeReadout")){ if (force || !checkAbout() || !checkPDF("fakeReadout")){
blockMode.getContext.status = "allow"; blockMode.getContext.status = "allow";
blockMode.readAPI.status = "fake"; blockMode.readAPI.status = "fake";
} }
}); });
self.port.on("askReadout", function(force, askOnce){ self.port.on("askReadout", function(force, askOnce){
if (force || !checkPDF("askReadout")){ if (force || !checkAbout() || !checkPDF("askReadout")){
blockMode.getContext.status = "allow"; blockMode.getContext.status = "allow";
blockMode.readAPI.status = "ask"; blockMode.readAPI.status = "ask";
blockMode.readAPI.askStatus.askOnce = askOnce; blockMode.readAPI.askStatus.askOnce = askOnce;