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 "> Fetchh1 >
10
- < h2 class ="no-num no-toc " id ="living-standard-—-last-updated-5 -may-2016 "> Living Standard — Last Updated 5 May 2016h2 >
10
+ < h2 class ="no-num no-toc " id ="living-standard-—-last-updated-18 -may-2016 "> Living Standard — Last Updated 18 May 2016h2 >
11
11
12
12
< dl >
13
13
< dt > Participate:
@@ -975,10 +975,10 @@
3.1.5 Requests
975
975
Unless stated otherwise, it is unset.
976
976
977
977
< p > A < a href ="#concept-request " title ="concept-request "> requesta > has an associated
978
- < dfn id ="concept-request-cache-mode " title ="concept-request-cache-mode "> cache modedfn > , which is
979
- "< code title =""> default code > ", "< code title =""> no-store code > ", "< code title =""> reload code > ",
980
- "< code title =""> no -cachecode > ", or "< code title =""> force-cache code > ". Unless stated otherwise, it is
981
- "< code title =""> defaultcode > ".
978
+ < dfn id ="concept-request-cache-mode " title ="concept-request-cache-mode "> cache modedfn > , 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 -cachecode > ", or "< code title =""> only-if-cached code > ". Unless stated otherwise,
981
+ it is "< code title =""> defaultcode > ".
982
982
983
983
< div class ="note no-backref ">
984
984
< dl >
@@ -1001,8 +1001,14 @@
3.1.5 Requests
1001
1001
1002
1002
< dt > "< code title =""> force-cachecode > "
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-cachedcode > "
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 "> requesta > 's < span tilte ="concept-request-mode "> modespan > is
1011
+ "< code title =""> same-origincode > ".)
1006
1012
dl >
1007
1013
1008
1014
< p > If < a href ="#concept-request-header-list " title ="concept-request-header-list "> header lista > contains a
@@ -3257,8 +3263,9 @@
5.5 HTTP-network
3257
3263
< ol >
3258
3264
< li >
3259
3265
< p > If < var > httpRequestvar > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache modea > is
3260
- "< code title =""> force-cachecode > ", set < var > responsevar > to the
3261
- < a href ="#concept-response " title ="concept-response "> responsea > in the HTTP cache for < var > httpRequestvar > .
3266
+ "< code title =""> force-cachecode > " or "< code title =""> only-if-cachedcode > ", then set
3267
+ < var > responsevar > to the < a href ="#concept-response " title ="concept-response "> responsea > in the HTTP cache for
3268
+ < var > httpRequestvar > .
3262
3269
3263
3270
< p class ="note "> As mandated by HTTP, this still takes the `< code title ="http-vary "> Varycode > `
3264
3271
< a href ="#concept-header " title ="concept-header "> headera > into account.
@@ -3289,9 +3296,18 @@
5.5 HTTP-network
3289
3296
< a href ="#concept-header " title ="concept-header "> headersa > .
3290
3297
3291
3298
3292
- < li > < p > If < var > responsevar > is null, set < var > responsevar > to the result of making an
3293
- < a href ="#concept-http-network-fetch " title ="concept-http-network-fetch "> HTTP-network fetcha > using < var > httpRequestvar > with
3294
- the < i title =""> credentials flagi > set if set.
3299
+ < li >
3300
+ < p > If < var > responsevar > is null, run these substeps:
3301
+
3302
+ < ol >
3303
+ < li > < p > If < var > httpRequestvar > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache modea > is
3304
+ "< code title =""> only-if-cachedcode > ", then return a
3305
+ < a href ="#concept-network-error " title ="concept-network-error "> network errora > .
3306
+
3307
+ < li > < p > Set < var > responsevar > to the result of making an
3308
+ < a href ="#concept-http-network-fetch " title ="concept-http-network-fetch "> HTTP-network fetcha > using < var > httpRequestvar >
3309
+ with the < i title =""> credentials flagi > set if set.
3310
+ ol >
3295
3311
3296
3312
< li >
3297
3313
< p > If < var > responsevar > 's < a href ="#concept-status " title ="status "> statusa > is < code > 304code > and
@@ -4446,7 +4462,7 @@
6.3 Request class
4446
4462
enum < dfn id ="requestdestination "> RequestDestinationdfn > { "", "document", "embed", "font", "image", "manifest", "media", "object", "report", "script", "serviceworker", "sharedworker", "style", "worker", "xslt" };
4447
4463
enum < dfn id ="requestmode "> RequestModedfn > { "navigate", "same-origin", "no-cors", "cors" };
4448
4464
enum < dfn id ="requestcredentials "> RequestCredentialsdfn > { "omit", "same-origin", "include" };
4449
- enum < dfn id ="requestcache "> RequestCachedfn > { "default", "no-store", "reload", "no-cache", "force-cache" };
4465
+ enum < dfn id ="requestcache "> RequestCachedfn > { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
4450
4466
enum < dfn id ="requestredirect "> RequestRedirectdfn > { "follow", "error", "manual" };pre >
4451
4467
4452
4468
< p class ="note no-backref "> "< code > serviceworkercode > " is omitted from
@@ -4655,6 +4671,11 @@
6.3 Request class
4655
4671
< var > requestvar > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache modea > to
4656
4672
it.
4657
4673
4674
+ < li > < p > If < var > requestvar > 's < a href ="#concept-request-cache-mode " title ="concept-request-cache-mode "> cache modea > is
4675
+ "< code title =""> only-if-cachedcode > " and < var > requestvar > 's
4676
+ < a href ="#concept-request-mode " title ="concept-request-mode "> modea > is < em > notem > "< code title =""> same-origincode > ", then
4677
+ < a class ="external " data-anolis-spec ="webidl " href ="https://heycam.github.io/webidl/#dfn-throw "> throwa > a < code title =""> TypeErrorcode > .
4678
+
4658
4679
< li > < p > If < var > initvar > 's < code title =""> redirectcode > member is present, set
4659
4680
< var > requestvar > 's < a href ="#concept-request-redirect-mode " title ="concept-request-redirect-mode "> redirect modea >
4660
4681
to it.
@@ -5453,7 +5474,7 @@
References
5453
5474
< dd > (Non-normative) < cite > < a href ="https://tools.ietf.org/html/rfc6454 "> The Web Origin Concepta > 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 Policya > cite > , Jochen Eisinger and Mike West . W3C.
5477
+ < dd > < cite > < a href ="https://w3c.github.io/webappsec-referrer-policy/ "> Referrer Policya > 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 Levelsa > cite > , Scott Bradner. IETF.
0 commit comments