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

On 7/10/12 7:10 PM, Jatinder Mann wrote:
> I have updated the spec to fire visibilitychange before pageshow and after pagehide, as you had suggested.

...

> On 5/17/2012 5:26 PM, Boris wrote:
>> 2) When unloading a document, why would a UA not end up in the " Else if the Document
>> contained by the top level browsing context is now not visible" branch if the if/else cascade?
>> Seems like it would, as the spec is currently written...
>
> I have fixed this by including the unloading statements as a part of the not visible statements.

I'm not sure I follow this section, still.  For example. let's take the 
"now at least partially visible" case when traversing to a session 
history entry.  The condition in step 1 tests true, so step 2 runs right 
before the firing of pageshow.  Step 2 queues a task to perform 3 
substeps.  Then it returns, the pageshow event fires, and then the 
queued task is executed, so the visibilitychange fires after pageshow.

Similar for the "now not visible" steps, except there the 
visibilitychange will run after unload.

I assume in both cases what's really desired is to give a name to the 
three-step algorithm and to run it right before pageshow when traversing 
to a session history entry or off a task when not for the "now visible" 
case, and likewise run it right after pagehide or during the unload 
steps when unloading or off a task when not in the "not visible" case.

Also, isn't it possible to both be traversing from a history entry _and_ 
unloading?  I don't see why you need to say anything about traversing 
from session history entries apart from saying that "unloading document 
visibility change steps" involves firing visibility change stuff.

>> 3) The addition of pageshow/pagehide event firing in this spec would, if actually implemented,
>>   make those events fire twice.  That doesn't seem right.
>
> Instead of stating that the UA should fire the event, I now state "If traversing to a session history entry, run the following steps before running the step to fire the pageshow event." Likewise for pagehide.

This is still firing twice for the pagehide case.  See above for how I 
think we should fix it.

For the pageshow case I guess this is OK modulo the ordering comments 
above, though it would be better to have an explicit hook in the history 
traversal algorithm like we do in the unload steps....

> I have updated the processing model to not restrict the unloading steps to top-level documents. This step now applies to any document that is unloading.

Great, thank you!

-Boris

P.S.  Sorry for the lag; this somehow got lost.  :(

Received on Tuesday, 31 July 2012 20:17:19 UTC