Closed pomartel closed 11 years ago
Yes, indeed. Looks like Firefox loads "about:blank" in the iframe, and then triggers uploadDone
, which attempts to parse it as JSON in handleResponse
.
I moved the event initialization
if(this.iframe.attachEvent)
this.iframe.attachEvent('onload', UploadImageDialog.uploadDone);
else
this.iframe.addEventListener('load', UploadImageDialog.uploadDone, false);
from the bottom of init
to the top of insert
and that made the error go away in Firefox and IE. IE still chokes when attaching anything real, but my test in Firefox works.
Also, since insert
might be called several times (no file selected, error from server, …), we should probably make sure only one event handler gets attached, to avoid uploadDone
being called multiple times, which some browser probably would do, and make a mess
Yes, that's a good point. Maybe you could trying detaching the event before attaching it so it doesn't get attached twice? I'm really clueless since I usually rely on jquery for all the event binding magic!
Does the browser-compatibility branch help fix this? Looks like IE9 works as well, just had to really force it to clear the cache
Yes, the Firefox bug is fixed for me too! Thanks!
I get this error when opening the dialog with the latest Firefox version on Mac OSX :
http://screencast.com/t/z9ezp00T
From what I can tell, the
handleResponse
method gets called when the iframe loads and a JSON parsing error occurs since theret
variable is null.I think the same error also occurs in IE. It works fine in Chrome.