mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-03 03:56:26 +02:00
Trying to get wrappedJSObject of an wrappedJSObject is wrong...
Fixes #133 and #134.
This commit is contained in:
parent
42ee6e483e
commit
eb62521adc
4 changed files with 17 additions and 8 deletions
|
@ -16,6 +16,7 @@
|
|||
const colorStatistics = require("./colorStatistics");
|
||||
const logging = require("./logging");
|
||||
const {copyCanvasToWebgl} = require("./webgl");
|
||||
const getWrapped = require("sdk/getWrapped");
|
||||
|
||||
var randomSupply = null;
|
||||
|
||||
|
@ -30,8 +31,8 @@
|
|||
var imageData;
|
||||
var source;
|
||||
if ((context.canvas.width || 0) * (context.canvas.height || 0) === 0){
|
||||
imageData = new window.wrappedJSObject.ImageData(0, 0);
|
||||
source = new window.wrappedJSObject.ImageData(0, 0);
|
||||
imageData = new getWrapped(window).ImageData(0, 0);
|
||||
source = new getWrapped(window).ImageData(0, 0);
|
||||
}
|
||||
else if (context instanceof window.CanvasRenderingContext2D){
|
||||
imageData = window.CanvasRenderingContext2D.prototype.getImageData.call(
|
||||
|
@ -42,7 +43,7 @@
|
|||
source = imageData.data;
|
||||
}
|
||||
else {
|
||||
imageData = new window.wrappedJSObject.ImageData(context.canvas.width, context.canvas.height);
|
||||
imageData = new getWrapped(window).ImageData(context.canvas.width, context.canvas.height);
|
||||
source = new Uint8Array(imageData.data.length);
|
||||
window.WebGLRenderingContext.prototype.readPixels.call(
|
||||
context,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue