Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window's time origin is totally different across browsers. Consider simplifying #7716

Closed
noamr opened this issue Mar 17, 2022 · 8 comments · Fixed by #7720
Closed

Window's time origin is totally different across browsers. Consider simplifying #7716

noamr opened this issue Mar 17, 2022 · 8 comments · Fixed by #7720

Comments

@noamr
Copy link
Contributor

noamr commented Mar 17, 2022

Currently timeOrigin for window environments is specified as being right before the beforeunload events, or right after confirmation of the unload. However, implementations don't follow this at all!

  • In Chromium, navigation start is right after the beforeunload event is handled regardless of prompts
  • In WebKit, navigation start is the start time of the navigation's fetch
  • In Gecko, navigation start is before the beforeunload event even in the case of prompt (see https://bugzilla.mozilla.org/show_bug.cgi?id=1760010)

This can lead to confusion and for totally different numbers across websites and between browsers (especially Firefox).
Suggesting to simplify the spec to use WebKit's approach, essentially navigation start time = underlying resource fetch start time = 0 (the time origin)

@noamr noamr changed the title Window's time origin is totally different across browser. Consider simplifying Window's time origin is totally different across browsers. Consider simplifying Mar 17, 2022
@annevk
Copy link
Member

annevk commented Mar 17, 2022

I agree that this would be a step in the right direction. w3c/navigation-timing#160 (comment) (by you!) has notes on potentially making it even better. (I say potentially, as perhaps WebKit already uses the start time of the latest fetch.)

cc @yoavweiss @sefeng211 @achristensen07

@noamr
Copy link
Contributor Author

noamr commented Mar 17, 2022

I agree that this would be a step in the right direction. w3c/navigation-timing#160 (comment) (by you!) has notes on potentially making it even better. (I say potentially, as perhaps WebKit already uses the start time of the latest fetch.)

Yea, that would be better IMO but more "breaking" in case of a navigation that starts with a cross-origin redirect.

@achristensen07
Copy link

I certainly wouldn't oppose putting WebKit's current behavior into the spec as a less shocking change for some browsers on our way to solving navigation-timing issue 160

noamr added a commit to noamr/html that referenced this issue Mar 18, 2022
No need to measure timestamp during navigation and account for
unload prompts. Fetch already measures the startTime. Patch it through to
`document load info` which is in turn accessed by the
`environment settings object`.

This is in line with current WebKit implementation, and very close to
Chromium implementation which currently doesn't count beforeunload
time as part of the navigation time.

Closes whatwg#7716
@domenic
Copy link
Member

domenic commented Mar 22, 2022

Who is the right person on the Chromium or Gecko sides to make the call here?

@noamr
Copy link
Contributor Author

noamr commented Mar 22, 2022

Who is the right person on the Chromium or Gecko sides to make the call here?

@sefeng211 @yoavweiss

noamr added a commit to noamr/html that referenced this issue Apr 5, 2022
No need to measure timestamp during navigation and account for
unload prompts. Fetch already measures the startTime. Patch it through to
`document load info` which is in turn accessed by the
`environment settings object`.

This is in line with current WebKit implementation, and very close to
Chromium implementation which currently doesn't count beforeunload
time as part of the navigation time.

Closes whatwg#7716
@yoavweiss
Copy link
Collaborator

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1316609
Chromium can most probably align with WebKit's definition, but we'd need to verify that won't result in too big of a disruption in practice before that happens.

@sefeng211
Copy link
Contributor

We are onboard about changes and will use https://bugzilla.mozilla.org/show_bug.cgi?id=1760010 to make the change. We'll also verify the results to make sure there's no big shift in the data.

@noamr
Copy link
Contributor Author

noamr commented Apr 22, 2022

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1316609 Chromium can most probably align with WebKit's definition, but we'd need to verify that won't result in too big of a disruption in practice before that happens.

Pages that would have a disruption would have a navigationEntry.startTime > 0 today, which is maybe easy-ish to probe?

noamr added a commit to noamr/html that referenced this issue Apr 22, 2022
No need to measure timestamp during navigation and account for
unload prompts. Fetch already measures the startTime. Patch it through to
`document load info` which is in turn accessed by the
`environment settings object`.

This is in line with current WebKit implementation, and very close to
Chromium implementation which currently doesn't count beforeunload
time as part of the navigation time.

Closes whatwg#7716
domenic pushed a commit that referenced this issue May 3, 2022
There's no need to measure the timestamp during navigation and account for beforeunload prompts. We can just use the start time already measured by Fetch.

This is in line with current WebKit implementation, and very close to Chromium implementation which currently doesn't count beforeunload time as part of the navigation time.

Closes #7716.
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
There's no need to measure the timestamp during navigation and account for beforeunload prompts. We can just use the start time already measured by Fetch.

This is in line with current WebKit implementation, and very close to Chromium implementation which currently doesn't count beforeunload time as part of the navigation time.

Closes whatwg#7716.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

6 participants