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

RESOLVED FIXED in mozilla21

Status

()

defect
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: seth, Assigned: seth)

Tracking

Trunk
mozilla21
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Assignee

Description

7 years ago
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
Assignee

Comment 2

6 years ago
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+
Assignee

Comment 4

6 years ago
(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.
Assignee

Comment 5

6 years ago
Thanks for the review btw!
Ah, ok.  I buy that.
Assignee

Comment 7

6 years ago
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: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.