Skip to content

Commit 81d7284

Browse files
aarongustafsondomenicMarcos Cáceres
committed
Add the manifest link relation
This integrates the manifest link relation into the HTML Standard, using its existing link-fetching machinery to replace what was previously in https://w3c.github.io/manifest/#manifest-life-cycle. This includes the following changes from those algorithms: * It sets the request's client. * It respects the nonce="", integrity="", and referrerpolicy="" attributes. * It causes non-ok status responses to fail, instead of processing the response body anyway. * It sets the use-URL-credentials flag. * It changes the handling of the crossorigin="" attribute to be consistent with the modulepreload link relation, with a default of "same-origin" instead of "omit". Co-authored-by: Domenic Denicola <d@domenic.me> Co-authored-by: Marcos Cáceres <mcaceres@mozilla.com>
1 parent a2294a9 commit 81d7284

File tree

1 file changed

+103
-12
lines changed

1 file changed

+103
-12
lines changed

source

Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3976,6 +3976,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
39763976
<li><dfn data-x-href="https://storage.spec.whatwg.org/#legacy-clone-a-browsing-session-storage-shed">legacy-clone a browsing session storage shed</dfn></li>
39773977
</ul>
39783978
</dd>
3979+
3980+
<dt>Web App Manifest</dt>
3981+
3982+
<dd>
3983+
<p>The following features are defined in <cite>Web App Manifest</cite>: <ref spec=MANIFEST></p>
3984+
3985+
<ul class="brief">
3986+
<li><dfn data-x-href="https://w3c.github.io/manifest/#dfn-manifest">application manifest</dfn></li>
3987+
<li><dfn data-x-href="https://w3c.github.io/manifest/#dfn-installed-web-application">installed web application</dfn></li>
3988+
<li><dfn data-x-href="https://w3c.github.io/manifest/#dfn-processing-a-manifest">process the manifest</dfn></li>
3989+
</ul>
3990+
</dd>
39793991
</dl>
39803992

39813993
<hr>
@@ -6676,13 +6688,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
66766688
<p>The majority of fetches governed by <span data-x="CORS settings attribute">CORS settings
66776689
attributes</span> will be done via the <span>create a potential-CORS request</span> algorithm.</p>
66786690

6679-
<p>For <span data-x="module script">module scripts</span>, certain <span data-x="CORS settings
6680-
attribute">CORS settings attributes</span> have been repurposed to have a slightly different
6681-
meaning, wherein they only impact the <span data-x="concept-request">request</span>'s <span
6682-
data-x="concept-request-credentials-mode">credentials mode</span> (since the <span
6683-
data-x="concept-request-mode">mode</span> is always "<code data-x="">cors</code>"). To perform
6684-
this translation, we define the <dfn>module script credentials mode</dfn> for a given <span>CORS
6685-
settings attribute</span> to be determined by switching on the attribute's state:</p>
6691+
<p id="module-script-credentials-mode">For more modern features, where the request's <span
6692+
data-x="concept-request-mode">mode</span> is always "<code data-x="">cors</code>", certain <span
6693+
data-x="CORS settings attribute">CORS settings attributes</span> have been repurposed to have a
6694+
slightly different meaning, wherein they only impact the <span
6695+
data-x="concept-request">request</span>'s <span
6696+
data-x="concept-request-credentials-mode">credentials mode</span>. To perform this translation, we
6697+
define the <dfn>CORS settings attribute credentials mode</dfn> for a given <span>CORS settings
6698+
attribute</span> to be determined by switching on the attribute's state:</p>
66866699

