Closed Bug 837315 Opened 9 years ago Closed 9 years ago

Add an event for SVGs that indicates when the SVG and all its inner resources are done loading

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file)

Right now there is no event that indicates that an SVG and all its inner images are done loading. We need something similar to |window.onload| for SVGs. The closest thing we have is the |SVGLoad| event, but it only indicates that the SVG DOM _itself_ is ready - that is, it behaves more like |DOMContentLoaded| than |window.onload|. We can't tell when SVG images should be considered loaded (and thus should unblock onload for the document they're embedded in) without this event. Not having this prevents us from correctly fixing bug 704059, resulting in a number of race conditions and random orange bugs, including bug 703806.
s/images/resources/ in summary -- this includes stylesheets, <use>, and any filters/gradients/etc that happen to be stored in (data-URI or blob-URI encoded) external resources.

Basically, we need something like window.onload. (but there are apparently a number of places where that gets blocked by the fact that we don't have a window object)
Summary: Add an event for SVGs that indicates when the SVG and all its inner images are done loading → Add an event for SVGs that indicates when the SVG and all its inner resources are done loading
Proposed patch. Try job here: https://tbpl.mozilla.org/?tree=Try&rev=86372d515c8b
Attachment #709864 - Flags: review?(bzbarsky)
Comment on attachment 709864 [details] [diff] [review]
Add SVG document loaded event.

Hmm.  Is there a reason to not just call this event "load"?

r=me either way, I guess.
Attachment #709864 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky (:bz) from comment #3)
> Hmm.  Is there a reason to not just call this event "load"?

Well, the thinking was that giving it a name like this would clarify that it was a private event only for our internal consumption.
Thanks for the review btw!
Ah, ok.  I buy that.
OK, I'm happy with the try results. Let's get this in.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/874fc2730371
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.