mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Removed memory leak
This commit is contained in:
parent
40d059311a
commit
70a16e55a6
Binary file not shown.
@ -37,6 +37,10 @@
|
||||
var oldBorder = this.style.border;
|
||||
this.style.border = "2px dashed red";
|
||||
var confirmText = "askForPermission";
|
||||
// try {throw new Error();}
|
||||
// catch (e){
|
||||
// console.log(e.stack.split(/\s*(?:-?>|@)\s*/));
|
||||
// }
|
||||
var allow = confirm(confirmText);
|
||||
this.style.border = oldBorder;
|
||||
if (allow){
|
||||
|
37
lib/main.js
37
lib/main.js
@ -55,7 +55,7 @@
|
||||
updateWhiteList();
|
||||
preferences.on("whiteList", function(){
|
||||
updateWhiteList();
|
||||
workers.forEach(checkWorker);
|
||||
// workers.forEach(checkWorker);
|
||||
});
|
||||
|
||||
var blackList;
|
||||
@ -65,23 +65,24 @@
|
||||
updateBlackList();
|
||||
preferences.on("blackList", function(){
|
||||
updateBlackList();
|
||||
workers.forEach(checkWorker);
|
||||
// workers.forEach(checkWorker);
|
||||
});
|
||||
|
||||
|
||||
preferences.on("blockMode", function(){
|
||||
workers.forEach(checkWorker);
|
||||
});preferences.on("allowPDFCanvas", function(){
|
||||
workers.forEach(checkWorker);
|
||||
});
|
||||
// preferences.on("blockMode", function(){
|
||||
// workers.forEach(checkWorker);
|
||||
// });
|
||||
// preferences.on("allowPDFCanvas", function(){
|
||||
// workers.forEach(checkWorker);
|
||||
// });
|
||||
|
||||
var workers = [];
|
||||
function detachWorker(worker, workerArray) {
|
||||
var index = workerArray.indexOf(worker);
|
||||
if (index != -1){
|
||||
workerArray.splice(index, 1);
|
||||
}
|
||||
}
|
||||
// var workers = [];
|
||||
// function detachWorker(worker, workerArray) {
|
||||
// var index = workerArray.indexOf(worker);
|
||||
// if (index !== -1){
|
||||
// workerArray.splice(index, 1);
|
||||
// }
|
||||
// }
|
||||
function checkWorker(worker){
|
||||
var url = new URL(worker.url);
|
||||
switch (prefs.blockMode){
|
||||
@ -141,10 +142,10 @@
|
||||
contentScriptFile: self.data.url("inject.js"),
|
||||
onAttach: function(worker){
|
||||
|
||||
workers.push(worker);
|
||||
worker.on("detach", function(){
|
||||
detachWorker(this, workers);
|
||||
});
|
||||
// workers.push(worker);
|
||||
// worker.on("detach", function(){
|
||||
// detachWorker(this, workers);
|
||||
// });
|
||||
worker.port.on("isPDF", function(blocking){
|
||||
if (prefs.allowPDFCanvas){
|
||||
worker.port.emit("unblock");
|
||||
|
Loading…
x
Reference in New Issue
Block a user