Image load in unload handler delays subsequent window.load event

UNCONFIRMED
Unassigned

Status

()

Core
Document Navigation
UNCONFIRMED
4 years ago
4 years ago

People

(Reporter: sgrock, Unassigned)

Tracking

({testcase})

31 Branch
x86
Mac OS X
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

562 bytes, text/html
Details
(Reporter)

Description

4 years ago
Created attachment 8461224 [details]
unload.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36

Steps to reproduce:

Navigate to a page that loads an image in the window.unload handler (for example the attached unload.html example).  This is a common technique used by analytics tools (e.g. google analytics) to report data when users navigate away from a page.

Reload the page to trigger the registered unload event. 


Actual results:

The image is loaded as part of the subsequent page load cycle and delays the window.load event from firing even though it is a dependency of the previous document.

You can observe that this increases the time to window.load by looking at the line logged in console in the window.load event handler (on my machine I this takes about 200 ms).  Commenting out the unload handler will decrease the time to window.load significantly (to about 20ms for me).


Expected results:

The subsequent page load should not wait on this image load before firing window.load since it is not a child resource of that document (it's a child resource of the previous page).  This is the behavior I've observed in Chrome and Safari.

Comment 1

4 years ago
Boris, can you help move this to the right place? Not sure if this is a docshell, networking, or other issue...
Component: Untriaged → General
Flags: needinfo?(bzbarsky)
Keywords: testcase
Product: Firefox → Core
This is basically caused by the same issue as bug 492358: loadgroups are attached to the navigation context, not to documents.
Component: General → Document Navigation
Depends on: 492358
Flags: needinfo?(bzbarsky)
(Reporter)

Comment 3

4 years ago
In case it's helpful, I've found this bug reproduces in FF 25.0 and FF 20.0.  I haven't tested in any versions prior to 20.0.
You need to log in before you can comment on or make changes to this bug.