diff --git a/docs/index.bs b/docs/index.bs index 468c5cc9..097f0469 100644 --- a/docs/index.bs +++ b/docs/index.bs @@ -1569,7 +1569,7 @@ spec: urlpattern; urlPrefix: https://wicg.github.io/urlpattern/
[Exposed=ServiceWorker] interface InstallEvent : ExtendableEvent { - Promise<undefined> registerRouter((RouterRule or sequence<RouterRule>) rules); + Promise<undefined> addRoutes((RouterRule or sequence<RouterRule>) rules); }; dictionary RouterRule { @@ -1578,24 +1578,24 @@ spec: urlpattern; urlPrefix: https://wicg.github.io/urlpattern/ }; dictionary RouterCondition { - USVString urlPattern; + URLPatternCompatible urlPattern; }; - enum RouterSourceEnum { "network" }; + enum RouterSource { "network" };Each {{RouterCondition/urlPattern}} object has an associated URLPattern, a {{URLPattern}}, which is initially unset.
registerRouter(|rules|)
method *must* run these steps:
+ addRoutes(|rules|)
method *must* run these steps:
1. Let |routerRules| be a list of {{RouterRule}} dictionaries.
1. If |rules| is a {{RouterRule}} dictionary, set |rules| to « |rules| ».
- 1. for each |rule| in |rules|:
+ 1. For each |rule| of |rules|:
1. If running [=VerifyRouterRule=] algorithm with |rule| and [=/service worker=] returns false, throw a TypeError
.
1. Append |rule| to |routerRules|.
1. Set [=/service worker=]'s [=static router rules object=] to |routerRules|.
@@ -3244,52 +3244,13 @@ spec: urlpattern; urlPrefix: https://wicg.github.io/urlpattern/
: Output
:: a boolean
- 1. If |rule|["{{RouterRule/condition}}"]["{{RouterCondition/urlPattern}}"] is the empty string, return false.
1. Let |rawPattern| be |rule|["{{RouterRule/condition}}"]["{{RouterCondition/urlPattern}}"].
- 1. If |rawPattern| is a [=string=], then:
- 1. Let |baseURL| be |serviceWorker|'s [=service worker/script url=].
- 1. Set |pattern| to the result of constructing a {{URLPattern}} using the {{URLPattern/URLPattern(input, baseURL)}} constructor steps given |rawPattern| and |baseURL|. If those steps throw, catch the exception and return false.
- 1. Otherwise, if |rawPattern| is {{URLPatternInit}}:
- 1. Set |pattern| to the result of constructing a {{URLPattern}} using the {{URLPattern/URLPattern(input)}} constructor steps given |rawPattern|. If those steps throw, catch the exception and return false.
- 1. Otherwise, return false.
- 1. If running the [=VerifyURLPattern=] algorithm with |pattern| returns false, return false.
- 1. Set |rule|["{{RouterRule/condition}}"]["{{RouterCondition/urlPattern}}"]'s associated {{URLPattern}} to |pattern|.
- 1. Return true.
- regexp
", return false.
-
- Note: Since running a user-defined regular expression has a security concern, it is prohibited.
+ Note: Since running a user-defined regular expression has a security concern, it is prohibited.
+ 1. Set |rule|["{{RouterRule/condition}}"]["{{RouterCondition/urlPattern}}"]'s associated {{URLPattern}} to |pattern|.
1. Return true.