RE: [Page Visibility] Navigate away behavior (was RE: TPAC 2011 Web Performance WG 2011-11-01)

On 12/6/12 7:44 PM, Boris Zbarsky wrote:

>  Now that I read this section again, the tests at http://w3c-test.org/webperf/tests/submission/Microsoft/PageVisibility/test_minimize.htm

> and http://w3c-test.org/webperf/tests/submission/Microsoft/PageVisibility/test_tab_state_change.htm flat-out contradict it.  Is the bug in

> the spec, or in the tests?  Gecko as currently shipped does what the spec right now says here for the tab-switch and unminimize cases.



This is a test bug. The test is making assumptions on the ordering of firing events. I'll update the test case.





On 12/6/12 7:44 PM, Boris Zbarsky wrote:

>  I don't think we want the steps running synchronously when switching tabs or unminimizing...



Correct. We want the task itself to run asynchronously, but we want various things that happen in the task to happen synchronously relative each other.



I believe the following updated processing model takes all your feedback into account: the task is run asynchronously, and we are not firing the pagehide event twice. Thanks for helping clarify the text to actually match the intentions of the spec.



"When the User Agent determines that the visibility of the Document<http://www.w3.org/TR/html5/dom.html#document> contained by the top level browsing context<http://www.w3.org/TR/html5/browsers.html#top-level-browsing-context> has changed, the User Agent MUST run the following steps.

If the Document<http://www.w3.org/TR/html5/dom.html#document> contained by the top level browsing context<http://www.w3.org/TR/html5/browsers.html#top-level-browsing-context> is now at least partially visible on at least one screen,

1.    If traversing to a session history entry<http://www.w3.org/TR/html5/browsers.html#session-history-entry>, run the now visible algorithm<file:///C:\WebPerf\specs\PageVisibility\Overview.html#now-visible-algorithm> before running the step to fire the pageshow<http://www.w3.org/TR/html5/browsers.html#event-pageshow> event.

2.    Otherwise, queue a task that runs the now visible algorithm<file:///C:\WebPerf\specs\PageVisibility\Overview.html#now-visible-algorithm>.

Else if the Document<http://www.w3.org/TR/html5/dom.html#document> contained by the top level browsing context<http://www.w3.org/TR/html5/browsers.html#top-level-browsing-context> is now not visible or if the user agent is to unload<http://www.w3.org/TR/html5/browsers.html#unloading-documents> the Document<http://www.w3.org/TR/html5/dom.html#document>,

1.    If the user agent is to unload<http://www.w3.org/TR/html5/browsers.html#unloading-documents> the Document<http://www.w3.org/TR/html5/dom.html#document>, run the now hidden algorithm<file:///C:\WebPerf\specs\PageVisibility\Overview.html#now-hidden-algorithm> during the unloading document visibility change steps<http://www.w3.org/TR/html5/browsers.html#unloading-document-visibility-change-steps>,

2.    Otherwise, queue a task that runs the now hidden algorithm<file:///C:\WebPerf\specs\PageVisibility\Overview.html#now-hidden-algorithm>.

The now visible algorithm runs the following steps synchronously:

1.    Set the hidden<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-hidden> attribute to false.

2.    Set the visibilityState<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-visibilitystate> attribute to visible.

3.    Fire a simple event named visiblitychange that bubbles, isn't cancelable, and has no default action, at the Document<http://www.w3.org/TR/html5/dom.html#document>.

The now hidden algorithm runs the following steps synchronously:

1.    Set the hidden<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-hidden> attribute to true.

2.    Set the visibilityState<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-visibilitystate> attribute to hidden. If the user agent is to unload<http://www.w3.org/TR/html5/history.html#unloading-documents> the Document<http://www.w3.org/TR/html5/dom.html#document>, set the visibilityState<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-visibilitystate> attribute to unloaded. Setting visibilityState<file:///C:\WebPerf\specs\PageVisibility\Overview.html#dom-document-visibilitystate> attribute to unloaded instead of hidden is optional.

3.    Fire a simple event named visiblitychange that bubbles, isn't cancelable, and has no default action, at the Document<http://www.w3.org/TR/html5/dom.html#document>."
Thanks,
Jatinder

Received on Tuesday, 18 December 2012 21:32:20 UTC