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

Create resource timing entries for HTML resources #6542

Closed
15 of 16 tasks
Tracked by #38
noamr opened this issue Mar 29, 2021 · 13 comments
Closed
15 of 16 tasks
Tracked by #38

Create resource timing entries for HTML resources #6542

noamr opened this issue Mar 29, 2021 · 13 comments
Labels
integration Better coordination across standards needed topic: fetch

Comments

@noamr
Copy link
Contributor

noamr commented Mar 29, 2021

Now that FETCH has the building blocks for measuring resource timings (see whatwg/fetch#1185 and w3c/resource-timing#252), the different resources have to integrate with it, so that the can decide exactly if and when to queue a resource timing entry.
The resources are:

Done:

In Progress:

Resources that should avoid creating a resource timing entry:

  • internal iframe navigation
  • downloaded link
  • WebSocket: not http(s), so doesn't get RT entries.
@annevk
Copy link
Member

annevk commented Apr 13, 2021

Also needs to consider the frame element. Probably works similarly to iframe, but maybe not?

@annevk annevk added integration Better coordination across standards needed topic: fetch labels Apr 13, 2021
@noamr
Copy link
Contributor Author

noamr commented Apr 15, 2021

Also needs to consider the frame element. Probably works similarly to iframe, but maybe not?

Updated.

@noamr
Copy link
Contributor Author

noamr commented Sep 23, 2021

Thinking about this and also about whatwg/fetch#590, I think that we need something like a "fetch a resource" algorithm/layer/mechanism in the HTML spec, equivalent to the different resource loaders found in the browser engine implementation.

This mechanism would deal with setting the initiator type for the resource when reporting, reporting network errors as opaque entries, setting FETCH priority by type, and keeping the preload responses.

@annevk WDYT? I can start jotting down something.

noamr added a commit to noamr/fetch that referenced this issue Sep 26, 2021
Also, report timing info for network errors for the fetch() APIs.
The timing info attached to a network error is always "opaque",
containing only start/end time and the original request URL.

This change currently only applies to the fetch API, and should be
applied to the different callers of FETCCH as part of
[this](whatwg/html#6542) and
[this](whatwg/xhr#319) work.

Closes whatwg#1215
@annevk
Copy link
Member

annevk commented Sep 28, 2021

What is reporting network errors as opaque entries?

And what exactly is keeping the preload responses? Isn't that something we want for all fetches?

@noamr
Copy link
Contributor Author

noamr commented Sep 28, 2021

What is reporting network errors as opaque entries?

The different callers, when they report the response. If the response is a network error, it will report it correctly.
Here, the fetch() API reports the timing info for the response even if it's a network error, and because the network error has an associated URL and opaque timing info, the "right thing" will happen.

And what exactly is keeping the preload responses? Isn't that something we want for all fetches?

Preload is an entirely different subject. See separate effort here. I would prefer to not create a dependency here and tackle the existing network error thing before we tackle preloads.

@annevk
Copy link
Member

annevk commented Sep 28, 2021

I see, generally I would like network error reporting to fall out of the same path we use for normal reporting and not require its own dedicated path.

@noamr
Copy link
Contributor Author

noamr commented Sep 28, 2021

I see, generally I would like network error reporting to fall out of the same path we use for normal reporting and not require its own dedicated path.

It generally wouldn't, except when the caller already has a dedicated path for network errors (like in the case of fetch() and xhr. We'll get to that when we start implementing these calls. I assume most of them will share a single call that fully loads an URL and reports at the end.

noamr added a commit to noamr/fetch that referenced this issue Sep 28, 2021
Also, report timing info for network errors for the fetch() APIs.
The timing info attached to a network error is always "opaque",
containing only start/end time and the original request URL.

This change currently only applies to the fetch API, and should be
applied to the different callers of FETCCH as part of
[this](whatwg/html#6542) and
[this](whatwg/xhr#319) work.

Closes whatwg#1215
noamr added a commit to noamr/html that referenced this issue Oct 3, 2021
Create a reusable function that fetches a resource and reports the
timing when done, given an initiator type.

Implement for the following fetches:
- link (not including style, yet)
- script (classic, module, worker, worklet, import)
- img (src, srcset)
- link (type=image)
- Media (audio, video, track, poster)
- A (download, ping)

TBD:
- Loading resources from CSS (mostly not in the HTML spec)
- preload/prefetch/prerender
- frames/iframes (might not be needed, as it's a navigation)

See whatwg#6542
@noamr
Copy link
Contributor Author

noamr commented Oct 3, 2021

See w3c/csswg-drafts#562 for CSS.

@triple-underscore
Copy link
Contributor

Along with the comit 8c0f013,
the following prose above the removed part (for image inputs):

Fetching the image must delay the load event of the element's node document until the task that is queued by the networking task source once the resource has been fetched (defined below) has been run.

the phrase "(defined below)" should also be updated to "(defined above)".

domenic pushed a commit that referenced this issue Feb 22, 2022
@annevk
Copy link
Member

annevk commented Feb 25, 2022

I'm a bit curious how <a download> works as the current setup in the specification is known to be broken. We want it to essentially be a navigation with a flag set. However, this would end up reporting it under resource timing, not navigation timing? It can probably be made to work, but it does create a weird inconsistency. Are navigation downloads also reported under resource timing?

@noamr
Copy link
Contributor Author

noamr commented Feb 25, 2022

I'm a bit curious how <a download> works as the current setup in the specification is known to be broken. We want it to essentially be a navigation with a flag set. However, this would end up reporting it under resource timing, not navigation timing? It can probably be made to work, but it does create a weird inconsistency. Are navigation downloads also reported under resource timing?

Those are not currently reported under resource/navigation timing at all.

domenic pushed a commit that referenced this issue Feb 27, 2022
Part of #6542.

This also improves the EventSource processing model in general to be more modern and rigorous.
domenic pushed a commit that referenced this issue Feb 27, 2022
domenic pushed a commit that referenced this issue Mar 30, 2022
@noamr
Copy link
Contributor Author

noamr commented Mar 31, 2022

All HTML reporters of resource timing are now specified (prefetch is not specified yet).
Suggesting to close!

@domenic
Copy link
Member

domenic commented Mar 31, 2022

Yay!! Congrats!

@domenic domenic closed this as completed Mar 31, 2022
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
Part of whatwg#6542.

This also improves the EventSource processing model in general to be more modern and rigorous.
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
mfreed7 pushed a commit to mfreed7/html that referenced this issue Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration Better coordination across standards needed topic: fetch
Development

No branches or pull requests

4 participants