-
Notifications
You must be signed in to change notification settings - Fork 320
Allow the addRoutes() to be called during installing #1744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
494d7c6
51242ff
1f867a7
4556ac0
7cd9483
d3082ca
050f195
f5fafc7
60ea69b
2c61b5b
7d434ca
7ebfac4
487292c
b8ab89e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1605,15 +1605,27 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/ | |
|
|
||
| The <dfn method for="InstallEvent"><code>addRoutes(|rules|)</code></dfn> method steps are: | ||
|
|
||
| 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 |event| be [=this=]. | ||
| 1. If |event|'s [=dispatch flag=] is unset, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. | ||
| 1. If |rules| is not either of a {{RouterRule}} dictionary or a sequence of {{RouterRule}} dictionaries, then return [=a promise rejected with=] a {{TypeError}}. | ||
| 1. If |rules| is a {{RouterRule}} dictionary, set |rules| to « |rules| ». | ||
| 1. Let |serviceWorker| be the [=current global object=]'s associated [=ServiceWorkerGlobalScope/service worker=]. | ||
| 1. For each |rule| of |rules|: | ||
| 1. If running the [=Verify Router Condition=] algorithm with |rule|["{{RouterRule/condition}}"] and |serviceWorker| returns false, return [=a promise rejected with=] a {{TypeError}}. | ||
| 1. Append |rule| to |routerRules|. | ||
| 1. If |routerRules| [=list/contains=] a {{RouterRule}} whose {{RouterRule/source}} is "{{RouterSourceEnum/fetch-event}}" and |serviceWorker|'s [=set of event types to handle=] does not [=set/contain=] {{ServiceWorkerGlobalScope/fetch!!event}}, return [=a promise rejected with=] a {{TypeError}}. | ||
| 1. Set |serviceWorker|'s [=service worker/list of router rules=] to |routerRules|. | ||
| 1. Return [=a promise resolved with=] undefined. | ||
| 1. If |rules| [=list/contains=] a {{RouterRule}} whose {{RouterRule/source}} is "{{RouterSourceEnum/fetch-event}}" and |serviceWorker|'s [=set of event types to handle=] does not [=set/contain=] {{ServiceWorkerGlobalScope/fetch!!event}}, return [=a promise rejected with=] a {{TypeError}}. | ||
yoshisatoyanagisawa marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 1. Let |promise| be a new [=promise=]. | ||
| 1. [=ExtendableEvent/Add lifetime promise=] |promise| to |event|. | ||
|
|
||
| Note: {{InstallEvent/addRoutes(rules)|event.addRoutes(rules)}} extends the lifetime of the event by default as if {{ExtendableEvent/waitUntil()|event.waitUntil(promise)}} is called. | ||
|
|
||
| 1. Run the following substeps [=in parallel=]: | ||
|
||
| 1. Let |allRules| be a copy of |serviceWorker|'s [=list of router rules=]. | ||
| 1. For each |rule| of |rules|: | ||
| 1. Append |rule| to |allRules|. | ||
|
|
||
| 1. Set |serviceWorker|'s [=service worker/list of router rules=] to |allRules|. | ||
| 1. Resolve |promise| with undefined. | ||
| 1. Return |promise|. | ||
|
|
||
| </section> | ||
| </section> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.