mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-05 11:32:20 +01:00
Completely remove function monitoring for white listed sites.
Fixes #84.
This commit is contained in:
parent
bda00e5741
commit
fc07961c6b
@ -23,6 +23,7 @@
|
|||||||
exports.setRandomSupplyByType = setRandomSupplyByType;
|
exports.setRandomSupplyByType = setRandomSupplyByType;
|
||||||
exports.intercept = function intercept({subject: window}, {check, checkStack, ask, notify, prefs}){
|
exports.intercept = function intercept({subject: window}, {check, checkStack, ask, notify, prefs}){
|
||||||
var siteStatus = check({url: window.location.href});
|
var siteStatus = check({url: window.location.href});
|
||||||
|
if (siteStatus.mode !== "allow"){
|
||||||
apiNames.forEach(function(name){
|
apiNames.forEach(function(name){
|
||||||
var changedFunction = changedFunctions[name];
|
var changedFunction = changedFunctions[name];
|
||||||
var original = window.wrappedJSObject[changedFunction.object].prototype[name];
|
var original = window.wrappedJSObject[changedFunction.object].prototype[name];
|
||||||
@ -77,5 +78,6 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}());
|
}());
|
@ -94,6 +94,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
var status = Object.create(status);
|
||||||
status.active = false;
|
status.active = false;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@ -109,6 +110,7 @@
|
|||||||
},
|
},
|
||||||
toDataURL: {
|
toDataURL: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
if (hasType(status, "input")){
|
if (hasType(status, "input")){
|
||||||
var contextType = canvasContextType.get(obj);
|
var contextType = canvasContextType.get(obj);
|
||||||
status.active = contextType !== "2d";
|
status.active = contextType !== "2d";
|
||||||
@ -129,6 +131,7 @@
|
|||||||
},
|
},
|
||||||
toBlob: {
|
toBlob: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
if (hasType(status, "input")){
|
if (hasType(status, "input")){
|
||||||
var contextType = canvasContextType.get(obj);
|
var contextType = canvasContextType.get(obj);
|
||||||
status.active = contextType !== "2d";
|
status.active = contextType !== "2d";
|
||||||
@ -150,6 +153,7 @@
|
|||||||
},
|
},
|
||||||
mozGetAsFile: {
|
mozGetAsFile: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
if (hasType(status, "input")){
|
if (hasType(status, "input")){
|
||||||
var contextType = canvasContextType.get(obj);
|
var contextType = canvasContextType.get(obj);
|
||||||
status.active = contextType !== "2d";
|
status.active = contextType !== "2d";
|
||||||
@ -170,6 +174,7 @@
|
|||||||
},
|
},
|
||||||
getImageData: {
|
getImageData: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
if (hasType(status, "input")){
|
if (hasType(status, "input")){
|
||||||
var contextType = canvasContextType.get(obj);
|
var contextType = canvasContextType.get(obj);
|
||||||
status.active = contextType !== "2d";
|
status.active = contextType !== "2d";
|
||||||
@ -207,6 +212,7 @@
|
|||||||
},
|
},
|
||||||
fillText: {
|
fillText: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
status.active = hasType(status, "input");
|
status.active = hasType(status, "input");
|
||||||
return status;
|
return status;
|
||||||
},
|
},
|
||||||
@ -225,6 +231,7 @@
|
|||||||
},
|
},
|
||||||
strokeText: {
|
strokeText: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
status.active = hasType(status, "input");
|
status.active = hasType(status, "input");
|
||||||
return status;
|
return status;
|
||||||
},
|
},
|
||||||
@ -243,6 +250,7 @@
|
|||||||
},
|
},
|
||||||
readPixels: {
|
readPixels: {
|
||||||
getStatus: function(obj, status){
|
getStatus: function(obj, status){
|
||||||
|
var status = Object.create(status);
|
||||||
status.active = hasType(status, "readout") || hasType(status, "input");
|
status.active = hasType(status, "readout") || hasType(status, "input");
|
||||||
return status;
|
return status;
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user