From 32040484b14e953a4179eb331a501a56cd113dad Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Thu, 27 Mar 2025 00:32:31 +1300 Subject: [PATCH 1/2] 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. --- spec.bs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec.bs b/spec.bs index 5460aea..b7a4632 100644 --- a/spec.bs +++ b/spec.bs @@ -1875,7 +1875,8 @@ To convert a modifier to a string given a [=part/modifier=] |modifier 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|. 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|. 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|. - 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|. + 1. Let |resultProtocolString| be |result|["{{URLPatternInit/protocol}}"] if it [=map/exists=], or else the empty string. + 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|. 1. If |init|["{{URLPatternInit/pathname}}"] [=map/exists=]: 1. Set |result|["{{URLPatternInit/pathname}}"] to |init|["{{URLPatternInit/pathname}}"]. 1. If the following are all true: @@ -1891,7 +1892,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier 1. Let |new pathname| be the [=code point substring by positions|code point substring=] from 0 to |slash index| + 1 within |baseURLPath|. 1. Append |result|["{{URLPatternInit/pathname}}"] to the end of |new pathname|. 1. Set |result|["{{URLPatternInit/pathname}}"] to |new pathname|. - 1. Set |result|["{{URLPatternInit/pathname}}"] to the result of [=process pathname for init=] given |result|["{{URLPatternInit/pathname}}"], |result|["{{URLPatternInit/protocol}}"], and |type|. + 1. Set |result|["{{URLPatternInit/pathname}}"] to the result of [=process pathname for init=] given |result|["{{URLPatternInit/pathname}}"], |resultProtocolString|, and |type|. 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|. 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|. 1. Return |result|. From 73819e8f0a1820b5d5172fc6eeece09d3318895e Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Wed, 26 Mar 2025 13:07:19 +0100 Subject: [PATCH 2/2] Update spec.bs --- spec.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.bs b/spec.bs index b7a4632..87aa7e0 100644 --- a/spec.bs +++ b/spec.bs @@ -1875,7 +1875,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier 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|. 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|. 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|. - 1. Let |resultProtocolString| be |result|["{{URLPatternInit/protocol}}"] if it [=map/exists=], or else the empty string. + 1. Let |resultProtocolString| be |result|["{{URLPatternInit/protocol}}"] if it [=map/exists=]; otherwise the empty string. 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|. 1. If |init|["{{URLPatternInit/pathname}}"] [=map/exists=]: 1. Set |result|["{{URLPatternInit/pathname}}"] to |init|["{{URLPatternInit/pathname}}"].