Skip to content

Commit 316b83b

Browse files
authored
Change URL parsing sequence for window open steps
Previously, we would only check at the last minute. This would be buggy in the case where we create a new navigable, and then throw an exception. Instead we should be sure to throw before creating a new navigable. In addition to fixing this somewhat-obviously-wrong bug, this also causes validation to happen before popup blocking or other window-choosing steps. Previously, if trying to open a window to an unparseable URL with the popup blocker active, the window open steps would return null; now, they throw an exception. Closes #10681.
1 parent 326677b commit 316b83b

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

source

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89800,6 +89800,20 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
8980089800
<li><p>Let <var>sourceDocument</var> be the <span>entry global object</span>'s <span
8980189801
data-x="concept-document-window">associated <code>Document</code></span>.</p></li>
8980289802

89803+
<li><p>Let <var>urlRecord</var> be null.</p></li>
89804+
89805+
<li>
89806+
<p>If <var>url</var> is not the empty string, then:</p>
89807+
89808+
<ol>
89809+
<li><p>Set <var>urlRecord</var> to the result of <span>encoding-parsing a URL</span> given
89810+
<var>url</var>, relative to <var>sourceDocument</var>.</p></li>
89811+
89812+
<li><p>If <var>urlRecord</var> is failure, then throw a <span>"<code>SyntaxError</code>"</span>
89813+
<code>DOMException</code>.</p></li>
89814+
</ol>
89815+
</li>
89816+
8980389817
<li><p>If <var>target</var> is the empty string, then set <var>target</var> to "<code
8980489818
data-x="">_blank</code>".</p></li>
8980589819

@@ -89871,15 +89885,8 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
8987189885
data-x="nav-bc">active browsing context</span> given
8987289886
<var>tokenizedFeatures</var>. <ref>CSSOMVIEW</ref></p></li>
8987389887

89874-
<li><p>Let <var>urlRecord</var> be the <span>URL record</span>
89875-
<code>about:blank</code>.</p></li>
89876-
89877-
<li><p>If <var>url</var> is not the empty string, then set <var>urlRecord</var> to the result
89878-
of <span>encoding-parsing a URL</span> given <var>url</var>, relative to the <span>entry
89879-
settings object</span>.</p></li>
89880-
89881-
<li><p>If <var>urlRecord</var> is failure, then throw a <span>"<code>SyntaxError</code>"</span>
89882-
<code>DOMException</code>.</p></li>
89888+
<li><p>If <var>urlRecord</var> is null, then set <var>urlRecord</var> to a <span>URL
89889+
record</span> representing <code>about:blank</code>.</p></li>
8988389890

8988489891
<li>
8988589892
<p>If <var>urlRecord</var> <span>matches <code>about:blank</code></span>, then perform the
@@ -89902,22 +89909,10 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
8990289909
<p>Otherwise:</p>
8990389910

8990489911
<ol>
89905-
<li>
89906-
<p>If <var>url</var> is not the empty string, then:</p>
89907-
89908-
<ol>
89909-
<li><p>Let <var>urlRecord</var> be the result of <span>encoding-parsing a URL</span>
89910-
<var>url</var>, relative to the <span>entry settings object</span>.</p></li>
89911-
89912-
<li><p>If <var>urlRecord</var> is failure, then throw a
89913-
<span>"<code>SyntaxError</code>"</span> <code>DOMException</code>.</p></li>
89914-
89915-
<li><p><span>Navigate</span><!--DONAV window.open()--> <var>targetNavigable</var> to
89916-
<var>urlRecord</var> using <var>sourceDocument</var>, with <i
89917-
data-x="navigation-referrer-policy">referrerPolicy</i> set to <var>referrerPolicy</var> and
89918-
<i><span>exceptionsEnabled</span></i> set to true.</p></li>
89919-
</ol>
89920-
</li>
89912+
<li><!--DONAV window.open()--><p>If <var>urlRecord</var> is not null, then
89913+
<span>navigate</span> <var>targetNavigable</var> to <var>urlRecord</var> using
89914+
<var>sourceDocument</var>, with <i data-x="navigation-referrer-policy">referrerPolicy</i> set
89915+
to <var>referrerPolicy</var> and <i><span>exceptionsEnabled</span></i> set to true.</p></li>
8992189916

8992289917
<li><p>If <var>noopener</var> is false, then set <var>targetNavigable</var>'s <span
8992389918
data-x="nav-bc">active browsing context</span>'s <span>opener browsing context</span> to

0 commit comments

Comments
 (0)