Open Bug 329514 Opened 15 years ago Updated 3 years ago

Sort out the exact behavior for *LOAD events


(Core :: DOM: Events, defect, P5)





(Reporter: smaug, Unassigned)



We should sort out the exact behavior for *LOAD events.
See also
Depends on: 234455
So the current behavior when someone attaches a load listener to the tabbrowser in Firefox is:

1) Capturing listener -- see loads for documents and for <xul:image>s in the tabbrowser.

2) Bubbling listener -- see no load events.

Presumably that's why uses a capturing listener....

Any idea why the load listeners see nothing there?
Flags: blocking1.9a1?
(In reply to comment #2)
> Presumably that's why uses a capturing
> listener....

It uses bubbling listener.
window.addEventListener("load", function() { myExtension.init(); }, false);

The bubbling listener is for extension initialization routine - it only needs to run when the chrome window loads. The capturing listener is registered on the parent of gBrowser - and is called for content load events.
smaug, I meant this part:

      appcontent.addEventListener("load", this.onPageLoad, true);
      messagepane.addEventListener("load", this.onPageLoad, true);

But I've thought about it, and I see what's going on.  Load events don't bubble (for documents too).  That's fine (and fixes bug 196057).  But then the problem is that the the load event for a window is fired on its <browser> (due to the code in nsGlobalWindow::PostHandleEvent) but doesn't propagate from there.  In particular, there's no load event fired on the <tabbrowser> (much less the node the Mozillazine code is messing with).

As I see it, there are two options here:

1)  We could make load events "bubble" up to binding parents (but not other
2)  We could make tabbrowser add load listeners to its browsers and fire a load
    event at itself when those fire.  The problem is getting the right target or 
    originalTarget or whatever in that load event -- the target should arguably
    be the document or window that finished loading.  Do we get that correct
    right now when we re-fire the load on our frame element?

I'm frankly somewhat partial to solution #1; we've discussed something like that before, I think.
Flags: blocking1.9a1? → blocking1.9-
Whiteboard: [wanted-1.9]
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
Assignee: events → nobody
QA Contact: ian → events

Move all DOM bugs that haven't been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.