Skip to content

Commit c23aec1

Browse files
authored
Report all hostname state failures for URLPattern
URLPattern's canonicalize a hostname is the only invocation of the basic URL parser with a URL and state override set to hostname state that looks at the return failure. And since the URL that URLPattern uses is a dummy URL that is ideally not exposed, knowing about all the failure conditions is kind of important. (Now technically the second return failure added here cannot be observed as the dummy URL won't have credentials or a non-null port, but it seemed good to change that at the same time for consistency.) This is covered by existing URLPattern web-platform-tests. Some more background can be found in whatwg/urlpattern#252.
1 parent 6c78200 commit c23aec1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

url.bs

+5-4
Original file line numberDiff line numberDiff line change
@@ -2538,15 +2538,16 @@ and then runs these steps:
25382538
<a>file host state</a>.
25392539

25402540
<li>
2541-
<p>Otherwise, if <a>c</a> is U+003A (:) and <var>insideBrackets</var> is false, then:
2541+
<p>Otherwise, if <a>c</a> is U+003A (:) and <var>insideBrackets</var> is false:
25422542

25432543
<ol>
25442544
<li><p>If <var>buffer</var> is the empty string, <a>host-missing</a> <a>validation error</a>,
25452545
return failure.
25462546
<!-- No URLs with port, but without host. -->
25472547

25482548
<li><p>If <var>state override</var> is given and <var>state override</var> is
2549-
<a>hostname state</a>, then return.
2549+
<a>hostname state</a>, then return failure.
2550+
<!-- API validation error -->
25502551

25512552
<li><p>Let <var>host</var> be the result of <a>host parsing</a> <var>buffer</var> with
25522553
<var>url</var> <a>is not special</a>.
@@ -2566,7 +2567,7 @@ and then runs these steps:
25662567
<li><p><var>url</var> <a>is special</a> and <a>c</a> is U+005C (\)
25672568
</ul>
25682569

2569-
<p>then decrease <var>pointer</var> by 1, and then:
2570+
<p>then decrease <var>pointer</var> by 1, and:
25702571

25712572
<ol>
25722573
<li><p>If <var>url</var> <a>is special</a> and <var>buffer</var> is the empty string,
@@ -2576,7 +2577,7 @@ and then runs these steps:
25762577

25772578
<li><p>Otherwise, if <var>state override</var> is given, <var>buffer</var> is the empty
25782579
string, and either <var>url</var> <a>includes credentials</a> or <var>url</var>'s
2579-
<a for=url>port</a> is non-null, return.
2580+
<a for=url>port</a> is non-null, then return failure.
25802581
<!-- API validation error -->
25812582

25822583
<li><p>Let <var>host</var> be the result of <a>host parsing</a> <var>buffer</var> with

0 commit comments

Comments
 (0)