Closed
Bug 820971
Opened 13 years ago
Closed 13 years ago
setting img.src=null triggers onerror when FirefoxOS app is run as inline activity
Categories
(Core :: DOM: Core & HTML, defect, P4)
Tracking
()
People
(Reporter: djf, Assigned: khuey)
Details
Attachments
(1 file, 1 obsolete file)
1.07 KB,
patch
|
bzbarsky
:
review+
sicking
:
approval-mozilla-aurora+
sicking
:
approval-mozilla-b2g18+
|
Details | Diff | Splinter Review |
The Gaia Gallery app uses offscreen image tags for creating thumbnails of images.
After creating a thumbnail, the code sets the src property of the offscreen image to null to release memory.
When gallery runs as a regular app this works fine.
But when it runs as an inline activity (when used from the Contacts app to pick an image) setting src to null triggers the onerror handler.
Gecko shouldn't behave differently in these two cases.
https://bugzilla.mozilla.org/show_bug.cgi?id=819596 describes what I was seeing in Gallery. I'm going to workaround this by setting the error handler to null before I set src to null, and with that patch will close bug 819596.
I'm filing this bug for the underlying Gecko issue.
Reporter | ||
Comment 1•13 years ago
|
||
Cc'ing Kyle because he knows about images and Fabrice because he knows about activities.
blocking-basecamp: --- → ?
![]() |
||
Comment 2•13 years ago
|
||
Note that per spec setting img.src = null will set it to the string "null", which I expect to generally fire onerror. That's not the current behavior of XPConnect, since that stringifies null to "", but once we switch images to WebIDL bindings this will be the case.
What are you actually trying to accomplish by setting src to null, and would removeAttribute("src") do the trick?
Apart from that, this needs steps to reproduce... The only way I can see setting src to "" firing onerror is if it's done before OnStopRequest for the imgIRequest, because then cancelling the request would show up in the load status. But it sounds like the src="" happens from onload already, right?
Reporter | ||
Comment 3•13 years ago
|
||
If I use img.removeAttribute('src') instead of img.src = null I don't see this bug anymore.
![]() |
||
Comment 4•13 years ago
|
||
OK. What about if you use img.src="" ?
![]() |
||
Comment 5•13 years ago
|
||
Is there a difference in the value of img.complete in the two cases you're looking at?
Reporter | ||
Comment 6•13 years ago
|
||
Boris,
I was just trying the removeAttribute() workaround when you commented...
The steps to reproduce are in bug 819596, until I patch the Gallery app so it doesn't exhibit the bug anymore.
Yes, I'm setting src to null after the onload handler fires.
Could there be something about activities that makes null stringify differently?
Reporter | ||
Comment 7•13 years ago
|
||
Setting img.src = '' gives the same bug as using null
![]() |
||
Comment 8•13 years ago
|
||
OK. So it's not a stringification issue.
Does one of these cases have a base URI that does not match the document URI, perhaps?
Reporter | ||
Comment 9•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #5)
> Is there a difference in the value of img.complete in the two cases you're
> looking at?
It is always true in the onload handler, when running as a regular app or as an activity.
It is false when the error handler is triggered in the activity case.
I'm not sure that was the test you had in mind, though.
Reporter | ||
Comment 10•13 years ago
|
||
document.URL is equal to document.baseURI when the onload handler triggers, in both cases.
In the app case, the URL is app://gallery.gaiamobile.org/index.html
And when launched as an activity the URL is: app://gallery.gaiamobile.org/index.html#pick
Could that #pick suffix make a difference?
Reporter | ||
Comment 11•13 years ago
|
||
I nominated this as blocking-basecamp because its Gaia symptom #819596 was blocking. I'll work around that symptom with removeAttribute('src') but it still seems like the underlying issue should be resolved.
Assignee | ||
Comment 12•13 years ago
|
||
Yes, the #pick suffix is responsible here.
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → khuey
Assignee | ||
Comment 13•13 years ago
|
||
Attachment #691521 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 14•13 years ago
|
||
Comment on attachment 691521 [details] [diff] [review]
Patch
Wrong diff.
Attachment #691521 -
Attachment is obsolete: true
Attachment #691521 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 15•13 years ago
|
||
Attachment #691522 -
Flags: review?(bzbarsky)
![]() |
||
Comment 16•13 years ago
|
||
> I'm not sure that was the test you had in mind, though.
It was, yes.
![]() |
||
Comment 17•13 years ago
|
||
Comment on attachment 691522 [details] [diff] [review]
Patch
r=me. I guess relative URI resolution drops the ref, eh?
Attachment #691522 -
Flags: review?(bzbarsky) → review+
Comment 18•13 years ago
|
||
Not a blocker, but we'd like to see this fix uplifted. Thanks.
blocking-basecamp: ? → -
Priority: -- → P4
Comment on attachment 691522 [details] [diff] [review]
Patch
[Triage Comment]
This seems very safe and is the right thing to do.
Attachment #691522 -
Flags: approval-mozilla-b2g18+
Attachment #691522 -
Flags: approval-mozilla-aurora+
Assignee | ||
Comment 20•13 years ago
|
||
Comment 21•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment 22•13 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•