1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 03:56:26 +02:00

Added method to display faked canvas content.

This commit is contained in:
kkapsner 2017-07-08 22:40:38 +02:00
parent 8cec88f5f7
commit 3cefcfe702
7 changed files with 64 additions and 11 deletions

View file

@ -149,7 +149,7 @@
object: "HTMLCanvasElement",
fakeGenerator: function(prefs, notify, window, original){
return function toDataURL(){
notify("fakedReadout");
notify.call(this, "fakedReadout");
return original.apply(getFakeCanvas(window, this), window.Array.from(arguments));
};
}
@ -170,7 +170,7 @@
object: "HTMLCanvasElement",
fakeGenerator: function(prefs, notify, window, original){
return function toBlob(callback){
notify("fakedReadout");
notify.call(this, "fakedReadout");
return original.apply(getFakeCanvas(window, this), window.Array.from(arguments));
};
},
@ -192,7 +192,7 @@
object: "HTMLCanvasElement",
fakeGenerator: function(prefs, notify, window, original){
return function mozGetAsFile(callback){
notify("fakedReadout");
notify.call(this, "fakedReadout");
return original.apply(getFakeCanvas(window, this), window.Array.from(arguments));
};
}
@ -218,7 +218,7 @@
return original.apply(this, window.Array.from(arguments));
}
else {
notify("fakedReadout");
notify.call(this, "fakedReadout");
var fakeCanvas;
var context = this;
if (this && this.canvas) {
@ -245,7 +245,7 @@
object: "CanvasRenderingContext2D",
fakeGenerator: function(prefs, notify, window, original){
return function fillText(str, x, y){
notify("fakedInput");
notify.call(this, "fakedInput");
var oldImageData;
try {
// "this" is not trustable - it may be not a context
@ -270,7 +270,7 @@
object: "CanvasRenderingContext2D",
fakeGenerator: function(prefs, notify, window, original){
return function strokeText(str, x, y){
notify("fakedInput");
notify.call(this, "fakedInput");
var oldImageData;
try {
// "this" is not trustable - it may be not a context
@ -296,7 +296,7 @@
fakeGenerator: function(prefs, notify, window, original){
return function readPixels(x, y, width, height, format, type, pixels){
// not able to use the getFakeCanvas function because the context type is wrong...
notify("fakedReadout");
notify.call(this, "fakedReadout");
var xPixels = pixels;
var ret = original.apply(this, window.Array.from(arguments));
var l = xPixels.length;