Use fetch controller full timing info for navigation timing - #12890
Conversation
annevk
left a comment
There was a problem hiding this comment.
Oh oops, we created two navigation timing entries before?
| </li> | ||
|
|
||
| <li><p>Let <var>navigationStartTime</var> be the <span>current high resolution time</span> given | ||
| <var>window</var>.</p></li> |
There was a problem hiding this comment.
This is wrong, no? Shouldn't this be the https://w3c.github.io/hr-time/#dfn-coarsened-shared-current-time given some parameters?
|
AI suggests there is no duplication here and this would impact Claude |
|
Still has logic errors I'm afraid. Review |
Fixed... A lot of these are issues not related directly to response's timing info, so I overlooked them. But I think it's clean now. |
annevk
left a comment
There was a problem hiding this comment.
I think this generally makes sense. What do you think of this final review:
AI review
New finding
- source:113439-113440 — the otherwise branch hardcodes "the empty string" for cacheMode while taking its neighbours from the real response. The same call passes navigationParams's response's service worker timing info and body info, but literal
empty string for cache state. That branch is not only for synthetic responses: per the note at source:108412-108416, navigate is supplied with a response for the object/embed processing models and for multipart/x-mixed-replace parts after the first
(source:108476, fetch controller null, request null). Those are real network responses with a meaningful cache state, silently discarded — so PerformanceNavigationTiming's deliveryType will never report "cache" for them. Since a response's cache
state defaults to the empty string, navigationParams's response's cache state is correct for object/embed/multipart and identical ("") for srcdoc/javascript:/error pages. Fix: use the same expression as the fetch branch (source:113418-113419) in
both.
Still open from last round
- source:113338-113343 — the cross-origin isolated capability argument is always false, because allowed to use (source:36017-36032) requires fully active and document isn't the navigable's active document until Make active in activate history entry
(source:112050). Worth a note if you don't want to change it.
- source:113429-113433 — the end time clause is observably a no-op (both the default 0 and the navigation start time convert to 0 through convert fetch timestamp, since the time origin is the navigation start time), and it puts an absolute moment
in a field Fetch and source:35688-35690 fill with a relative one. Drop it or explain it.
- Fetch (cross-spec) — extract full timing info asserts non-null, but Fetch only populates full timing info when destination is exactly "document", while HTML sets it to the container's local name for nested navigables (source:110493-110495).
Assert fails for every iframe/frame navigation at source:113179-113183. Worth filing before this lands.
- Hygiene — 8 commits to squash; no checklist/WPT link despite the observable change (navigation-timing/ has no srcdoc/about:blank coverage); rebase onto main.
- Nit, pre-existing — source:113250 and source:113253 use <var>navigable</var>, the one variable in this algorithm that's still unbound (should be navigationParams's navigable).
Overall
Nothing regressed, and nothing new is a blocker. The cacheMode asymmetry in the otherwise branch is the one substantive thing I'd want fixed before merge — it's a one-line change that makes both branches identical in that argument and stops
object/embed/multipart navigations from losing their cache state.
- Extract full timing info from navigationParams's fetch controller for network navigations. - Add a dedicated fallback branch for navigations without a fetch controller (e.g. srcdoc, javascript:, error pages, object/embed, multipart), providing a coarsened navigation start time and creating a PerformanceNavigationTiming entry. - Pass response's cache state for cacheMode in both branches to satisfy Resource Timing assertions and preserve deliveryType for object/embed/multipart navigations. - Pass 0 for criticalCHRestart (DOMHighResTimeStamp). - Use navigationParams's navigation timing type instead of unbound navigationTimingType. - Fix pre-existing unbound navigable variable in document creation steps. - Remove duplicate call to create the navigation timing entry. Fixes #12887.
1e1857c to
e802400
Compare
All seems like good suggestions! Done |
Extracts the full timing info from the fetch controller for network navigations.
Adds a dedicated fallback timing info branch for non-fetch navigations (about:srcdoc, javascript:, error pages), ensuring they receive a coarsened navigation start time and a valid
PerformanceNavigationTimingentry.Passing response's cache state as
cacheMode.Fixes the previously unbound
navigationTimingTypeto use navigationParams's navigation timing type.Closes #12887.
(See WHATWG Working Mode: Changes for more details.)