mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Allow cross origin arguments and remove apply(..., Array.from)
Fixes #415
This commit is contained in:
parent
8506757c62
commit
4601dd25af
11 changed files with 38 additions and 37 deletions
|
@ -214,10 +214,10 @@
|
|||
if (fakeCanvas !== this){
|
||||
notify("fakedReadout");
|
||||
}
|
||||
return original.apply(fakeCanvas, window.Array.from(args));
|
||||
return original.call(fakeCanvas, ...args);
|
||||
}
|
||||
else {
|
||||
return original.apply(this, window.Array.from(args));
|
||||
return original.call(this, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,13 +234,13 @@
|
|||
// nothing to do here
|
||||
}
|
||||
// if "this" is not a correct context the next line will throw an error
|
||||
const ret = original.apply(this, window.Array.from(args));
|
||||
const ret = original.call(this, ...args);
|
||||
const newImageData = getImageData(window, this).imageData;
|
||||
this.putImageData(randomMixImageData(window, oldImageData, newImageData), 0, 0);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
return original.apply(this, window.Array.from(args));
|
||||
return original.call(this, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,9 +273,9 @@
|
|||
fakeGenerator: function(checker){
|
||||
return function(context, contextAttributes){
|
||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {window, original} = check;
|
||||
const {original} = check;
|
||||
canvasContextType.set(this, context);
|
||||
return original.apply(this, window.Array.from(args));
|
||||
return original.call(this, ...args);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -332,10 +332,10 @@
|
|||
"2d"
|
||||
);
|
||||
}
|
||||
return original.apply(context, window.Array.from(args));
|
||||
return original.call(context, ...args);
|
||||
}
|
||||
else {
|
||||
return original.apply(this, window.Array.from(args));
|
||||
return original.call(this, ...args);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -350,7 +350,7 @@
|
|||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {notify, window, original} = check;
|
||||
const rng = randomSupply.getValueRng(1, window);
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const originalValue = original.call(this, ...args);
|
||||
if ((typeof originalValue) === "boolean"){
|
||||
notify("fakedReadout");
|
||||
const index = x + this.width * y;
|
||||
|
@ -372,7 +372,7 @@
|
|||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {notify, window, original} = check;
|
||||
const rng = randomSupply.getValueRng(1, window);
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const originalValue = original.call(this, ...args);
|
||||
if ((typeof originalValue) === "boolean"){
|
||||
notify("fakedReadout");
|
||||
if (x instanceof window.Path2D){
|
||||
|
@ -431,10 +431,10 @@
|
|||
fakeCanvas,
|
||||
this instanceof window.WebGLRenderingContext? "webgl": "webgl2"
|
||||
);
|
||||
return original.apply(context, window.Array.from(args));
|
||||
return original.call(context, ...args);
|
||||
}
|
||||
else {
|
||||
return original.apply(this, window.Array.from(args));
|
||||
return original.call(this, ...args);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -449,7 +449,7 @@
|
|||
return function getParameter(pname){
|
||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const originalValue = original.call(this, ...args);
|
||||
if (webgl.parameterChangeDefinition[pname]){
|
||||
const definition = webgl.parameterChangeDefinition[pname];
|
||||
const {value, faked} = definition.fake(originalValue, window, prefs);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue