Skip to content

Commit

Permalink
Do not initialize members to null in "process a URLPatternInit"
Browse files Browse the repository at this point in the history
It is not valid for these dictionary members to be null, since they are defined to, if present, hold a USVString value. Instead, these should be omitted from the result dictionary altogether if no string was provided to this algorithm.

This addresses the concern raised in #202 (comment).
  • Loading branch information
jeremyroman authored Jan 30, 2024
1 parent ddd41db commit 5ce2f70
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1802,14 +1802,14 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier
To <dfn>process a URLPatternInit</dfn> given a {{URLPatternInit}} |init|, a string |type|, a string or null |protocol|, a string or null |username|, a string or null |password|, a string or null |hostname|, a string or null |port|, a string or null |pathname|, a string or null |search|, and a string or null |hash|:

1. Let |result| be the result of creating a new {{URLPatternInit}}.
1. Set |result|["{{URLPatternInit/protocol}}"] to |protocol|.
1. Set |result|["{{URLPatternInit/username}}"] to |username|.
1. Set |result|["{{URLPatternInit/password}}"] to |password|.
1. Set |result|["{{URLPatternInit/hostname}}"] to |hostname|.
1. Set |result|["{{URLPatternInit/port}}"] to |port|.
1. Set |result|["{{URLPatternInit/pathname}}"] to |pathname|.
1. Set |result|["{{URLPatternInit/search}}"] to |search|.
1. Set |result|["{{URLPatternInit/hash}}"] to |hash|.
1. If |protocol| is not null, [=map/set=] |result|["{{URLPatternInit/protocol}}"] to |protocol|.
1. If |username| is not null, [=map/set=] |result|["{{URLPatternInit/username}}"] to |username|.
1. If |password| is not null, [=map/set=] |result|["{{URLPatternInit/password}}"] to |password|.
1. If |hostname| is not null, [=map/set=] |result|["{{URLPatternInit/hostname}}"] to |hostname|.
1. If |port| is not null, [=map/set=] |result|["{{URLPatternInit/port}}"] to |port|.
1. If |pathname| is not null, [=map/set=] |result|["{{URLPatternInit/pathname}}"] to |pathname|.
1. If |search| is not null, [=map/set=] |result|["{{URLPatternInit/search}}"] to |search|.
1. If |hash| is not null, [=map/set=] |result|["{{URLPatternInit/hash}}"] to |hash|.
1. Let |baseURL| be null.
1. If |init|["{{URLPatternInit/baseURL}}"] [=map/exists=]:
<div class="note">
Expand Down

0 comments on commit 5ce2f70

Please sign in to comment.