66876700
<dl class="switch">
66886701
<dt><span data-x="attr-crossorigin-none">No CORS</span></dt>
@@ -13151,6 +13164,7 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
1315113164
<code data-x="rel-alternate">alternate</code>,
1315213165
<code data-x="rel-dns-prefetch">dns-prefetch</code>,
1315313166
<code data-x="rel-icon">icon</code>,
13167+
<code data-x="rel-manifest">manifest</code>,
1315413168
<code data-x="rel-modulepreload">modulepreload</code>,
1315513169
<code data-x="rel-next">next</code>,
1315613170
<code data-x="rel-pingback">pingback</code>,
@@ -23838,6 +23852,14 @@ document.body.appendChild(wbr);</code></pre>
2383823852
<td>Imports an icon to represent the current document.</td>
2383923853
</tr>
2384023854

23855+
<tr>
23856+
<td><code data-x="rel-manifest">manifest</code></td>
23857+
<td><span data-x="external resource link">External Resource</span></td>
23858+
<td colspan="2"><em>not allowed</em></td>
23859+
<td class="no"> &middot; </td>
23860+
<td>Imports or links to an <span>application manifest</span>. <ref spec=MANIFEST></td>
23861+
</tr>
23862+
2384123863
<tr>
2384223864
<td><code data-x="rel-modulepreload">modulepreload</code></td>
2384323865
<td><span data-x="external resource link">External Resource</span></td>
@@ -24441,6 +24463,72 @@ document.body.appendChild(wbr);</code></pre>
2444124463
</div>
2444224464

2444324465

24466+
<h5>Link type "<dfn><code data-x="rel-manifest">manifest</code></dfn>"</h5>
24467+
24468+
<p>The <code data-x="rel-manifest">manifest</code> keyword may be used with <code>link</code> elements.
24469+
This keyword creates an <span data-x="external resource link">external resource link</span>.</p>
24470+
24471+
<p>The <code data-x="rel-manifest">manifest</code> keyword indicates the manifest file that provides
24472+
metadata associated with the current document.</p>
24473+
24474+
<div w-nodev>
24475+
24476+
<p>There is no default type for resources given by the <code data-x="rel-manifest">manifest</code>
24477+
keyword.</p>
24478+
24479+
<p>The appropriate time to <span>fetch and process the linked resource</span> for this link type
24480+
is when the user agent deems it necessary. For example, when the user chooses to <span
24481+
data-x="installed web application">install the web application</span>. In that case, only the
24482+
first <code>link</code> element in <span>tree order</span> whose <code
24483+
data-x="attr-link-rel">rel</code> attribute contains the token <code
24484+
data-x="rel-manifest">manifest</code> may be used.</p>
24485+
24486+
<p>A user agent must not <span>delay the load event</span> for this link type.</p>
24487+
24488+
<p>The <span>linked resource fetch setup steps</span> for this type of linked resource, given a
24489+
<code>link</code> element <var>el</var> and <span data-x="concept-request">request</span>
24490+
<var>request</var>, are:</p>
24491+
24492+
<ol>
24493+
<li><p>Let <var>context</var> be <var>el</var>'s <span>node document</span>'s <span
24494+
data-x="concept-document-bc">browsing context</span>.</p></li>
24495+
24496+
<li><p>If <var>context</var> is null, then return false.</p></li>
24497+
24498+
<li><p>If <var>context</var> is not a <span>top-level browsing context</span>, then return
24499+
false.</p></li>
24500+
24501+
<li><p>Set <var>request</var>'s <span data-x="concept-request-initiator">initiator</span> to
24502+
"<code data-x="">manifest</code>".</p></li>
24503+
24504+
<li><p>Set <var>request</var>'s <span data-x="concept-request-destination">destination</span> to
24505+
"<code data-x="">manifest</code>".</p></li>
24506+
24507+
<li><p>Set <var>request</var>'s <span data-x="concept-request-mode">mode</span> to "<code
24508+
data-x="">cors</code>".</p></li>
24509+
24510+
<li><p>Set <var>request</var>'s <span data-x="concept-request-credentials-mode">credentials
24511+
mode</span> to the <span>CORS settings attribute credentials mode</span> for <var>el</var>'s
24512+
<code data-x="attr-link-crossorigin">crossorigin</code> content attribute.</p></li>
24513+
24514+
<li><p>Return true.</p></li>
24515+
</ol>
24516+
24517+
<p>To <span data-x="process the linked resource">process this type of linked resource</span> given
24518+
a <code>link</code> element <var>el</var>, boolean <var>success</var>, and <span
24519+
data-x="concept-response">response</span> <var>response</var>:</p>
24520+
24521+
<ol>
24522+
<li><p>If <var>response</var>'s <span data-x="Content-Type">Content-Type metadata</span> is not a
24523+
<span>JSON MIME type</span>, then set <var>success</var> to false.</p></li>
24524+
24525+
<li><p>If <var>success</var> is true, then <span>process the manifest</span> given <var>el</var>
24526+
and <var>response</var>. <ref spec=MANIFEST></p></li>
24527+
</ol>
24528+
24529+
</div>
24530+
24531+
2444424532
<h5>Link type "<dfn><code data-x="rel-modulepreload">modulepreload</code></dfn>"</h5>
2444524533

