1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-04-18 08:08:28 +02:00

More flexible list checking

This commit is contained in:
kkapsner 2014-10-11 00:07:51 +02:00
parent 147a2893c4
commit 3c96a9e3f5

View File

@ -72,9 +72,8 @@
updateBlackList(); updateBlackList();
}); });
function checkWorker(worker){ function checkURL(url){
try { var url = new URL(url);
var url = new URL(worker.url);
var mode = "block"; var mode = "block";
switch (prefs.blockMode){ switch (prefs.blockMode){
case "blockEverything": case "blockEverything":
@ -124,6 +123,11 @@
default: default:
console.log("Unknown blocking mode. Default to block everything."); console.log("Unknown blocking mode. Default to block everything.");
} }
return mode;
}
function checkWorker(worker){
try {
var mode = checkURL(worker.url);
worker.port.emit(mode, false, prefs.askOnlyOnce); worker.port.emit(mode, false, prefs.askOnlyOnce);
} }
catch (e){ catch (e){