Skip to content

Commit 0154992

Browse files
Make the match algorithm accept the URL struct
In w3c/ServiceWorker#1701, the ServiceWorker static routing API uses the match algorithm to match the request URL. However, the original match algorithm accepts a URLPatternInput object, and it does not accept a URL struct. To allow the ServiceWorker static routing API to use the match algorithm, we need to make the match algorithm to accept the URL struct. Fixes: #218.
1 parent 8b8ac40 commit 0154992

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

spec.bs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ A <dfn>component</dfn> is a [=struct=] with the following [=struct/items=]:
468468
</div>
469469

470470
<div algorithm>
471-
To perform a <dfn export for="URL pattern">match</dfn> given a [=URL pattern=] |urlPattern|, a {{URLPatternInput}} |input|, and an optional string |baseURLString|:
471+
To perform a <dfn export for="URL pattern">match</dfn> given a [=URL pattern=] |urlPattern|, a {{URLPatternInput}} or [=/URL=] |input|, and an optional string |baseURLString|:
472472

473473
1. Let |protocol| be the empty string.
474474
1. Let |username| be the empty string.
@@ -492,13 +492,16 @@ A <dfn>component</dfn> is a [=struct=] with the following [=struct/items=]:
492492
1. Set |search| to |applyResult|["{{URLPatternInit/search}}"].
493493
1. Set |hash| to |applyResult|["{{URLPatternInit/hash}}"].
494494
1. Otherwise:
495-
1. Let |baseURL| be null.
496-
1. If |baseURLString| was given, then:
497-
1. Set |baseURL| to the result of [=URL parser|parsing=] |baseURLString|.
498-
1. If |baseURL| is failure, return null.
499-
1. [=list/Append=] |baseURLString| to |inputs|.
500-
1. Let |url| be the result of [=URL parser|parsing=] |input| given |baseURL|.
501-
1. If |url| is failure, return null.
495+
1. Let |url| be |input|.
496+
1. If |input| is a {{USVString}}:
497+
1. Let |baseURL| be null.
498+
1. If |baseURLString| was given, then:
499+
1. Set |baseURL| to the result of [=URL parser|parsing=] |baseURLString|.
500+
1. If |baseURL| is failure, return null.
501+
1. [=list/Append=] |baseURLString| to |inputs|.
502+
1. Set |url| to the result of [=URL parser|parsing=] |input| given |baseURL|.
503+
1. If |url| is failure, return null.
504+
1. [=Assert=]: |url| is a [=/URL=].
502505
1. Set |protocol| to |url|'s [=url/scheme=].
503506
1. Set |username| to |url|'s [=url/username=].
504507
1. Set |password| to |url|'s [=url/password=].

0 commit comments

Comments
 (0)