From ecba7b042c2674a8dee35694c391ba6b71a092c7 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 7 Oct 2024 15:21:26 +0900 Subject: [PATCH 1/2] 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 in cases where a named window is targeted, but no window with that name exists. Previously, the window open steps would do nothing in such cases; now, they throw an exception when given an invalid URL. Closes #10681. --- source | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/source b/source index ef1bff95b27..f212fb4aa88 100644 --- a/source +++ b/source @@ -89327,6 +89327,19 @@ dictionary WindowPostMessageOptions : StructuredSeri
  • Let sourceDocument be the entry global object's associated Document.

  • +
  • Let urlRecord be null.

  • + +
  • +

    If url is not the empty string, then:

    + +
      +
    1. Set urlRecord to the result of encoding-parsing a URL given url, relative to sourceDocument.

    2. + +
    3. If urlRecord is failure, then throw a "SyntaxError" + DOMException.

    4. +
    +
  • +
  • If target is the empty string, then set target to "_blank".

  • @@ -89398,15 +89411,8 @@ dictionary WindowPostMessageOptions : StructuredSeri data-x="nav-bc">active browsing context given tokenizedFeatures. CSSOMVIEW

    -
  • Let urlRecord be the URL record - about:blank.

  • - -
  • If url is not the empty string, then set urlRecord to the result - of encoding-parsing a URL given url, relative to the entry - settings object.

  • - -
  • If urlRecord is failure, then throw a "SyntaxError" - DOMException.

  • +
  • If urlRecord is null, then set urlRecord to a URL + record representing about:blank.

  • If urlRecord matches about:blank, then perform the @@ -89429,22 +89435,10 @@ dictionary WindowPostMessageOptions : StructuredSeri

    Otherwise:

      -
    1. -

      If url is not the empty string, then:

      - -
        -
      1. Let urlRecord be the result of encoding-parsing a URL - url, relative to the entry settings object.

      2. - -
      3. If urlRecord is failure, then throw a - "SyntaxError" DOMException.

      4. - -
      5. Navigate targetNavigable to - urlRecord using sourceDocument, with referrerPolicy set to referrerPolicy and - exceptionsEnabled set to true.

      6. -
      -
    2. +
    3. If urlRecord is not null, then + navigate targetNavigable to urlRecord using + sourceDocument, with referrerPolicy set + to referrerPolicy and exceptionsEnabled set to true.

    4. If noopener is false, then set targetNavigable's active browsing context's opener browsing context to From 0685b7c87a4c9f861b8fe61a0dc03f44ce0bb670 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 7 Oct 2024 15:38:57 +0900 Subject: [PATCH 2/2] Fix wrapping --- source | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source b/source index f212fb4aa88..38da0cd2710 100644 --- a/source +++ b/source @@ -89333,7 +89333,8 @@ dictionary WindowPostMessageOptions : StructuredSeri

      If url is not the empty string, then:

        -
      1. Set urlRecord to the result of encoding-parsing a URL given url, relative to sourceDocument.

      2. +
      3. Set urlRecord to the result of encoding-parsing a URL given + url, relative to sourceDocument.

      4. If urlRecord is failure, then throw a "SyntaxError" DOMException.