Skip to content

Commit

Permalink
Add "cache" source support.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshisatoyanagisawa committed Jan 15, 2024
1 parent a44f9a4 commit f04776c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
URLPatternCompatible urlPattern;
};

enum RouterSource { "fetch-event", "network" };
enum RouterSource { "cache", "fetch-event", "network" };
</pre>

<section>
Expand Down Expand Up @@ -3110,7 +3110,15 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
1. If |request|'s [=request/destination=] is either "<code>embed</code>" or "<code>object</code>", then:
1. Return null.
1. Else if |registration|'s <a>active worker</a>'s [=service worker/list of router rules=] is [=list/is not empty=]:
1. If running [=Get Router Source=] algorithm with |registration|'s <a>active worker</a> and |request| returns "network", return null.
1. Let |source| be a result of running [=Get Router Source=] algorithm with |registration|'s <a>active worker</a> and |request|.
1. If |source| is "network", return null.
1. Else if |source| is "cache":
1. Let |cache promise| be a result of {{cache/matchAll(|request|, {})}}
1. [=Upon fulfillment=] of |cache promise| with |cache response|:
1. If |cache response| is not a {{Response}} object, return null.
1. Set |response| to |cache response|.
1. Return |response|
1. Return null.
1. Else if |request| is a <a>non-subresource request</a>, then:
1. If |reservedClient| is not null and is an <a>environment settings object</a>, then:
1. If |reservedClient| is not a <a>secure context</a>, return null.
Expand Down

0 comments on commit f04776c

Please sign in to comment.