1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +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:
kkapsner 2015-04-22 11:55:31 +02:00
parent 30407e71a0
commit af47ee8d87
4 changed files with 17 additions and 15 deletions

Binary file not shown.

View File

@ -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
* 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/. */
@ -225,7 +225,7 @@
unsafeWindow,
changedFunction.exportOptions
): undef;
case "block":
//case "block":
default:
return undef;
}
@ -265,7 +265,7 @@
switch (mode){
case "block":
blockMode.getContext.status = "block";
blockMode.readAPI.status = "allow";
blockMode.readAPI.status = "block";
break;
case "ask":
blockMode.getContext.status = "ask";

View File

@ -14,7 +14,6 @@
var URL = require("sdk/url").URL;
var _ = require("sdk/l10n").get;
var tabUtils = require("sdk/tabs/utils");
var windowUtils = require("sdk/window/utils");
var sharedFunctions = require("./sharedFunctions.js");
var getDomainRegExpList = sharedFunctions.getDomainRegExpList;
@ -58,7 +57,7 @@
function checkWorker(worker){
try {
var mode;
var url = new URL(worker.url)
var url = new URL(worker.url);
if (
(url.protocol === "about:") ||
(prefs.allowPDFCanvas && worker.tab.contentType.match(/\/pdf$/i))
@ -66,7 +65,7 @@
mode = "unblock";
}
else {
var mode = checkURL(url);
mode = checkURL(url);
}
worker.port.emit(mode, prefs.askOnlyOnce);
}
@ -127,12 +126,6 @@
// display notifications
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){
case "fake":
@ -181,11 +174,11 @@
}
];
let priority = notifyBox.PRIORITY_WARNING_MEDIUM;
var priority = notifyBox.PRIORITY_WARNING_MEDIUM;
notifyBox.appendNotification(
message,
'fake-readout',
'chrome://browser/skin/Info.png',
"fake-readout",
"chrome://browser/skin/Info.png",
priority,
buttons
);

View File

@ -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){
"use strict";
var list = domainList
.split(",")
.map(function(entry){
@ -38,6 +45,8 @@ function getDomainRegExpList(domainList){
}
function checkURL(url, blockMode, whiteList, blackList){
"use strict";
var mode = "block";
switch (blockMode){
case "blockEverything":