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.
-

{{InstallEvent/registerRouter(rules)|event.registerRouter(rules)}}

+

{{InstallEvent/addRoutes(rules)|event.addRoutes(rules)}}

- {{InstallEvent/registerRouter(rules)}} registers this service worker the rules to offload simple tasks that the fetch handler does. + {{InstallEvent/addRoutes(rules)}} registers this service worker the rules to offload simple tasks that the fetch handler does. - 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. -
- -
-

VerifyURLPattern

- - : Input - :: |pattern|, a {{URLPattern}} - : Output - :: a boolean - - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/protocol component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/username component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/password component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/hostname component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/port component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/pathname component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/search component=] returns false, return false. - 1. If running the [=VerifyURLPatternComponent=] algorithm with |pattern|'s [=urlpattern/hash component=] returns false, return false. - 1. Return true. -
+ 1. Let |pattern| be the result of [=building a URLPattern from a Web IDL value=] |rawPattern| given |baseURL| and |serivceWorker|'s [=service worker/global object=]'s [=relevant realm=]. If this throws an exception, catch it and return false. + 1. If |pattern| [=URLPattern/has regexp groups=] returns true, return false. -
-

VerifyURLPatternComponent

- - : Input - :: |component|, a [=component=]. - : Output - :: a boolean - - 1. Let |parts| be a result of [=urlpattern/parsing=] |component|'s associated [=urlpattern-component/pattern string=]. - 1. [=list/For each=] |part| of |parts|: - 1. If |part|'s [=urlpattern-part/type=] is "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.