mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-03-12 03:02:59 +01:00
Suppressed notification if maxFakeSize triggers.
This commit is contained in:
parent
b8ba76300e
commit
37fd9f7a36
Binary file not shown.
@ -34,8 +34,20 @@
|
|||||||
case "allow":
|
case "allow":
|
||||||
return original;
|
return original;
|
||||||
case "fake":
|
case "fake":
|
||||||
notify({url: window.location.href, errorStack: error.stack}, window);
|
if (changedFunction.fake){
|
||||||
return changedFunction.fake || changedFunction.fakeGenerator(prefs) || undef;
|
|
||||||
|
return changedFunction.fake;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (changedFunction.fakeGenerator) {
|
||||||
|
return changedFunction.fakeGenerator(prefs, function(){
|
||||||
|
notify({url: window.location.href, errorStack: error.stack}, window);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
}
|
||||||
//case "block":
|
//case "block":
|
||||||
default:
|
default:
|
||||||
return undef;
|
return undef;
|
||||||
|
@ -93,16 +93,21 @@
|
|||||||
getImageData: {
|
getImageData: {
|
||||||
type: "readout",
|
type: "readout",
|
||||||
object: "CanvasRenderingContext2D",
|
object: "CanvasRenderingContext2D",
|
||||||
fakeGenerator: function(prefs){
|
fakeGenerator: function(prefs, notify){
|
||||||
var maxSize = prefs("maxFakeSize") || Number.POSITIVE_INFINITY;
|
var maxSize = prefs("maxFakeSize") || Number.POSITIVE_INFINITY;
|
||||||
return function getImageData(sx, sy, sw, sh){
|
return function getImageData(sx, sy, sw, sh){
|
||||||
var window = getWindow(this.canvas);
|
var window = getWindow(this.canvas);
|
||||||
var context = (sw * sh > maxSize)?
|
var context;
|
||||||
this:
|
if (sw * sh > maxSize){
|
||||||
window.HTMLCanvasElement.prototype.getContext.call(
|
context = this;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notify();
|
||||||
|
context = window.HTMLCanvasElement.prototype.getContext.call(
|
||||||
getFakeCanvas(window, this.canvas),
|
getFakeCanvas(window, this.canvas),
|
||||||
"2d"
|
"2d"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
var data = window.CanvasRenderingContext2D.prototype.getImageData.apply(context, arguments).data;
|
var data = window.CanvasRenderingContext2D.prototype.getImageData.apply(context, arguments).data;
|
||||||
|
|
||||||
var imageData = new window.wrappedJSObject.ImageData(sw, sh);
|
var imageData = new window.wrappedJSObject.ImageData(sw, sh);
|
||||||
|
@ -119,5 +119,6 @@ exports.notify = function({url, errorStack}, {lists, notificationPref, _, browse
|
|||||||
notification.domain = domain;
|
notification.domain = domain;
|
||||||
notification.callingStackMsg = callingStackMsg;
|
notification.callingStackMsg = callingStackMsg;
|
||||||
}
|
}
|
||||||
|
return notification;
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user