Skip to content

What should the ordering of freeze/resume events be w.r.t. pagehide/pageshow for bfcached pages? #7

Open
@philipwalton

Description

@philipwalton

The current ordering of events for visible in the unload process (that will be put into bfcache) is as follows:

  1. beforeunload
  2. pagehide
  3. visibilitychange

And when coming out of bfcache there's just a single event:

  1. pageshow

Assuming that bfcache-supporting browsers are going to also fire the freeze and resume events when pages go into and out of the bfcache, what should the order be?

My proposal would be this for the unload case:

  1. beforeunload
  2. pagehide
  3. visibilitychange
  4. freeze

And this for the resume case:

  1. resume
  2. pageshow

Having freeze fire after visibilitychange is consistent with our model that the FROZEN state follows the HIDDEN state.

NOTE: one catch here is that currently pagehide fires before visibilitychange in the unload flow, which isn't consistent with our state progression.

If we have to keep the current ordering of pagehide and visibilitychange 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:

  1. beforeunload
  2. visibilitychange
  3. pagehide
  4. freeze

And this for the resume case:

  1. resume
  2. pageshow

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions