spurious load events firing

RESOLVED INVALID

Status

--
major
RESOLVED INVALID
12 years ago
10 years ago

People

(Reporter: eyalroz, Unassigned)

Tracking

({regression})

Trunk
x86
Windows XP
regression

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
When composing a message, the 'load' event doesn't behave like its usual (flakey enough) self; it fires many many times. E.g. right after pressing compose for the first time, you get about 50 load events. When _closing_ a message you get load events. etc.

To reproduce, put this:
-----
var jsConsoleService = Components.classes['@mozilla.org/consoleservice;1'].getService();
jsConsoleService.QueryInterface(Components.interfaces.nsIConsoleService);
var gLoadCount = 0;

function DebugLoadHandler()
{
  gLoadCount++;
  jsConsoleService.logStringMessage('load event #' + gLoadCount);
}
-----

in a JS file and overlay the composer xml with 
-----
document.addEventListener("load", DebugLoadHandler, true); 
-----

Note there is also the matter of multiple windows being created as copies of each other (after some code has already run, possibly this event handler as well).

This is a regression, but it probably happened a while ago, maybe even a year or more.

Comment 1

12 years ago
(In reply to comment #0)
>document.addEventListener("load", DebugLoadHandler, true); 
You've just asked for all load events. And on trunk there are quite a few.

If you only want the One True load event (as per the onload attribute) use:
addEventListener("load", oneTrueLoadHandler, false);
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
(Reporter)

Comment 2

12 years ago
But there are 0 true load events - doing what you suggested means my handler is never called.
(Reporter)

Comment 3

12 years ago
If, however, I add the event listener to the window rather than the document like Mnyromir just suggested, I do get a 'true' load event - but only once, for the first-ever compose window. Maybe doing that in conjuction with a capturing the composer-window-reopen events (since these are never 'true' even for windows) could work.
(Assignee)

Updated

10 years ago
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.