[whatwg] API to delay the document load event

Context: https://bugzilla.mozilla.org/show_bug.cgi?id=863499

Use-cases:
1) User-agents provide thumbnails of Web pages (e.g. desktop Firefox,
FirefoxOS and Safari do this). We want to avoid taking a thumbnail while
the application is incompletely loaded. The firing of the document load
event is not currently a reliable indicator since the application might
have ongoing load activities (e.g. IndexedDB transactions, Websocket
activity) that do not block the document load event.
2) User-agent has UI to distinguish pages that are in the process of
loading from pages that are fully loaded. As in use-case #1, relying on the
document load event as currently defined to transition the UI to the "fully
loaded" state may be inaccurate.

Proposal:
Give Web applications APIs to explicitly delay the document load event. In
particular, add a method "document.delayLoadEvent()" that causes the
document load event to be delayed until a corresponding
"document.stopDelayingLoadEvent()" method is called. Allow these to nest so
that the document load event is delayed until at least as many calls to
stopDelayingLoadEvent() have been made as there were calls to
delayLoadEvent().

Alternatives:
Applications can fake this already by triggering an invisible subresource
load of a URI that never returns any data and never ends, and cancelling
the load when they want to stop delaying the load event. That seems fragile
and ugly.

Rob
-- 
q“qIqfq qyqoquq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qyqoquq,q qwqhqaqtq
qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq
qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qtqhqeqmq.q qAqnqdq qiqfq qyqoquq
qdqoq qgqoqoqdq qtqoq qtqhqoqsqeq qwqhqoq qaqrqeq qgqoqoqdq qtqoq qyqoquq,q
qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq
qsqiqnqnqeqrqsq qdqoq qtqhqaqtq.q"

Received on Wednesday, 24 April 2013 11:51:34 UTC