Repository navigation
Description
On FireFox 18.0.2, on mac os Lion
Minor Issue: NS Error in firefox when drawing image on image loaded event.
Description:
If you draw an image on a layer on the image loaded event,
in FireFox the image might not be completely loaded yet.
Resulting in an error: component not available
This error will stop the app.
Workaround:
Quick and dirty workaround is to place a try{ } catch(err){} around the drawImage method.
As the draw fails in the startup of the app - on image loaded events, the image will be drawn later again by one of the layer.draw() calls. So from user perspective there is no penalty in the workaround.
I havent investigated deeply into the issue. Though this only happens with Firefox.
Since this issue shows itself under load of an app using many images and moving them around at startup I dont have an isolated fiddle demonstrating the issue.
The inspiration for the workaround came from:
https://bugzilla.mozilla.org/show_bug.cgi?id=574330
_drawImage: function(context, a) {
try {
if(a.length === 5) {
context.drawImage(a[0], a[1], a[2], a[3], a[4]);
}
else if(a.length === 9) {
context.drawImage(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);
}
}
catch(err){
console.log("_drawImage err:",err);
}
}
If the try - catch is not really a performance impact, I suggest considering adding it to at least not let an app fail in Firefox when this happens.
Example error output on the console in FF:
[15:13:16.194] _drawImage err: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://www.shopaunt.com/lib/kinetic-v4.3.3.js :: <TOP_LEVEL> :: line 5787" data: no]
Note: adding the following check - catches part of the cases but in my experience not all of them:
if (!a[0].complete) {
console.log("argl no drawImage");
}
else {
// do the draw
}
Cheers,
Simon
Activity
ericdrowell commentedon Feb 21, 2013
thanks for looking into this! I'll try and get this in asap
umesh25 commentedon May 25, 2013
hello , i also getting same ERROR using kinetic js-v4.3.3 , is there any solution for this type of issue. ? please reply asap.. thanx
ximonn commentedon May 25, 2013
If you have a jsfiddle which reproduces it? you can try out one of the work arounds.
For myself I havent seen the issue in a while, Im using kinetic-v4.5.1.js
dvsmaximaa commentedon Dec 11, 2013
hello , i am also getting same ERROR using kinetic js-v4.7.2 , is there any solution for this type of issue. ? please reply me..i am frustate due to this error. thanx
ximonn commentedon Dec 11, 2013
@dvsmaximaa did you try the workaround? use the uncompressed kinetics 4.7.2 file and lookup the _drawImage function and do the same change.
dvsmaximaa commentedon Mar 13, 2014
Which kind of changes i do to solved this error becuase still i am getting same ERROR using kinetic js-v5.0.1 , is there any solution for this type of issue. ? please reply me
dvsmaximaa commentedon Mar 13, 2014
when will Release kinetic version 5.1.0 ?? any one know..??
prasadKodeInCloud commentedon Apr 7, 2014
Hi,
Plz fix this issue.our tool is in trouble bcs of this
HemanthFromIndia commentedon Apr 24, 2014
Hi, same problem here. Please give the patch for the same.
lavrton commentedon Apr 24, 2014
Is this workaround working for you?
mattslocum commentedon Apr 25, 2014
It happens for me in kinetic-v5.1.0.js:1713
It appears to be when when FF is having performance trouble. Images that are already loaded in memory become not ready. From what I can tell FF has had this problem for many years now. https://bugzilla.mozilla.org/show_bug.cgi?id=574330
FF memory consuption spikes to around 1.8GB during this problem, and then drops back down to 200MB or so when it catches back up.
Adding:
if (!a[0].complete) return '';
stopped FF from throwing the error and causeing weird rendering artifacts.
I'm wondering if before return ''; we should throttle back the frameRate until FF catches up, since it would be clear that FF is having performance problems when that condition happens.
lavrton commentedon Apr 27, 2014
I think that including such workaround with
try:is bad idea. Thoughts:
If you want to check is image is ok, you may do this:
lavrton commentedon Apr 27, 2014
Also you can use this small snippet:
mattslocum commentedon Apr 27, 2014
For me the problem is not with the image. The image is already loaded and being used in the canvas. The problem happens during animation ticks. It feels like sometimes Firefox has performance issues and isn't able to deliver the image during the redraw of the animation tick.
I like your solution with the Kinetic.UA.browser === "mozilla" for now. I might do a variation on that until I have a better solution.