Skip to content

Report A and script loading to resource timing #7180

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

Merged
merged 15 commits into from
Jan 27, 2022
51 changes: 39 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2492,6 +2492,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="serialize-a-response-url-for-reporting" data-x-href="https://fetch.spec.whatwg.org/#serialize-a-response-url-for-reporting">serialize a response URL for reporting</dfn></li>
<li><dfn data-x="body safely extract" data-x-href="https://fetch.spec.whatwg.org/#bodyinit-safely-extract">safely extracting a body</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#process-response-end-of-body">processResponseConsumeBody</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#fetch-processresponseendofbody">processResponseEndOfBody</dfn></li>
<li>
<dfn data-x="concept-response"
data-x-href="https://fetch.spec.whatwg.org/#concept-response">response</dfn> and its
Expand Down Expand Up @@ -24203,12 +24204,14 @@ document.body.appendChild(wbr);</code></pre>
<li><p>Optionally, return. (For example, the user agent might wish to ignore any or
all ping URLs in accordance with the user's expressed preferences.)</p></li>

<li><p>Let <var>settingsObject</var> be the element's <span>node document</span>'s
<span>relevant settings object</span>.</p></li>

<li><p>Let <var>request</var> be a new <span data-x="concept-request">request</span> whose
<span data-x="concept-request-url">URL</span> is <var>ping URL</var>, <span
data-x="concept-request-method">method</span> is `<code data-x="">POST</code>`, <span
data-x="concept-request-body">body</span> is `<code data-x="">PING</code>`, <span
data-x="concept-request-client">client</span> is the <span>environment settings object</span> of
the <code>Document</code> containing the <span>hyperlink</span>, <span
data-x="concept-request-client">client</span> is <var>settingsObject</var>, <span
data-x="concept-request-destination">destination</span> is the empty string,
<span data-x="concept-request-credentials-mode">credentials mode</span> is "<code
data-x="">include</code>", <span data-x="concept-request-referrer">referrer</span> is "<code
Expand Down Expand Up @@ -24240,7 +24243,12 @@ document.body.appendChild(wbr);</code></pre>
</dl>
</li>

<!--FETCH--><li><p><span data-x="concept-fetch">Fetch</span> <var>request</var>.</p></li>
<li><p><span data-x="concept-fetch">Fetch</span> <var>request</var>, with <i
data-x="processResponseEndOfBody">processResponseEndOfBody</i> given <span
data-x="concept-response">response</span> <var>res</var> set to <span>finalize and report
timing</span> with <var>res</var>, <var>settingsObject</var>'s <span
data-x="concept-settings-object-global">global object</span>, and "<code
data-x="">ping</code>".</p></li>
</ol>

<p>This may be done <span>in parallel</span> with the primary fetch, and is independent of the
Expand Down Expand Up @@ -91858,13 +91866,18 @@ document.querySelector("button").addEventListener("click", bound);
remaining steps.</p>

<p>Otherwise, <span data-x="concept-fetch">fetch</span> <var>request</var>. Return from this
algorithm, and run the remaining steps as part of the fetch's <span>process response</span> for
the <span data-x="concept-response">response</span> <var>response</var>.</p>
algorithm, and run the remaining steps as part of the fetch's <i
data-x="processResponseConsumeBody">processResponseConsumeBody</i> given <span
data-x="concept-response">response</span> <var>response</var>.</p>

<p class="note"><var>response</var> can be either <span>CORS-same-origin</span> or
<span>CORS-cross-origin</span>. This only affects how error reporting happens.</p>
</li>

<li><p><span>Finalize and report timing</span> with <var>response</var>, <var>settings
object</var>'s <span data-x="concept-settings-object-global">global object</span>, and "<code
data-x="">script</code>".</p></li>

<li><p>Set <var>response</var> to <var>response</var>'s <span>unsafe response</span>.</p></li>

<li>
Expand Down Expand Up @@ -91927,10 +91940,15 @@ document.querySelector("button").addEventListener("click", bound);
remaining steps.</p>

<p>Otherwise, <span data-x="concept-fetch">fetch</span> <var>request</var>. Return from this
algorithm, and run the remaining steps as part of the fetch's <span>process response</span> for
the <span data-x="concept-response">response</span> <var>response</var>.</p>
algorithm, and run the remaining steps as part of the fetch's <i
data-x="processResponseConsumeBody">processResponseConsumeBody</i> given <span
data-x="concept-response">response</span> <var>response</var>.<p>
</li>

<li><p><span>Finalize and report timing</span> with <var>response</var>, <var>fetch client
settings object</var>'s <span data-x="concept-settings-object-global">global object</span>, and
"<code data-x="">other</code>".</p></li>

<li><p>Set <var>response</var> to <var>response</var>'s <span>unsafe response</span>.</p></li>

<li>
Expand All @@ -91946,7 +91964,6 @@ document.querySelector("button").addEventListener("click", bound);

<p>then asynchronously complete this algorithm with null, and return.</p>
</li>

<li>
<p>If both of the following conditions are met:</p>

Expand Down Expand Up @@ -92004,6 +92021,10 @@ document.querySelector("button").addEventListener("click", bound);
also finish their work synchronously.</p>
</li>

<li><p><span>Finalize and report timing</span> with <var>response</var>, <var>settings
object</var>'s <span data-x="concept-settings-object-global">global object</span>, and "<code
data-x="">other</code>".</p></li>

<li><p>Set <var>response</var> to <var>response</var>'s <span>unsafe response</span>.</p></li>

<li>
Expand Down Expand Up @@ -92198,8 +92219,9 @@ document.querySelector("button").addEventListener("click", bound);
"<code data-x="">fetching</code>".</p></li>

<li>
<p><span data-x="concept-fetch">Fetch</span> <var>request</var>. To <span>process
response</span> for the <span data-x="concept-response">response</span> <var>response</var>:</p>
<p><span data-x="concept-fetch">Fetch</span> <var>request</var>, with <i
data-x="processResponseConsumeBody">processResponseConsumeBody</i> set to the following steps
given <span data-x="concept-response">response</span> <var>response</var>:</p>

<ol>
<li><p>Set <var>moduleResponsesMap</var>[<var>requestURL</var>] to
Expand Down Expand Up @@ -92604,12 +92626,17 @@ document.querySelector("button").addEventListener("click", bound);
data-x="concept-response">response</span> <var>response</var>, run the remaining steps.</p>

<p>Otherwise, <span data-x="concept-fetch">fetch</span> <var>request</var>. Return from this
algorithm, and run the remaining steps as part of the fetch's <span>process response</span> for
the <span data-x="concept-response">response</span> <var>response</var>.</p>
algorithm, and run the remaining steps as part of the fetch's <i
data-x="processResponseConsumeBody">processResponseConsumeBody</i> given <span
data-x="concept-response">response</span> <var>response</var>.</p>

<p class="note"><var>response</var> is always <span>CORS-same-origin</span>.</p>
</li>

<li><p><span>Finalize and report timing</span> with <var>response</var>, <var>fetch client
settings object</var>'s <span data-x="concept-settings-object-global">global object</span>, and
"<code data-x="">other</code>".</p></li>

<li>
<p>If either of the following conditions are met:</p>

Expand Down