From 4cd8562b14b6e5fcd3b843468903622481b41f68 Mon Sep 17 00:00:00 2001 From: Jeremy Roman Date: Tue, 14 Jan 2025 13:32:52 -0500 Subject: [PATCH] Correct null handling when computing base URL host string --- spec.bs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec.bs b/spec.bs index ff04d35..a6d4e42 100644 --- a/spec.bs +++ b/spec.bs @@ -1858,8 +1858,7 @@ To convert a modifier to a string given a [=part/modifier=] |modifier 1. If |type| is not "`pattern`" and |init| [=map/contains=] none of "{{URLPatternInit/protocol}}", "{{URLPatternInit/hostname}}", "{{URLPatternInit/port}}" and "{{URLPatternInit/username}}", then set |result|["{{URLPatternInit/username}}"] to the result of [=processing a base URL string=] given |baseURL|'s [=url/username=] and |type|. 1. If |type| is not "`pattern`" and |init| [=map/contains=] none of "{{URLPatternInit/protocol}}", "{{URLPatternInit/hostname}}", "{{URLPatternInit/port}}", "{{URLPatternInit/username}}" and "{{URLPatternInit/password}}", then set |result|["{{URLPatternInit/password}}"] to the result of [=processing a base URL string=] given |baseURL|'s [=url/password=] and |type|. 1. If |init| [=map/contains=] neither "{{URLPatternInit/protocol}}" nor "{{URLPatternInit/hostname}}", then: - 1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=]. - 1. If |baseHost| is null, then set |baseHost| to the empty string. + 1. Let |baseHost| be the [=host serializer|serialization=] of |baseURL|'s [=url/host=], if it is not null, and the empty string otherwise. 1. Set |result|["{{URLPatternInit/hostname}}"] to the result of [=processing a base URL string=] given |baseHost| and |type|. 1. If |init| [=map/contains=] none of "{{URLPatternInit/protocol}}", "{{URLPatternInit/hostname}}", and "{{URLPatternInit/port}}", then: 1. If |baseURL|'s [=url/port=] is null, then set |result|["{{URLPatternInit/port}}"] to the empty string.