mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
Code cleanup and removed blockAll bug
blockAll did not block readout-API. This could be relevant if a user changes the setting and an open tab still holds a reference to a canvas-context.
This commit is contained in:
parent
30407e71a0
commit
af47ee8d87
Binary file not shown.
@ -1,4 +1,4 @@
|
|||||||
/* global self, window, console, unsafeWindow, exportFunction, cloneInto */
|
/* global self, window, CanvasRenderingContext2D, WebGLRenderingContext, console, unsafeWindow, exportFunction, cloneInto, checkURL, getDomainRegExpList */
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
@ -225,7 +225,7 @@
|
|||||||
unsafeWindow,
|
unsafeWindow,
|
||||||
changedFunction.exportOptions
|
changedFunction.exportOptions
|
||||||
): undef;
|
): undef;
|
||||||
case "block":
|
//case "block":
|
||||||
default:
|
default:
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@
|
|||||||
switch (mode){
|
switch (mode){
|
||||||
case "block":
|
case "block":
|
||||||
blockMode.getContext.status = "block";
|
blockMode.getContext.status = "block";
|
||||||
blockMode.readAPI.status = "allow";
|
blockMode.readAPI.status = "block";
|
||||||
break;
|
break;
|
||||||
case "ask":
|
case "ask":
|
||||||
blockMode.getContext.status = "ask";
|
blockMode.getContext.status = "ask";
|
||||||
|
17
lib/main.js
17
lib/main.js
@ -14,7 +14,6 @@
|
|||||||
var URL = require("sdk/url").URL;
|
var URL = require("sdk/url").URL;
|
||||||
var _ = require("sdk/l10n").get;
|
var _ = require("sdk/l10n").get;
|
||||||
var tabUtils = require("sdk/tabs/utils");
|
var tabUtils = require("sdk/tabs/utils");
|
||||||
var windowUtils = require("sdk/window/utils");
|
|
||||||
|
|
||||||
var sharedFunctions = require("./sharedFunctions.js");
|
var sharedFunctions = require("./sharedFunctions.js");
|
||||||
var getDomainRegExpList = sharedFunctions.getDomainRegExpList;
|
var getDomainRegExpList = sharedFunctions.getDomainRegExpList;
|
||||||
@ -58,7 +57,7 @@
|
|||||||
function checkWorker(worker){
|
function checkWorker(worker){
|
||||||
try {
|
try {
|
||||||
var mode;
|
var mode;
|
||||||
var url = new URL(worker.url)
|
var url = new URL(worker.url);
|
||||||
if (
|
if (
|
||||||
(url.protocol === "about:") ||
|
(url.protocol === "about:") ||
|
||||||
(prefs.allowPDFCanvas && worker.tab.contentType.match(/\/pdf$/i))
|
(prefs.allowPDFCanvas && worker.tab.contentType.match(/\/pdf$/i))
|
||||||
@ -66,7 +65,7 @@
|
|||||||
mode = "unblock";
|
mode = "unblock";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var mode = checkURL(url);
|
mode = checkURL(url);
|
||||||
}
|
}
|
||||||
worker.port.emit(mode, prefs.askOnlyOnce);
|
worker.port.emit(mode, prefs.askOnlyOnce);
|
||||||
}
|
}
|
||||||
@ -127,12 +126,6 @@
|
|||||||
|
|
||||||
// display notifications
|
// display notifications
|
||||||
worker.port.on("accessed readAPI", function(status, callingStackMsg){
|
worker.port.on("accessed readAPI", function(status, callingStackMsg){
|
||||||
function log(title, object){
|
|
||||||
console.log(title);
|
|
||||||
for (var name in object){
|
|
||||||
console.log(name, object[name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (status){
|
switch (status){
|
||||||
case "fake":
|
case "fake":
|
||||||
|
|
||||||
@ -181,11 +174,11 @@
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
let priority = notifyBox.PRIORITY_WARNING_MEDIUM;
|
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
|
||||||
notifyBox.appendNotification(
|
notifyBox.appendNotification(
|
||||||
message,
|
message,
|
||||||
'fake-readout',
|
"fake-readout",
|
||||||
'chrome://browser/skin/Info.png',
|
"chrome://browser/skin/Info.png",
|
||||||
priority,
|
priority,
|
||||||
buttons
|
buttons
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
|
/* global console,exports */
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function getDomainRegExpList(domainList){
|
function getDomainRegExpList(domainList){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var list = domainList
|
var list = domainList
|
||||||
.split(",")
|
.split(",")
|
||||||
.map(function(entry){
|
.map(function(entry){
|
||||||
@ -38,6 +45,8 @@ function getDomainRegExpList(domainList){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkURL(url, blockMode, whiteList, blackList){
|
function checkURL(url, blockMode, whiteList, blackList){
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var mode = "block";
|
var mode = "block";
|
||||||
switch (blockMode){
|
switch (blockMode){
|
||||||
case "blockEverything":
|
case "blockEverything":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user