Open Bug 305935 Opened 20 years ago Updated 6 months ago

allow Web authors to "say" that onunload, etc. handlers are fastback-safe

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

People

(Reporter: dbaron, Unassigned)

References

Details

(Keywords: perf)

One of the things that we check for before saving a presentation (in particular, nsDocument::CanSavePresentation calls nsEventListenerManager::HasUnloadListeners) is that the page doesn't have any onunload or onbeforeunload listeners. This could provide a very frustrating experience for Web developers who: * need to use onunload or onbeforeunload for some reason, and * care about the performance of their pages in Gecko, since they would be unable to make their pages get the benefits of fastback. We should care about helping Web developers who care about Gecko, and we certainly don't want to make them mad at us. This is a little risky, though, since it introduces a situation that authors aren't likely to test very well, so I have some mixed feelings about whether we should do it at all. One possible mechanism for doing this is to consider the presence of onpagehide and/or onpageshow handlers to be a statement from the author that the onunload/onbeforeunload handlers don't make the page unusable. However, we should make sure that such handlers coming from extensions/chrome don't cause this change (at the very least by ensuring that there's a way for extensions/chrome to add listeners that doesn't affect this test). (I thought we were also checking for onsubmit, but we don't seem to be.)
Summary: allow Web authors to "say" that onunload, etc. handlers are fastback-safe (idempotent, etc.) → allow Web authors to "say" that onunload, etc. handlers are fastback-safe
Component: History: Session → Document Navigation
QA Contact: history.session → docshell
Severity: normal → S3

smaug, this seems relevant to bug 1896663. Is there a better reason why something like this hasn't been standardized except that no one has gotten around to it?

Flags: needinfo?(smaug)
See Also: → 1896663

Something related has been discussed in https://github.com/mozilla/standards-positions/issues/691
I don't know what Chrome is shipping atm

Flags: needinfo?(smaug)
You need to log in before you can comment on or make changes to this bug.