Skip to content

Commit

Permalink
Fix |routerRules| handling
Browse files Browse the repository at this point in the history
  • Loading branch information
azaika committed Dec 14, 2023
1 parent d3bad31 commit 46a5f2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1575,13 +1575,13 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/

The <dfn method for="InstallEvent"><code>addRoutes(|rules|)</code></dfn> method steps are:

1. Let |routerRules| be a list of {{RouterRule}} dictionaries.
1. Let |hasFetchEventSource| be a boolean, initially false.
1. Let |serviceWorker| be the [=current global object=]'s associated [=ServiceWorkerGlobalScope/service worker=].
1. Let |routerRules| be a copy of |serviceWorker|'s [=list of router rules=].
1. Let |hasFetchEventSource| be a boolean, initially false.
1. If |serviceWorker|'s [=list of router rules=] [=list/contains=] a {{RouterRule}} whose {{RouterRule/source}} is "{{RouterSource/fetch-event}}", set |hasFetchEventSource| to true.
1. If |rules| is a {{RouterRule}} dictionary, set |rules| to &#x00AB; |rules| &#x00BB;.
1. For each |rule| of |rules|:
1. If running [=Verify Router Rule=] algorithm with |rule| and [=/service worker=] returns false, [=throw=] a {{TypeError}}.
1. If running [=Verify Router Rule=] algorithm with |rule| and |serviceWorker| returns false, [=throw=] a {{TypeError}}.
1. If |rule|'s {{RouterRule/source}} is "{{RouterSource/fetch-event}}", set |hasFetchEventSource| to true.
1. Append |rule| to |routerRules|.
1. If |hasFetchEventSource| is true and |serviceWorker|'s [=set of event types to handle=] does not [=set/contain=] {{ServiceWorkerGlobalScope/fetch!!event}}, [=throw=] a {{TypeError}}.
Expand Down

0 comments on commit 46a5f2e

Please sign in to comment.