[ResourceTiming] startTime definition

I believe the startTime attribute definition in the Resource Timing spec, https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#startTime-attribute, needs clarification. The current definition is:

The startTime attribute must return a DOMHighResTimeStamp<http://www.w3.org/TR/hr-time/#domhighrestimestamp> with the time immediately before the user agent starts to queue the resource for fetching<http://www.w3.org/TR/html5/fetching-resources.html#fetch>. If there are HTTP redirects or equivalent<http://www.w3.org/TR/html5/fetching-resources.html#concept-http-equivalent-codes> when fetching the resource, and if all the redirects or equivalent are from the same origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#origin> as the current document or the Timing-Allow-Origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#timing-allow-origin> HTTP response header rules are met, this attribute must return the same value as redirectStart<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#dom-performanceresourcetiming-redirectstart>. Otherwise, this attribute must return the same value as fetchStart<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#dom-performanceresourcetiming-fetchstart>.

The first sentence states that the startTime is the time when the user agent starts to queue the resource for fetching. However, the second sentence states that in the case where same-origin redirects or non-same oricgin redirects that meet the Timing-Allow-Origin rules occur, startTime is equal in value to redirectStart, which is the starting time of the fetch that initiates the redirect. In this case, it's unclear why the definition of startTime would not want to include the time the user agent spends queuing the resource before the fetch that initiates the redirect process.

The third sentence is a bit ambiguous as 'otherwise' could refer to many things. The sentence seems to suggest that if a redirect occurs from a non-same origin and Timing-Allow-Origin rules are not met, then startTime should be equal to fetchStart, which is the time when a user agent starts fetching the resource. It's unclear why the definition would not include the queuing time for the final redirected resource. In this case, to be more consistent with the first sentence, startTime should be equal to the time the user agent queues the final redirected resource for fetching.

I believe the following spec text will better clarify the intended behavior:

The startTime attribute must return a DOMHighResTimeStamp<http://www.w3.org/TR/hr-time/#domhighrestimestamp> with the time immediately before the user agent starts to queue the resource for fetching<http://www.w3.org/TR/html5/fetching-resources.html#fetch>.

If there are HTTP redirects or equivalent<http://www.w3.org/TR/html5/fetching-resources.html#concept-http-equivalent-codes> when fetching the resource, and if all the redirects or equivalent are from the same origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#origin> as the current document or the Timing-Allow-Origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#timing-allow-origin> HTTP response header rules are met, this attribute must return a DOMHighResTimeStamp<http://www.w3.org/TR/hr-time/#domhighrestimestamp> with the time immediately before the user agent starts to queue the fetch<http://www.w3.org/TR/html5/fetching-resources.html#fetch> that initiates the redirect process for the resource.

If there are HTTP redirects or equivalent<http://www.w3.org/TR/html5/fetching-resources.html#concept-http-equivalent-codes> when fetching the resource and if any of the redirects or equivalent are not from the same origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#origin> as the current document and the Timing-Allow-Origin<https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html#timing-allow-origin> HTTP response header rules are not met, this attribute must return a DOMHighResTimeStamp<http://www.w3.org/TR/hr-time/#domhighrestimestamp> with the time immediately before the user agent starts to queue the fetch<http://www.w3.org/TR/html5/fetching-resources.html#fetch> of the final resource in the redirect process.

Thanks,
Jatinder

Received on Tuesday, 15 May 2012 17:16:12 UTC