Skip to content

Commit 696b402

Browse files
authored
Ensure string is passed through in process a URLPatternInit
There are cases in which the protocol is not present in the result map, where we instead need to pass through the empty string. Fixes #257.
1 parent 5e1c93e commit 696b402

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spec.bs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,8 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier
18751875
1. If |init|["{{URLPatternInit/username}}"] [=map/exists=], then set |result|["{{URLPatternInit/username}}"] to the result of [=process username for init=] given |init|["{{URLPatternInit/username}}"] and |type|.
18761876
1. If |init|["{{URLPatternInit/password}}"] [=map/exists=], then set |result|["{{URLPatternInit/password}}"] to the result of [=process password for init=] given |init|["{{URLPatternInit/password}}"] and |type|.
18771877
1. If |init|["{{URLPatternInit/hostname}}"] [=map/exists=], then set |result|["{{URLPatternInit/hostname}}"] to the result of [=process hostname for init=] given |init|["{{URLPatternInit/hostname}}"] and |type|.
1878-
1. If |init|["{{URLPatternInit/port}}"] [=map/exists=], then set |result|["{{URLPatternInit/port}}"] to the result of [=process port for init=] given |init|["{{URLPatternInit/port}}"], |result|["{{URLPatternInit/protocol}}"], and |type|.
1878+
1. Let |resultProtocolString| be |result|["{{URLPatternInit/protocol}}"] if it [=map/exists=]; otherwise the empty string.
1879+
1. If |init|["{{URLPatternInit/port}}"] [=map/exists=], then set |result|["{{URLPatternInit/port}}"] to the result of [=process port for init=] given |init|["{{URLPatternInit/port}}"], |resultProtocolString|, and |type|.
18791880
1. If |init|["{{URLPatternInit/pathname}}"] [=map/exists=]:
18801881
1. Set |result|["{{URLPatternInit/pathname}}"] to |init|["{{URLPatternInit/pathname}}"].
18811882
1. If the following are all true:
@@ -1891,7 +1892,7 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier
18911892
1. Let |new pathname| be the [=code point substring by positions|code point substring=] from 0 to |slash index| + 1 within |baseURLPath|.
18921893
1. Append |result|["{{URLPatternInit/pathname}}"] to the end of |new pathname|.
18931894
1. Set |result|["{{URLPatternInit/pathname}}"] to |new pathname|.
1894-
1. Set |result|["{{URLPatternInit/pathname}}"] to the result of [=process pathname for init=] given |result|["{{URLPatternInit/pathname}}"], |result|["{{URLPatternInit/protocol}}"], and |type|.
1895+
1. Set |result|["{{URLPatternInit/pathname}}"] to the result of [=process pathname for init=] given |result|["{{URLPatternInit/pathname}}"], |resultProtocolString|, and |type|.
18951896
1. If |init|["{{URLPatternInit/search}}"] [=map/exists=] then set |result|["{{URLPatternInit/search}}"] to the result of [=process search for init=] given |init|["{{URLPatternInit/search}}"] and |type|.
18961897
1. If |init|["{{URLPatternInit/hash}}"] [=map/exists=] then set |result|["{{URLPatternInit/hash}}"] to the result of [=process hash for init=] given |init|["{{URLPatternInit/hash}}"] and |type|.
18971898
1. Return |result|.

0 commit comments

Comments
 (0)