[whatwg/fetch] Time origin adjustment for navigation (Issue #1359)

Resource timing entries are adjusted to a `time origin`, which in the case of navigation and other window entries is read from the document (The "navigation start time").

When fetch timing entries are recorded, they're adjusted to the time origin of the global object passed to FETCH as the client.

The problem is, that the global object passed to FETCH when the navigation starts is the *previous* global object, and only during the course of the navigation ([here](https://html.spec.whatwg.org/#navigating-across-documents:set-up-a-window-environment-settings-object)) we set up the new global object, after those values were already recorded.

This means that spec-wise, the fetch timing info values are off by `newDocument.navigationStartTime - oldDocument.navigationStartTime` milliseconds. This is not a problem in implementations.

Wondering how to go about this:
- Pass the new time origin to FETCH (we know it when the fetch starts), and adjust as we record
- Adjust in HTML, right before [creating the navigation timing entry](https://html.spec.whatwg.org/#navigating-across-documents:create-the-navigation-timing-entry)
- Pass the offset along to navigation timing, and adjust all the properties when creating the entry
- Create special navigation timing getters and adjust there

See https://github.com/whatwg/html/pull/7339.

WDYT @annevk @yoavweiss @domenic ?





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1359

Received on Sunday, 21 November 2021 08:28:27 UTC