7
7
8
8
< p > < a class ="logo " href ="https://whatwg.org/ "> < img alt ="WHATWG " height ="100 " src ="https://resources.whatwg.org/logo-fetch.svg " width ="100 "> </ a >
9
9
< h1 id ="cors "> Fetch</ h1 >
10
- < h2 class ="no-num no-toc " id ="living-standard-—-last-updated-5 -may-2016 "> Living Standard — Last Updated 5 May 2016</ h2 >
10
+ < h2 class ="no-num no-toc " id ="living-standard-—-last-updated-18 -may-2016 "> Living Standard — Last Updated 18 May 2016</ h2 >
11
11
12
12
< dl >
13
13
< dt > Participate:
@@ -975,10 +975,10 @@ <h4 id="requests"><span class="secno">3.1.5 </span>Requests</h4>
975
975
Unless stated otherwise, it is unset.
976
976
977
977
< p > A < a href ="#concept-request " title ="concept-request "> request</ a > has an associated
978
- < dfn id ="concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ dfn > , which is
979
- "< code title =""> default </ code > ", "< code title =""> no-store </ code > ", "< code title =""> reload </ code > ",
980
- "< code title =""> no -cache</ code > ", or "< code title =""> force-cache </ code > ". Unless stated otherwise, it is
981
- "< code title =""> default</ code > ".
978
+ < dfn id ="concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ dfn > , which is " < code title ="" > default </ code > ",
979
+ "< code title =""> no-store </ code > ", "< code title =""> reload </ code > ", "< code title =""> no-cache </ code > ",
980
+ "< code title =""> force -cache</ code > ", or "< code title =""> only-if-cached </ code > ". Unless stated otherwise,
981
+ it is "< code title =""> default</ code > ".
982
982
983
983
< div class ="note no-backref ">
984
984
< dl >
@@ -1001,8 +1001,14 @@ <h4 id="requests"><span class="secno">3.1.5 </span>Requests</h4>
1001
1001
1002
1002
< dt > "< code title =""> force-cache</ code > "
1003
1003
< dd > Fetch uses any response in the HTTP cache matching the request, not paying attention to
1004
- staleness. If there was no response, it creates a normal request updates the HTTP cache with the
1005
- response.
1004
+ staleness. If there was no response, it creates a normal request and updates the HTTP cache with
1005
+ the response.
1006
+
1007
+ < dt > "< code title =""> only-if-cached</ code > "
1008
+ < dd > Fetch uses any response in the HTTP cache matching the request, not paying attention to
1009
+ staleness. If there was no response, it returns a network error. (Can only be used when
1010
+ < a href ="#concept-request " title ="concept-request "> request</ a > 's < span tilte ="concept-request-mode "> mode</ span > is
1011
+ "< code title =""> same-origin</ code > ".)
1006
1012
</ dl >
1007
1013
1008
1014
< p > If < a href ="#concept-request-header-list " title ="concept-request-header-list "> header list</ a > contains a
@@ -3257,8 +3263,9 @@ <h3 id="http-network-or-cache-fetch"><span class="secno">5.5 </span>HTTP-network
3257
3263
< ol >
3258
3264
< li >
3259
3265
< p > If < var > httpRequest</ var > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ a > is
3260
- "< code title =""> force-cache</ code > ", set < var > response</ var > to the
3261
- < a href ="#concept-response " title ="concept-response "> response</ a > in the HTTP cache for < var > httpRequest</ var > .
3266
+ "< code title =""> force-cache</ code > " or "< code title =""> only-if-cached</ code > ", then set
3267
+ < var > response</ var > to the < a href ="#concept-response " title ="concept-response "> response</ a > in the HTTP cache for
3268
+ < var > httpRequest</ var > .
3262
3269
3263
3270
< p class ="note "> As mandated by HTTP, this still takes the `< code title ="http-vary "> Vary</ code > `
3264
3271
< a href ="#concept-header " title ="concept-header "> header</ a > into account.
@@ -3289,9 +3296,18 @@ <h3 id="http-network-or-cache-fetch"><span class="secno">5.5 </span>HTTP-network
3289
3296
< a href ="#concept-header " title ="concept-header "> headers</ a > .
3290
3297
<!-- XXX xref partial, modify, resume headers -->
3291
3298
3292
- < li > < p > If < var > response</ var > is null, set < var > response</ var > to the result of making an
3293
- < a href ="#concept-http-network-fetch " title ="concept-http-network-fetch "> HTTP-network fetch</ a > using < var > httpRequest</ var > with
3294
- the < i title =""> credentials flag</ i > set if set.
3299
+ < li >
3300
+ < p > If < var > response</ var > is null, run these substeps:
3301
+
3302
+ < ol >
3303
+ < li > < p > If < var > httpRequest</ var > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ a > is
3304
+ "< code title =""> only-if-cached</ code > ", then return a
3305
+ < a href ="#concept-network-error " title ="concept-network-error "> network error</ a > .
3306
+
3307
+ < li > < p > Set < var > response</ var > to the result of making an
3308
+ < a href ="#concept-http-network-fetch " title ="concept-http-network-fetch "> HTTP-network fetch</ a > using < var > httpRequest</ var >
3309
+ with the < i title =""> credentials flag</ i > set if set.
3310
+ </ ol >
3295
3311
3296
3312
< li >
3297
3313
< p > If < var > response</ var > 's < a href ="#concept-status " title ="status "> status</ a > is < code > 304</ code > and
@@ -4446,7 +4462,7 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
4446
4462
enum < dfn id ="requestdestination "> RequestDestination</ dfn > { "", "document", "embed", "font", "image", "manifest", "media", "object", "report", "script", "serviceworker", "sharedworker", "style", "worker", "xslt" };
4447
4463
enum < dfn id ="requestmode "> RequestMode</ dfn > { "navigate", "same-origin", "no-cors", "cors" };
4448
4464
enum < dfn id ="requestcredentials "> RequestCredentials</ dfn > { "omit", "same-origin", "include" };
4449
- enum < dfn id ="requestcache "> RequestCache</ dfn > { "default", "no-store", "reload", "no-cache", "force-cache" };
4465
+ enum < dfn id ="requestcache "> RequestCache</ dfn > { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
4450
4466
enum < dfn id ="requestredirect "> RequestRedirect</ dfn > { "follow", "error", "manual" };</ pre >
4451
4467
4452
4468
< p class ="note no-backref "> "< code > serviceworker</ code > " is omitted from
@@ -4655,6 +4671,11 @@ <h3 id="request-class"><span class="secno">6.3 </span>Request class</h3>
4655
4671
< var > request</ var > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ a > to
4656
4672
it.
4657
4673
4674
+ < li > < p > If < var > request</ var > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache mode</ a > is
4675
+ "< code title =""> only-if-cached</ code > " and < var > request</ var > 's
4676
+ < a href ="#concept-request-mode " title ="concept-request-mode "> mode</ a > is < em > not</ em > "< code title =""> same-origin</ code > ", then
4677
+ < a class ="external " data-anolis-spec ="webidl " href ="https://heycam.github.io/webidl/#dfn-throw "> throw</ a > a < code title =""> TypeError</ code > .
4678
+
4658
4679
< li > < p > If < var > init</ var > 's < code title =""> redirect</ code > member is present, set
4659
4680
< var > request</ var > 's < a href ="#concept-request-redirect-mode " title ="concept-request-redirect-mode "> redirect mode</ a >
4660
4681
to it.
@@ -5453,7 +5474,7 @@ <h2 class="no-num" id="references">References</h2>
5453
5474
< dd > (Non-normative) < cite > < a href ="https://tools.ietf.org/html/rfc6454 "> The Web Origin Concept</ a > </ cite > , Adam Barth. IETF.
5454
5475
5455
5476
< dt id ="refsREFERRER "> [REFERRER]
5456
- < dd > < cite > < a href ="https://w3c.github.io/webappsec-referrer-policy/ "> Referrer Policy</ a > </ cite > , Jochen Eisinger and Mike West . W3C.
5477
+ < dd > < cite > < a href ="https://w3c.github.io/webappsec-referrer-policy/ "> Referrer Policy</ a > </ cite > , Jochen Eisinger and Emily Stark . W3C.
5457
5478
5458
5479
< dt id ="refsRFC2119 "> [RFC2119]
5459
5480
< dd > < cite > < a href ="https://tools.ietf.org/html/rfc2119 "> Key words for use in RFCs to Indicate Requirement Levels</ a > </ cite > , Scott Bradner. IETF.
0 commit comments