RE: [Resource Timing] Handling duplicate requests

I believe the key point here is whether the resource was fetched. The spec states:

"The PerformanceResourceTiming interface must include all resources fetched from the networking layer by the current browsing context."
"For each resource fetched by the current browsing context, perform the following steps".

The HTML5 definition of fetch,, states:

"If the resource is identified by an absolute URL, and the resource is to be obtained using an idempotent action (such as an HTTP GET or equivalent), and it is already being downloaded for other reasons (e.g. another invocation of this algorithm), and this request would be identical to the previous one (e.g. same Accept and Origin headers), and the user agent is configured such that it is to reuse the data from the existing download instead of initiating a new one, then use the results of the existing download instead of starting a new one."

So, it would seem that the definition of fetch includes when the networking layer gets resources from the cache, instead of the wire.

For case number 2, where two requesters are in different documents asking for the same resource, I think we should go with your suggestion to show the time spent waiting in each phase. As you stated, if the DNS lookup occurred before the second document started fetching, it would be 0, but the rest of the fields would be populated as expected. This would reduce confusion, as otherwise it may not be clear to a developer why their resources are not shown in the timeline.

We may need to clarify this behavior in the spec, if this is what we decide.

For case number 1, where two requestors are in the same document, technically, we should be including all duplicate resources as well. Except the cases where we are going to in-memory browser caches, instead of fetching from the network layer, per the following non-normative example:

"If the same canonical URL is used as the src attribute of two HTML IMG elements, the fetch of the resource initiated by the first HTML IMG element should be included in the PerformanceResourceTiming interface. The user agent might not re-request the URL from the networking layer for the second HTML IMG element, instead using an in-memory browser cache. In this case, there is only a single request sent to the networking layer for retrieval, so the fetch of the resource by the first IMG element would be the only occurrence in the PerformanceResourceTiming interface."

This case may already be clear in the spec.


Received on Wednesday, 5 December 2012 19:10:54 UTC