Sort out the exact behavior for *LOAD events

NEW
Unassigned

Status

()

Core
DOM: Events
11 years ago
5 years ago

People

(Reporter: smaug, Unassigned)

Tracking

Trunk
Points:
---
Bug Flags:
blocking1.9 -
wanted1.9 +

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
 
(Reporter)

Comment 1

11 years ago
We should sort out the exact behavior for *LOAD events.
See also https://bugzilla.mozilla.org/show_bug.cgi?id=51211#c37
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 http://kb.mozillazine.org/On_page_load uses a capturing listener....

Any idea why the load listeners see nothing there?
Flags: blocking1.9a1?
(Reporter)

Comment 3

11 years ago
(In reply to comment #2)
> 
> Presumably that's why http://kb.mozillazine.org/On_page_load uses a capturing
> listener....
> 

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

Comment 4

11 years ago
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
    bubbling).
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
You need to log in before you can comment on or make changes to this bug.