1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Changed library functions that may work in both types.

Added helper scripts for webExtension.
This commit is contained in:
kkapsner 2017-06-25 22:22:17 +02:00
parent 6c3b27e7e4
commit 4ea073132d
6 changed files with 190 additions and 97 deletions

View file

@ -6,13 +6,22 @@
(function(){
"use strict";
var scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
else {
window.scope.check = {};
scope = window.scope.check;
}
const lists = require("./lists");
const preferences = require("sdk/simple-prefs");
const prefs = preferences.prefs;
const {parseErrorStack} = require("./callingStack");
const {URL} = require("sdk/url");
exports.check = function check({url, errorStack}){
scope.check = function check({url, errorStack}){
var match = checkBoth(errorStack, url, prefs.blockMode).match(/^(block|allow|fake|ask)(|Readout|Everything|Context|Input|Internal)$/);
if (match){
return {
@ -96,5 +105,5 @@
var callingStack = parseErrorStack(errorStack);
return lists.get("stack").match(callingStack);
}
exports.checkStack = checkStack;
scope.checkStack = checkStack;
}());