-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What should the ordering of freeze/resume events be w.r.t. pagehide/pageshow for bfcached pages? #7
Comments
I would also prefer the second ordering. |
I think this shows that the actions described in https://wicg.github.io/web-lifecycle/spec.html#additions-to-web-lifecycle-spec need to be written down somewhere (if they haven't been already). It would then be much easier to see how dispatching this event slots into those algorithms. (The thing I was missing primarily is the task source for these actions, but I guess freeze/resume will just fire in the same task as whatever caused the switch?) |
Could you clarify the comment about "need to be written down somewhere"? BTW @philipwalton is working on the comprehensive diagram with (proposed) state transitions here: |
Minor update in the suggested order: And this for the resume case: |
Let's see... There's a set of user agent actions. Those actions queue a task (with a specified task source) to change the state of the document. That task then changes states, dispatches one or more events (and potentially does things based on how that dispatching goes), and maybe does some other things. So aside from the events, and the relative event order, we also need to know the tasks, the task sources, and the overall description of the actions. Does that make sense? |
Per @spanicker's comment #7 (comment), I've updated my original comment to have this order be our ideal order, where |
freeze as last and resume as first event at least looks reasonable. |
I'd like to draw attention to this issue. AFAICS, the spec is currently saying the "freeze" event must be fired before both This affects specs like Screen Wake Lock, which queues a "release" event based on page visibility changes, as seen in this Chromium discussion. |
I can see these events being fired in Blink, but I'm not sure if this is by design or not. In any case, other specifications like Screen Wake Lock that queue events on document visibility change do seem to be affected. |
I think the Page Lifecycle spec text might be out of date, because it's referencing specific step numbers and we've seen some changes in that part of the spec recently. I think we need to either integrate this spec into the HTML spec (with the correct ordering - firing |
Integration into HTML would be ideal, but I'm not sure Page Lifecycle has multi-implementer interest, so it might not be possible. The best we could do in that situation would be to update the step number references to instead talk about the contents of the steps, similar to stuff like https://jeremyroman.github.io/alternate-loading-modes/#navigate-activation |
The current ordering of events for visible in the unload process (that will be put into bfcache) is as follows:
beforeunload
pagehide
visibilitychange
And when coming out of bfcache there's just a single event:
pageshow
Assuming that bfcache-supporting browsers are going to also fire the
freeze
andresume
events when pages go into and out of the bfcache, what should the order be?My proposal would be this for the unload case:
beforeunload
pagehide
visibilitychange
freeze
And this for the resume case:
resume
pageshow
Having
freeze
fire aftervisibilitychange
is consistent with our model that the FROZEN state follows the HIDDEN state.NOTE: one catch here is that currently
pagehide
fires beforevisibilitychange
in the unload flow, which isn't consistent with our state progression.If we have to keep the current ordering of
pagehide
andvisibilitychange
for historical/compat reasons, then I think the above proposed ordering makes the most sense. On the other hand, if we can change the current ordering to better match our state progression, then I'd suggest this order:beforeunload
visibilitychange
pagehide
freeze
And this for the resume case:
resume
pageshow
The text was updated successfully, but these errors were encountered: