Skip to content

Commit

Permalink
Set requests' render-blocking flag based on blocking="render"
Browse files Browse the repository at this point in the history
See whatwg/fetch#1433 and whatwg/fetch#1432 for background.
  • Loading branch information
xiaochengh authored Jun 1, 2022
1 parent 0b6a5dd commit a4ccf54
Showing 1 changed file with 37 additions and 9 deletions.
46 changes: 37 additions & 9 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2613,6 +2613,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x="concept-request-reload-navigation-flag" data-x-href="https://fetch.spec.whatwg.org/#concept-request-reload-navigation-flag">reload-navigation flag</dfn></li>
<li><dfn data-x="concept-request-history-navigation-flag" data-x-href="https://fetch.spec.whatwg.org/#concept-request-history-navigation-flag">history-navigation flag</dfn></li>
<li><dfn data-x="concept-request-user-activation" data-x-href="https://fetch.spec.whatwg.org/#request-user-activation">user-activation</dfn></li>
<li><dfn data-x="concept-request-render-blocking" data-x-href="https://fetch.spec.whatwg.org/#request-render-blocking">render-blocking</dfn></li>
<li><dfn data-x-href="https://fetch.spec.whatwg.org/#concept-request-add-range-header">add a range header</dfn></li>
</ul>
</li>
Expand Down Expand Up @@ -16297,6 +16298,13 @@ console.log(style.disabled); // false</code></pre>
complete, or, if the style sheet has no <span>critical subresources</span>, once the style sheet
has been parsed and processed, the user agent must run these steps:</p>

<p class="XXX">Fetching the <span>critical subresources</span> is not well-defined; probably <a
href="https://github.com/whatwg/html/issues/968">issue #968</a> is the best resolution for that.
In the meantime, any <span data-x="critical subresources">critical subresource</span> <span
data-x="concept-request">request</span> should have its <span
data-x="concept-request-render-blocking">render-blocking</span> set to whether or not the
<code>style</code> element is currently <span>render-blocking</span>.</p>

<ol>
<li><p>Let <var>element</var> be the <code>style</code> element associated with the style sheet
in question.</p></li>
Expand Down Expand Up @@ -26742,8 +26750,8 @@ document.body.appendChild(wbr);</code></pre>
supported style sheet type, the user agent must instead assume it to be <code>text/css</code>.</p>

<p>The <span>linked resource fetch setup steps</span> for this type of linked resource, given a
<code>link</code> element <var>el</var> (ignoring the <span
data-x="concept-request">request</span>) are:</p>
<code>link</code> element <var>el</var> and <span data-x="concept-request">request</span>
<var>request</var>, are:</p>

<ol>
<li><p>If <var>el</var>'s <code data-x="attr-link-disabled">disabled</code> attribute is set,
Expand All @@ -26758,13 +26766,19 @@ document.body.appendChild(wbr);</code></pre>
<span>potentially render-blocking</span>, then <span>block rendering</span> on
<var>el</var>.</p></li>

<li><p>If <var>el</var> is currently <span>render-blocking</span>, then set <var>request</var>'s
<span data-x="concept-request-render-blocking">render-blocking</span> to true.</p></li>

<li><p>Return true.</p></li>
</ol>

<p class="XXX">See <a href="https://github.com/whatwg/html/issues/968">issue #968</a> for plans to
use the CSSOM <a href="https://drafts.csswg.org/cssom/#fetching-css-style-sheets">fetch a CSS
<p class="XXX">See <a href="https://github.com/whatwg/html/issues/968">issue #968</a> for plans
to use the CSSOM <a href="https://drafts.csswg.org/cssom/#fetching-css-style-sheets">fetch a CSS
style sheet</a> algorithm instead of the <span>default fetch and process the linked
resource</span> algorithm.</p>
resource</span> algorithm. In the meantime, any <span data-x="critical subresources">critical
subresource</span> <span data-x="concept-request">request</span> should have its <span
data-x="concept-request-render-blocking">render-blocking</span> set to whether or not the
<code>link</code> element is currently <span>render-blocking</span>.</p>

<p>To <span data-x="process the linked resource">process this type of linked resource</span>
given a <code>link</code> element <var>el</var>, boolean <var>success</var>, and <span
Expand Down Expand Up @@ -60645,6 +60659,10 @@ o............A....e
<li><p>Set <var>el</var>'s <span data-x="concept-script-delay-load">delaying the load
event</span> to true.</p></li>

<li><p>If <var>el</var> is currently <span>render-blocking</span>, then set
<var>options</var>'s <span data-x="concept-script-fetch-options-render-blocking">
render-blocking</span> to true.</p></li>

<li>
<p>Switch on <var>el</var>'s <span data-x="concept-script-type">type</span>:</p>

Expand Down Expand Up @@ -93243,6 +93261,12 @@ document.querySelector("button").addEventListener("click", bound);

<dd><p>The <span data-x="concept-request-referrer-policy">referrer policy</span> used for the
initial fetch and for fetching any imported modules</p></dd>

<dt><dfn data-x="concept-script-fetch-options-render-blocking">render-blocking</dfn></dt>

<dd><p>The boolean value of <span data-x="concept-request-render-blocking">render-blocking</span>
used for the initial fetch and for fetching any imported modules. Unless otherwise stated, its
value is false.</p></dd>
</dl>

<p class="note">Recall that via the <code>import()</code> feature, <span data-x="classic
Expand All @@ -93269,9 +93293,11 @@ document.querySelector("button").addEventListener("click", bound);
data-x="concept-request-integrity-metadata">integrity metadata</span> to <var>options</var>'s
<span data-x="concept-script-fetch-options-integrity">integrity metadata</span>, its <span
data-x="concept-request-parser-metadata">parser metadata</span> to <var>options</var>'s <span
data-x="concept-script-fetch-options-parser">parser metadata</span>, and its <span
data-x="concept-script-fetch-options-parser">parser metadata</span>, its <span
data-x="concept-request-referrer-policy">referrer policy</span> to <var>options</var>'s <span
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>.</p></dd>
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>, and its
<span data-x="concept-request-render-blocking">render-blocking</span> to <var>options</var>'s
<span data-x="concept-script-fetch-options-render-blocking">render-blocking</span>.</p></dd>

<dt><dfn>set up the module script request</dfn></dt>
<dd><p>Set <var>request</var>'s <span data-x="concept-request-nonce-metadata">cryptographic nonce
Expand All @@ -93282,9 +93308,11 @@ document.querySelector("button").addEventListener("click", bound);
data-x="concept-request-parser-metadata">parser metadata</span> to <var>options</var>'s <span
data-x="concept-script-fetch-options-parser">parser metadata</span>, its <span
data-x="concept-request-credentials-mode">credentials mode</span> to <var>options</var>'s <span
data-x="concept-script-fetch-options-credentials">credentials mode</span>, and its <span
data-x="concept-script-fetch-options-credentials">credentials mode</span>, its <span
data-x="concept-request-referrer-policy">referrer policy</span> to <var>options</var>'s <span
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>.</p></dd>
data-x="concept-script-fetch-options-referrer-policy">referrer policy</span>, and its
<span data-x="concept-request-render-blocking">render-blocking</span> to <var>options</var>'s
<span data-x="concept-script-fetch-options-render-blocking">render-blocking</span>.</p></dd>
</dl>

<p>For any given <span>script fetch options</span> <var>options</var>, the <dfn>descendant script
Expand Down

0 comments on commit a4ccf54

Please sign in to comment.