w3c / navigation-timing

Navigation Timing
https://w3c.github.io/navigation-timing/
Other
116 stars 30 forks source link

Proposal: add timestamp for when "activation" or "dismissal" starts #193

Open noamr opened 9 months ago

noamr commented 9 months ago

Currently page deactivation (specifically calling pagehide and visibilitychange) is done some time after responseStart and before the new page is activated, but it's unclear how long they took. This becomes more important with the introduction of cross-document view transitions, as the browser might add a rendering step between the new page's response headers being ready and deactivating the old document.

Proposing to add deactivationStart or some such to PerformanceNavigationTiming, that marks the time right before firing pagehide & visibilitychange (both of which fire before unload). This will only be accessible in same-origin navigation. In addition, we should finish specing and implementing https://github.com/w3c/resource-timing/issues/345 - if we have finalResponseHeadersEnd and deactivationStart, the time in between would often mean the time spend preparing a view-transition.

/cc @tunetheweb @fergald @yoavweiss

fergald commented 9 months ago

Should there be a deactivationEnd? I think it should be at the basically the same time as unloadEventEnd, which makes it somewhat redundant but for symmetry and for a future where hopefully there is no unload event it would be nice to have.

nicjansma commented 6 months ago

Discussed on the March 13, 2024 W3C WebPerf call: https://docs.google.com/document/d/1k7lB7XWXHBUmxR5YaycYTXWsHVqXelLh0RRDIFnx-gI/edit#heading=h.t4ndg6qhajam