mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Made checkStack available during interception.
This commit is contained in:
parent
d122f90655
commit
e4c65d415e
3 changed files with 27 additions and 11 deletions
19
lib/check.js
19
lib/check.js
|
@ -13,8 +13,7 @@
|
|||
const {URL} = require("sdk/url");
|
||||
|
||||
exports.check = function check({url, errorStack}){
|
||||
var callingStack = parseErrorStack(errorStack);
|
||||
var match = checkBoth(callingStack, url, prefs.blockMode).match(/^(block|allow|fake|ask)(|Readout|Everything|Context|Input)$/);
|
||||
var match = checkBoth(errorStack, url, prefs.blockMode).match(/^(block|allow|fake|ask)(|Readout|Everything|Context|Input|Internal)$/);
|
||||
if (match){
|
||||
return {
|
||||
type: (match[2] === "Everything" || match[2] === "")?
|
||||
|
@ -32,8 +31,8 @@
|
|||
|
||||
};
|
||||
|
||||
function checkBoth(stack, url, blockMode){
|
||||
if (prefs.enableStackList && checkStack(stack)){
|
||||
function checkBoth(errorStack, url, blockMode){
|
||||
if (prefs.enableStackList && errorStack && checkStack(errorStack)){
|
||||
return "allow";
|
||||
}
|
||||
else {
|
||||
|
@ -42,15 +41,15 @@
|
|||
}
|
||||
|
||||
function checkURL(url, blockMode){
|
||||
url = new URL(url);
|
||||
url = new URL(url || "about:blank");
|
||||
switch (url.protocol){
|
||||
case "about:":
|
||||
if (url.href === "about:blank"){
|
||||
break;
|
||||
}
|
||||
return "allow";
|
||||
return "allowInternal";
|
||||
case "chrome:":
|
||||
return "allow";
|
||||
return "allowInternal";
|
||||
}
|
||||
|
||||
var mode = "block";
|
||||
|
@ -93,7 +92,9 @@
|
|||
return mode;
|
||||
}
|
||||
|
||||
function checkStack(stack){
|
||||
return lists.get("stack").match(stack);
|
||||
function checkStack(errorStack){
|
||||
var callingStack = parseErrorStack(errorStack);
|
||||
return lists.get("stack").match(callingStack);
|
||||
}
|
||||
exports.checkStack = checkStack;
|
||||
}());
|
Loading…
Add table
Add a link
Reference in a new issue