2444624534
<p>The <code data-x="rel-modulepreload">modulepreload</code> keyword may be used with
@@ -24521,8 +24609,8 @@ document.body.appendChild(wbr);</code></pre>
2452124609
<li><p>Let <var>settings object</var> be the <code>link</code> element's <span>node
2452224610
document</span>'s <span>relevant settings object</span>.</p></li>
2452324611

24524-
<li><p>Let <var>credentials mode</var> be the <span>module script credentials mode</span> for the
24525-
<code data-x="attr-link-crossorigin">crossorigin</code> attribute.</p></li>
24612+
<li><p>Let <var>credentials mode</var> be the <span>CORS settings attribute credentials
24613+
mode</span> for the <code data-x="attr-link-crossorigin">crossorigin</code> attribute.</p></li>
2452624614

2452724615
<li><p>Let <var>cryptographic nonce</var> be the current value of the element's
2452824616
<span>[[CryptographicNonce]]</span> internal slot.</p></li>
@@ -57863,9 +57951,9 @@ o............A....e
5786357951
<li><p>Let <var>classic script CORS setting</var> be the current state of the element's <code
5786457952
data-x="attr-script-crossorigin">crossorigin</code> content attribute.</p></li>
5786557953

57866-
<li><p>Let <var>module script credentials mode</var> be the <span>module script credentials
57867-
mode</span> for the element's <code data-x="attr-script-crossorigin">crossorigin</code> content
57868-
attribute.</p>
57954+
<li><p>Let <var>module script credentials mode</var> be the <span>CORS settings attribute
57955+
credentials mode</span> for the element's <code
57956+
data-x="attr-script-crossorigin">crossorigin</code> content attribute.</p>
5786957957

5787057958
<li><p>Let <var>cryptographic nonce</var> be the element's <span>[[CryptographicNonce]]</span>
5787157959
internal slot's value.</p></li>
@@ -121845,6 +121933,9 @@ INSERT INTERFACES HERE
121845121933
<dt id="refsMAILTO">[MAILTO]</dt>
121846121934
<dd>(Non-normative) <cite><a href="https://tools.ietf.org/html/rfc6068">The 'mailto' URI scheme</a></cite>, M. Duerst, L. Masinter, J. Zawinski. IETF.</dd>
121847121935

121936+
<dt id="refsMANIFEST">[MANIFEST]</dt>
121937+
<dd><cite><a href="https://www.w3.org/TR/appmanifest/">Web App Manifest</a></cite>, M. Caceres, K. Rohde Christiansen, M. Lamouri, A. Kostiainen, M. Giuca, A. Gustafson. W3C.</dd>
121938+
121848121939
<dt id="refsMATHML">[MATHML]</dt>
121849121940
<dd><cite><a href="https://www.w3.org/Math/draft-spec/">Mathematical Markup Language (MathML)</a></cite>, D. Carlisle, P. Ion, R. Miner. W3C.</dd>
121850121941

0 commit comments

Comments
 (0)