mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Added logging lib with setting to control log level.
This commit is contained in:
parent
65ad3a5814
commit
9715eb09d2
13 changed files with 299 additions and 108 deletions
|
@ -20,6 +20,7 @@
|
|||
const prefs = preferences.prefs;
|
||||
const {parseErrorStack} = require("./callingStack");
|
||||
const {URL} = require("sdk/url");
|
||||
const logging = require("./logging");
|
||||
|
||||
scope.check = function check({url, errorStack}){
|
||||
var match = checkBoth(errorStack, url, prefs.blockMode).match(/^(block|allow|fake|ask)(|Readout|Everything|Context|Input|Internal)$/);
|
||||
|
@ -50,14 +51,18 @@
|
|||
}
|
||||
|
||||
function checkURL(url, blockMode){
|
||||
logging.message("check url %s for block mode %s", url, blockMode);
|
||||
url = new URL(url || "about:blank");
|
||||
switch (url.protocol){
|
||||
case "about:":
|
||||
if (url.href === "about:blank"){
|
||||
logging.message("use regular mode on about:blank");
|
||||
break;
|
||||
}
|
||||
logging.message("allow internal URLs");
|
||||
return "allowInternal";
|
||||
case "chrome:":
|
||||
logging.message("allow internal URLs");
|
||||
return "allowInternal";
|
||||
}
|
||||
|
||||
|
@ -96,7 +101,7 @@
|
|||
mode = "allow";
|
||||
break;
|
||||
default:
|
||||
// console.log("Unknown blocking mode (" + blockMode + "). Default to block everything.");
|
||||
logging.warning("Unknown blocking mode (" + blockMode + "). Default to block everything.");
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue