Update visibilityState before firing pagehide

Currently when unloading a document, we would fire pagehide before running “unloading document visibility change steps” (which includes updating visibilityState and firing the visibilitychange event if needed). We will swap this ordering, so that we would first run “unloading document visibility change steps” before firing pagehide.

Motivation

Updating visibility before firing pagehide simplifies Page Lifecycle state transitions, as this will guarantee that a page will always get into the “hidden” state before transitioning into the “terminated” or “frozen” state. See proposal for more details. This is also consistent with the pageshow event: we will run “session history document visibility change steps” before firing pageshow.

Demo

Documentation

Status in Chromium

Blink>DOM


In development

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • Positive
  • No signal
  • No signal
  • No signals

Owners

Last updated on 2020-10-25