When I run the code that accesses the imageData passed to the web worker and then back, Firefox works fine, but Chrome gives the message "Uncaught Error: DATA_CLONE_ERR: DOM Exception 25"
Does google search suggest older versions of Chrome worked?
I checked a few more, and it seemed to me that I need to run JSON.stringify and JSON.parse in imagedata before sending it, but then it stops working everywhere. Code that works in FF 9:
image.js:
var myImageData = context.getImageData(0, 0, canvas.width, canvas.height).data;
var worker = new Worker("http://direct.link/helpers/worker.js");
worker.postMessage(myImageData);
worker.onmessage = function(event) {
var value = event.data;
switch (value.cmd){
case 'last':
break;
default:
});
}
worker.js:
addEventListener('message', function(event) {
var myImageData = event.data;
sendItBack(colors);
});
};
function sendItBack(colors){
each(colors, function(index, value){
self.postMessage(value);
});
self.postMessage({'cmd': 'last'});
}
What method should I use to send this imagedata back and forth to the application and web worker?
Thank!
EDIT:
If I copy to a regular array, then Chrome starts working ...
var newImageData = [];
for (var i=0,len=myImageData.length;i<len;++i) newImageData[i] = myImageData[i];
, CanvasPixelArray , . firefox .