From 5a1b27e69a7f02e3697686f225609fd379c3d5b9 Mon Sep 17 00:00:00 2001 From: Kevin McNee Date: Tue, 3 Dec 2024 22:01:19 -0500 Subject: [PATCH 1/6] Make named window lookup more precise and correct BCG swap logic In "the rules for choosing a navigable," the method to find an existing navigable by name is vague. This updates the definition to accurately reflect what the major implementations do. There are some differences between implementations, so there remains in the spec some optional/implementation-defined behaviour, but it's much narrower. In particular, note that lookups are now explicitly scoped to browsing context groups. The previous language in the named lookup about "the user agent determines that the two browsing contexts are related enough" is now no longer a part of the lookup logic, but a consequence of the BCG swap decisions. In "obtain a browsing context to use for a navigation response," the existing spec only mentions COOP enforcement as a reason to do a browsing context group swap. Some implementations perform a swap for additional security and performance reasons. This is now reflected in the spec. --- source | 158 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 127 insertions(+), 31 deletions(-) diff --git a/source b/source index 3ec21624416..e5e8d8af891 100644 --- a/source +++ b/source @@ -87746,18 +87746,64 @@ dictionary DragEventInit : MouseEventInit {

To obtain a browsing context to use for a - navigation response, given a browsing context browsingContext, a - sandboxing flag set sandboxFlags, an opener policy - navigationCOOP, and an opener policy enforcement - result coopEnforcementResult:

+ navigation response, given navigation params navigationParams:

    +
  1. Let browsingContext be navigationParams's navigable's active browsing + context.

  2. +
  3. If browsingContext is not a top-level browsing context, then return browsingContext.

  4. +
  5. Let swapGroup be false.

  6. + +
  7. Let coopEnforcementResult be navigationParams's COOP enforcement result.

  8. + +
  9. If coopEnforcementResult's + needs a browsing context group switch is true, set swapGroup to true.

  10. + +
  11. Let sourceOrigin be browsingContext's + active document's origin.

  12. + +
  13. Let destinationOrigin be navigationParams's origin.

  14. + +
  15. Let sameSite be whether sourceOrigin is + same site with destinationOrigin.

  16. + +
  17. +

    If sameSite is false, then:

    +
      +
    1. If either of sourceOrigin or destinationOrigin have a scheme that is not an HTTP(S) scheme + and the user agent considers it necessary for sourceOrigin and + destinationOrigin to be isolated from each other (for + implementation-defined reasons), optionally set swapGroup + to true.

      +

      For example, if a user navigates from about:settings to + https://example.com, the user agent could force a swap.

      +
    2. + +
    3. If navigationParams's + user involvement is "browser UI", + optionally set swapGroup to true.

    4. +
    +
  18. + +
  19. If browsingContext's group's + browsing context set's size is 1, + optionally set swapGroup to true.

    +

    Some implementations swap browsing context groups here for performance reasons.

    +

    The check for other contexts that could script this one is not sufficient to + prevent differences in behavior that could affect a web page. Even if there are currently no other + contexts, the destination page could open a window, then if the user navigates back, the + previous page could expect to be able to script the opened window. Doing a swap here would + break that use case.

  20. +
  21. -

    If coopEnforcementResult's needs a - browsing context group switch is false, then:

    +

    If swapGroup is false, then:

    1. If coopEnforcementResult's DragEventInit : MouseEventInit { might destroy it at this point.

    2. +
    3. Let navigationCOOP be navigationParams's cross-origin opener policy.

    4. +
    5. If navigationCOOP's value is "same-origin-plus-COEP", then set @@ -87797,6 +87846,9 @@ dictionary DragEventInit : MouseEventInit { not.

    6. +
    7. Let sandboxFlags be navigationParams's final sandboxing flag set.

    8. +
    9. If sandboxFlags is not empty, then:

        @@ -97762,6 +97814,53 @@ interface NotRestoredReasons {
        +

        To find a navigable by target name given a string name and a navigable currentNavigable:

        +

        This will be made more precise in issue #313.

        + +
          +
        1. Let currentDocument be currentNavigable's active document.

        2. +
        3. Let sourceSnapshotParams be the result of snapshotting source snapshot params given currentDocument.

        4. +
        5. +

          Let subtreesToSearch be an implementation-defined choice of one of the following:

          +
            +
          • « currentNavigable's traversable navigable, currentNavigable »

          • +
          • the inclusive ancestor navigables of currentDocument

          • +
          +
        6. +
        7. +

          For each subtreeToSearch of subtreesToSearch, in reverse order:

          +
            +
          1. Let documentToSearch be subtreeToSearch's active document.

          2. +
          3. +

            For each navigable of the inclusive descendant navigables of documentToSearch:

            +
              +
            1. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, optionally continue.

            2. +
            3. If navigable's target name is the same as name, return navigable.

            4. +
            +
          4. +
          +
        8. +
        9. Let currentTopLevelBrowsingContext be currentNavigable's active browsing context's top-level browsing context.

        10. +
        11. Let group be currentTopLevelBrowsingContext's group.

        12. +
        13. +

          For each topLevelBrowsingContext of group's browsing context set, in an implementation-defined order (the user agent should pick a consistent ordering, such as the most recently opened, most recently focused, or more closely related):

          +
            +
          1. If currentTopLevelBrowsingContext equals topLevelBrowsingContext, continue.

          2. +
          3. Let documentToSearch be topLevelBrowsingContext's active document.

          4. +
          5. +

            For each navigable of the inclusive descendant navigables of documentToSearch:

            +
              +
            1. If currentNavigable's active browsing context is not familiar with navigable's active browsing context, continue.

            2. +
            3. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, optionally continue.

            4. +
            5. If navigable's target name is the same as name, return navigable.

            6. +
            +
          6. +
          +
        14. +
        15. Return null.

        16. +
        +

        The rules for choosing a navigable, given a string name, a navigable currentNavigable, and a boolean noopener are as follows:

        @@ -97788,18 +97887,8 @@ interface NotRestoredReasons {
      1. Otherwise, if name is not an ASCII case-insensitive match for "_blank", there exists a navigable whose target name is the same as name, - currentNavigable's active browsing context is - familiar with that navigable's active browsing - context, and the user agent determines that the two browsing contexts are related enough - that it is ok if they reach each other, set chosen to that navigable. If there are - multiple matching navigables, the user agent should pick one in - some arbitrary consistent manner, such as the most recently opened, most recently focused, or - more closely related, and set chosen to it.

        + data-x="">_blank", and there exists a navigable that is the result of finding a navigable by target name given name and currentNavigable, set chosen to that navigable. -

        This will be made more precise in issue #313.

      2. @@ -99528,6 +99617,9 @@ location.href = '#foo';
        about base URL
        a URL or null used to populate the new Document's about base URL
        + +
        user involvement
        +
        a user navigation involvement (default "none")

        Once a navigation params struct is created, this standard does not @@ -100058,6 +100150,9 @@ location.href = '#foo';

        about base URL
        documentState's about base URL
        + +
        user involvement
        +
        userInvolvement
      @@ -100068,7 +100163,7 @@ location.href = '#foo'; given navigable, "navigate", sourceSnapshotParams, targetSnapshotParams, navigationId, navigationParams, - cspNavigationType, with allowPOST + cspNavigationType, userInvolvement, with allowPOST set to true and completionSteps set to the following step:

      @@ -101386,7 +101481,9 @@ location.href = '#foo'; targetSnapshotParams, an optional navigation ID-or-null navigationId (default null), an optional navigation params-or-null navigationParams (default null), an optional string cspNavigationType - (default "other"), an optional boolean other"), an optional user navigation involvement + userInvolvement (default + "none"), an optional boolean allowPOST (default false), and optional algorithm steps completionSteps (default an empty @@ -101431,7 +101528,8 @@ location.href = '#foo';

      then set navigationParams to the result of creating navigation params by fetching given entry, navigable, sourceSnapshotParams, targetSnapshotParams, - cspNavigationType, navigationId, and navTimingType.

      + cspNavigationType, userInvolvement, navigationId, and + navTimingType.

    10. @@ -101820,7 +101918,8 @@ location.href = '#foo'; session history entry entry, a navigable navigable, a source snapshot params sourceSnapshotParams, a target snapshot params targetSnapshotParams, a string - cspNavigationType, a navigation ID-or-null navigationId, and a + cspNavigationType, a user navigation involvement + userInvolvement, a navigation ID-or-null navigationId, and a NavigationTimingType navTimingType, perform the following steps. They return a navigation params, a non-fetch scheme navigation params, or null.

      @@ -102450,6 +102549,9 @@ location.href = '#foo';
      about base URL
      entry's document state's about base URL
      + +
      user involvement
      +
      userInvolvement
    @@ -102905,6 +103007,7 @@ location.href = '#foo';
  22. In parallel, attempt to populate the history entry's document for targetEntry, given navigable, potentiallyTargetSpecificSourceSnapshotParams, targetSnapshotParams, + userInvolvementForNavigateEvents, with allowPOST set to allowPOST and completionSteps set to queue a global task on the navigation and traversal task source @@ -104397,18 +104500,10 @@ location.href = '#foo'; data-x="dom-DOMImplementation-createHTMLDocument">document.implementation.createHTMLDocument().

      -
    1. Let browsingContext be navigationParams's navigable's active browsing - context.

    2. -
    3. -

      Set browsingContext to the result of the Let browsingContext be the result of obtaining a browsing context to use for a - navigation response given browsingContext, navigationParams's - final sandboxing flag set, - navigationParams's cross-origin opener - policy, and navigationParams's COOP enforcement result.

      + navigation response given navigationParams.

      This can result in a browsing context @@ -145914,6 +146009,7 @@ INSERT INTERFACES HERE Kevin Benson, Kevin Cole, Kevin Gadd, + Kevin McNee, Kevin Venkiteswaran, Khushal Sagar, Kinuko Yasuda, From 283a9cf0d347f4b0c182f171e8a828fe5cffb56a Mon Sep 17 00:00:00 2001 From: Kevin McNee Date: Fri, 6 Dec 2024 18:57:46 -0500 Subject: [PATCH 2/6] annevk review comments --- source | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/source b/source index e5e8d8af891..d7a3a4da74c 100644 --- a/source +++ b/source @@ -87756,13 +87756,11 @@ dictionary DragEventInit : MouseEventInit {

    4. If browsingContext is not a top-level browsing context, then return browsingContext.

    5. -
    6. Let swapGroup be false.

    7. -
    8. Let coopEnforcementResult be navigationParams's COOP enforcement result.

    9. -
    10. If coopEnforcementResult's - needs a browsing context group switch is true, set swapGroup to true.

    11. +
    12. Let swapGroup be coopEnforcementResult's needs a browsing context group switch.

    13. Let sourceOrigin be browsingContext's active document's origin.

    14. @@ -87770,11 +87768,9 @@ dictionary DragEventInit : MouseEventInit {
    15. Let destinationOrigin be navigationParams's origin.

    16. -
    17. Let sameSite be whether sourceOrigin is - same site with destinationOrigin.

    18. -
    19. -

      If sameSite is false, then:

      +

      If sourceOrigin is not same site with + destinationOrigin:

      1. If either of sourceOrigin or destinationOrigin have a scheme that is not an HTTP(S) scheme @@ -87846,7 +87842,8 @@ dictionary DragEventInit : MouseEventInit { not.

      2. -
      3. Let sandboxFlags be navigationParams's

        Let sandboxFlags be a clone of + navigationParams's final sandboxing flag set.

      4. @@ -87858,8 +87855,8 @@ dictionary DragEventInit : MouseEventInit {
      5. Assert: newBrowsingContext's popup sandboxing flag set is empty.

      6. -
      7. Set newBrowsingContext's popup sandboxing flag set to a clone of sandboxFlags.

      8. +
      9. Set newBrowsingContext's popup sandboxing flag set to + sandboxFlags.

    20. From 029e268ce358a338183f98e85a310275b74e8e3a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 11 Dec 2024 15:52:32 +0900 Subject: [PATCH 3/6] Add notes; source formatting --- source | 188 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 131 insertions(+), 57 deletions(-) diff --git a/source b/source index d7a3a4da74c..9a7a7f14095 100644 --- a/source +++ b/source @@ -87769,34 +87769,49 @@ dictionary DragEventInit : MouseEventInit { data-x="navigation-params-origin">origin.

    21. -

      If sourceOrigin is not same site with - destinationOrigin:

      -
        -
      1. If either of sourceOrigin or destinationOrigin have a scheme that is not an HTTP(S) scheme - and the user agent considers it necessary for sourceOrigin and - destinationOrigin to be isolated from each other (for - implementation-defined reasons), optionally set swapGroup - to true.

        -

        For example, if a user navigates from about:settings to - https://example.com, the user agent could force a swap.

        -
      2. +

        If sourceOrigin is not same site with + destinationOrigin:

        -
      3. If navigationParams's - user involvement is "browser UI", - optionally set swapGroup to true.

      4. -
      +
        +
      1. +

        If either of sourceOrigin or destinationOrigin have a scheme that is not an HTTP(S) scheme and + the user agent considers it necessary for sourceOrigin and + destinationOrigin to be isolated from each other (for + implementation-defined reasons), optionally set swapGroup to true.

        + +

        For example, if a user navigates from about:settings to + https://example.com, the user agent could force a swap.

        + +

        Issue #10842 tracks + settling on an interoperable behavior here, instead of letting this be optional.

        +
      2. + +
      3. +

        If navigationParams's user + involvement is "browser UI", optionally set + swapGroup to true.

        + +

        Issue #6356 tracks + settling on an interoperable behavior here, instead of letting this be optional.

        +
      4. +
    22. -
    23. If browsingContext's group's - browsing context set's size is 1, - optionally set swapGroup to true.

      -

      Some implementations swap browsing context groups here for performance reasons.

      -

      The check for other contexts that could script this one is not sufficient to - prevent differences in behavior that could affect a web page. Even if there are currently no other - contexts, the destination page could open a window, then if the user navigates back, the - previous page could expect to be able to script the opened window. Doing a swap here would - break that use case.

    24. +
    25. +

      If browsingContext's group's browsing + context set's size is 1, optionally set + swapGroup to true.

      + +

      Some implementations swap browsing context groups here for performance + reasons.

      + +

      The check for other contexts that could script this one is not sufficient to + prevent differences in behavior that could affect a web page. Even if there are currently no + other contexts, the destination page could open a window, then if the user navigates back, the + previous page could expect to be able to script the opened window. Doing a swap here would break + that use case.

      +
    26. If swapGroup is false, then:

      @@ -97811,50 +97826,109 @@ interface NotRestoredReasons {
      -

      To find a navigable by target name given a string name and a navigable currentNavigable:

      -

      This will be made more precise in issue #313.

      +

      To find a navigable by target name given a string name and a + navigable currentNavigable:

        -
      1. Let currentDocument be currentNavigable's active document.

      2. -
      3. Let sourceSnapshotParams be the result of snapshotting source snapshot params given currentDocument.

      4. +
      5. Let currentDocument be currentNavigable's active document.

      6. + +
      7. Let sourceSnapshotParams be the result of snapshotting source snapshot + params given currentDocument.

      8. +
      9. -

        Let subtreesToSearch be an implementation-defined choice of one of the following:

        -
          -
        • « currentNavigable's traversable navigable, currentNavigable »

        • -
        • the inclusive ancestor navigables of currentDocument

        • -
        +

        Let subtreesToSearch be an implementation-defined choice of one of + the following:

        + +
          +
        • « currentNavigable's traversable + navigable, currentNavigable »

        • + +
        • the inclusive ancestor navigables of currentDocument

        • +
        + +

        Issue #10848 tracks + settling on one of these two possibilities, to achieve interoperability.

      10. +
      11. -

        For each subtreeToSearch of subtreesToSearch, in reverse order:

        -
          -
        1. Let documentToSearch be subtreeToSearch's active document.

        2. +

          For each subtreeToSearch of + subtreesToSearch, in reverse order:

          + +
            +
          1. Let documentToSearch be subtreeToSearch's active document.

          2. + +
          3. +

            For each navigable of the inclusive + descendant navigables of documentToSearch:

            + +
            1. -

              For each navigable of the inclusive descendant navigables of documentToSearch:

              -
                -
              1. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, optionally continue.

              2. -
              3. If navigable's target name is the same as name, return navigable.

              4. -
              +

              If currentNavigable is not allowed by sandboxing to navigate + navigable given sourceSnapshotParams, then optionally + continue.

              + +

              Issue #10849 tracks + making this check required, to achieve interoperability.

            2. -
            + +
          4. If navigable's target name is + name, then return navigable.

          5. +
          + +
      12. -
      13. Let currentTopLevelBrowsingContext be currentNavigable's active browsing context's top-level browsing context.

      14. -
      15. Let group be currentTopLevelBrowsingContext's group.

      16. + +
      17. Let currentTopLevelBrowsingContext be currentNavigable's active browsing context's top-level browsing + context.

      18. + +
      19. Let group be currentTopLevelBrowsingContext's group.

      20. +
      21. -

        For each topLevelBrowsingContext of group's browsing context set, in an implementation-defined order (the user agent should pick a consistent ordering, such as the most recently opened, most recently focused, or more closely related):

        -
          -
        1. If currentTopLevelBrowsingContext equals topLevelBrowsingContext, continue.

        2. -
        3. Let documentToSearch be topLevelBrowsingContext's active document.

        4. +

          For each topLevelBrowsingContext of + group's browsing context set, in an implementation-defined + order (the user agent should pick a consistent ordering, such as the most recently opened, most + recently focused, or more closely related):

          + +

          Issue #10850 tracks + picking a specific ordering, to achieve interoperability.

          + +
            +
          1. If currentTopLevelBrowsingContext equals topLevelBrowsingContext, + continue.

          2. + +
          3. Let documentToSearch be topLevelBrowsingContext's active + document.

          4. + +
          5. +

            For each navigable of the inclusive + descendant navigables of documentToSearch:

            + +
              +
            1. If currentNavigable's active browsing context + is not familiar with navigable's active + browsing context, then continue.

            2. +
            3. -

              For each navigable of the inclusive descendant navigables of documentToSearch:

              -
                -
              1. If currentNavigable's active browsing context is not familiar with navigable's active browsing context, continue.

              2. -
              3. If currentNavigable is not allowed by sandboxing to navigate navigable given sourceSnapshotParams, optionally continue.

              4. -
              5. If navigable's target name is the same as name, return navigable.

              6. -
              +

              If currentNavigable is not allowed by sandboxing to navigate + navigable given sourceSnapshotParams, then optionally + continue.

              + + +

              Issue #10849 tracks + making this check required, to achieve interoperability.

            4. -
            + +
          6. If navigable's target name is + name, then return navigable.

          7. +
          + +
      22. +
      23. Return null.

      From ab5d2f5968443cf2e283a0ceb939dc21f41e027e Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 11 Dec 2024 16:18:28 +0900 Subject: [PATCH 4/6] Thread userInvolvement everywhere This uncovered a couple places where it was missing --- source | 94 +++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 30 deletions(-) diff --git a/source b/source index 9a7a7f14095..942e1825061 100644 --- a/source +++ b/source @@ -97956,11 +97956,11 @@ interface NotRestoredReasons { data-x="">_top", set chosen to currentNavigable's traversable navigable.

    27. -
    28. -

      Otherwise, if name is not an ASCII case-insensitive match for "_blank", and there exists a navigable that is the result of finding a navigable by target name given name and currentNavigable, set chosen to that navigable. - -

    29. +
    30. Otherwise, if name is not an ASCII case-insensitive match for + "_blank", and there exists a navigable that is the result of + finding a navigable by target name given + name and currentNavigable, set chosen to that + navigable.

    31. Otherwise, a new top-level traversable is being requested, and what happens @@ -99690,7 +99690,9 @@ location.href = '#foo'; data-x="concept-document-about-base-url">about base URL

      user involvement
      -
      a user navigation involvement (default "none")
      +
      a user navigation involvement used when obtaining a browsing context for the new + Document

      Once a navigation params struct is created, this standard does not @@ -99995,8 +99997,8 @@ location.href = '#foo';

    32. Queue a global task on the navigation and traversal task source given navigable's active window to navigate to a javascript: URL given navigable, - url, historyHandling, initiatorOriginSnapshot, and - cspNavigationType.

    33. + url, historyHandling, initiatorOriginSnapshot, + userInvolvement, and cspNavigationType.

    34. Return.

    @@ -100234,8 +100236,8 @@ location.href = '#foo'; given navigable, "navigate", sourceSnapshotParams, targetSnapshotParams, navigationId, navigationParams, - cspNavigationType, userInvolvement, with allowPOST - set to true and cspNavigationType, userInvolvement, with allowPOST set to true and completionSteps set to the following step:

    @@ -100368,8 +100370,9 @@ location.href = '#foo';

    To navigate to a javascript: URL, given a navigable targetNavigable, a URL url, a history handling - behavior historyHandling, an origin initiatorOrigin, - and a string cspNavigationType:

    + behavior historyHandling, an origin initiatorOrigin, a + user navigation involvement userInvolvement, and a string + cspNavigationType:

    1. Assert: historyHandling is "

    2. Let newDocument be the result of evaluating a javascript: URL given targetNavigable, - url, and initiatorOrigin.

    3. + url, initiatorOrigin, and userInvolvement.

    4. If newDocument is null, then return.

      @@ -100481,8 +100484,9 @@ location.href = '#foo';

    To evaluate a javascript: URL given a navigable - targetNavigable, a URL url, and an origin - newDocumentOrigin:

    + targetNavigable, a URL url, an origin + newDocumentOrigin, and a user navigation involvement + userInvolvement:

    1. Let urlString be the result of running the

      about base URL
      targetNavigable's active document's about base URL
      + +
      user involvement
      +
      userInvolvement
    2. @@ -100882,7 +100889,13 @@ location.href = '#foo';
      navigation timing type
      a NavigationTimingType used for creating the navigation timing entry for the new Document
      + entry">creating the navigation timing entry for the new Document (if one is + created) + +
      user involvement
      +
      a user navigation involvement used when obtaining a browsing context for the new + Document (if one is created)

      To attempt to create a non-fetch scheme document, @@ -100914,13 +100927,14 @@ location.href = '#foo';

    3. Handle url by displaying some sort of inline content, e.g., an error message - because the specified scheme is not one of the supported protocols, or an inline prompt to - allow the user to select a registered + because the specified scheme is not one of the supported protocols, or an inline prompt to allow + the user to select a registered handler for the given scheme. Return the result of displaying the inline content given navigable, - navigationParams's id, and + navigationParams's id, navigationParams's navigation - timing type.

      + timing type, and navigationParams's user involvement.

      In the case of a registered handler being used, navigate will be invoked with a new URL.

      @@ -101581,7 +101595,7 @@ location.href = '#foo';
    4. If documentResource is a string, then set navigationParams to the result of creating navigation params from a srcdoc resource given entry, navigable, - targetSnapshotParams, navigationId, and + targetSnapshotParams, userInvolvement, navigationId, and navTimingType.

    5. @@ -101633,6 +101647,9 @@ location.href = '#foo';
      navigation timing type
      navTimingType
      + +
      user involvement
      +
      userInvolvement
    @@ -101722,8 +101739,9 @@ location.href = '#foo';
  23. Set entry's document state's document to the result of creating a document for inline content that doesn't have a - DOM, given navigable, null, and navTimingType. The inline - content should indicate to the user the sort of error that occurred.

  24. + DOM, given navigable, null, navTimingType, and + userInvolvement. The inline content should indicate to the user the sort of error + that occurred.

  25. Make document unsalvageable given entry's document state's

    To create navigation params from a srcdoc resource given a session history entry entry, a navigable navigable, a target - snapshot params targetSnapshotParams, a navigation ID-or-null - navigationId, and a NavigationTimingType navTimingType:

    + snapshot params targetSnapshotParams, a user navigation involvement + userInvolvement, a navigation ID-or-null navigationId, and a + NavigationTimingType navTimingType:

    1. Let documentResource be entry's

      about base URL
      entry's document state's about base URL
      + +
      user involvement
      +
      userInvolvement
    @@ -102520,6 +102542,9 @@ location.href = '#foo';
    navigation timing type
    navTimingType
    + +
    user involvement
    +
    userInvolvement

    At this point, request's

    If the user agent's PDF viewer supported is true, return the result of creating a document for inline content that doesn't have a DOM given navigationParams's navigable.
    + data-x="navigation-params-navigable">navigable, navigationParams's id, navigationParams's navigation timing type, and + navigationParams's user + involvement.

    Otherwise, proceed onward.

    @@ -102715,8 +102744,10 @@ location.href = '#foo'; data-x="navigate-ua-inline">creating a document for inline content that doesn't have a DOM given navigationParams's navigable, navigationParams's id, and navigationParams's navigation timing type.

  26. + data-x="navigation-params-id">id, navigationParams's navigation timing type, and + navigationParams's user + involvement.

  27. Otherwise, the document's type is such that the resource will not affect navigationParams's navigable, e.g., @@ -105209,8 +105240,8 @@ new PaymentRequest(…); // Allowed to use

    When the user agent is to create a document to display a user agent page or PDF viewer inline, provided a navigable navigable, a navigation ID - navigationId, a NavigationTimingType navTimingType, the - user agent should:

    + navigationId, a NavigationTimingType navTimingType, and a + user navigation involvement userInvolvement, the user agent should:

    1. Let origin be a new opaque @@ -105279,6 +105310,9 @@ new PaymentRequest(…); // Allowed to use

      about base URL
      null
      + +
      user involvement
      +
      userInvolvement
    2. From c3ebf343cc85ee0505e5b441fbff7e5ae8fd6f7b Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 11 Dec 2024 16:41:45 +0900 Subject: [PATCH 5/6] Even more userInvolvement threading We named that parameter "userInvolvementForNavigateEvents" specifically because we left it null in cases where navigate events don't happen. But, there are cases where we need to consult user involvement for the BCG swap. So we need to thread it through more. This is probably better anyways as it's more consistent. --- source | 96 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/source b/source index 942e1825061..6cf77c626d5 100644 --- a/source +++ b/source @@ -100235,8 +100235,8 @@ location.href = '#foo';

      Attempt to populate the history entry's document for historyEntry, given navigable, "navigate", sourceSnapshotParams, - targetSnapshotParams, navigationId, navigationParams, - cspNavigationType, userInvolvement, with targetSnapshotParams, userInvolvement, navigationId, + navigationParams, cspNavigationType, with allowPOST set to true and completionSteps set to the following step:

      @@ -100245,8 +100245,8 @@ location.href = '#foo';
    3. Append session history traversal steps to navigable's traversable to finalize a cross-document - navigation given navigable, historyHandling, and - historyEntry.

    4. + navigation given navigable, historyHandling, + userInvolvement, and historyEntry.

@@ -100265,8 +100265,9 @@ location.href = '#foo';
The usual cross-document navigation case

To finalize a cross-document navigation given a navigable - navigable, history handling behavior historyHandling, and - session history entry historyEntry:

+ navigable, a history handling behavior historyHandling, a + user navigation involvement userInvolvement, and a session history + entry historyEntry:

  1. Assert: this is running on navigable's

  2. Apply the push/replace history step targetStep to - traversable given historyHandling.

  3. + traversable given historyHandling and userInvolvement.

@@ -100480,7 +100481,7 @@ location.href = '#foo';
  • Append session history traversal steps to targetNavigable's traversable to finalize a cross-document navigation with targetNavigable, - historyHandling, and historyEntry.

  • + historyHandling, userInvolvement, and historyEntry.

    To evaluate a javascript: URL given a navigable @@ -100765,8 +100766,8 @@ location.href = '#foo';

    1. Finalize a same-document navigation given traversable, - navigable, historyEntry, entryToReplace, and - historyHandling.

    2. + navigable, historyEntry, entryToReplace, + historyHandling, and userInvolvement.

    3. Invoke WebDriver BiDi fragment navigated with navigable's active browsing context and a new WebDriver BiDi navigation @@ -100781,8 +100782,8 @@ location.href = '#foo';

      To finalize a same-document navigation given a traversable navigable traversable, a navigable targetNavigable, a session history entry targetEntry, a session history entry-or-null - entryToReplace, and a history handling behavior - historyHandling:

      + entryToReplace, a history handling behavior historyHandling, + and a user navigation involvement userInvolvement:

      This is used by both fragment navigations and by the URL and history update steps, which are the only synchronous updates to @@ -100836,7 +100837,7 @@ location.href = '#foo';

    4. Apply the push/replace history step targetStep to - traversable given historyHandling.

      + traversable given historyHandling and userInvolvement.

      This is done even for "replace" navigations, as it resolves race @@ -101055,7 +101056,7 @@ location.href = '#foo'; canceled">check if unloading is canceled for a list of navigables navigablesThatNeedBeforeUnload, given an optional traversable navigable traversable, an optional integer - targetStep, and an optional user navigation involvement-or-null + targetStep, and an optional user navigation involvement userInvolvementForNavigateEvent, run these steps. They return "canceled-by-beforeunload", "canceled-by-navigate", or "continue".

      @@ -101104,8 +101105,6 @@ location.href = '#foo';
        -
      1. Assert: userInvolvementForNavigateEvent is not null.

      2. -
      3. Let eventsFired be false.

      4. Let needsBeforeunload be true if navigablesThatNeedBeforeUnload @@ -101357,7 +101356,8 @@ location.href = '#foo'; history traversal steps to traversable:

          -
        1. Apply the reload history step to traversable.

        2. +
        3. Apply the reload history step to traversable given + userInvolvement.

      @@ -101522,8 +101522,8 @@ location.href = '#foo';
      1. Finalize a same-document navigation given traversable, - navigable, newEntry, entryToReplace, and - historyHandling.

      2. + navigable, newEntry, entryToReplace, + historyHandling, and "none".

      3. Invoke WebDriver BiDi history updated with navigable.

      @@ -101563,12 +101563,11 @@ location.href = '#foo'; entry entry, given a navigable navigable, a NavigationTimingType navTimingType, a source snapshot params sourceSnapshotParams, a target snapshot params - targetSnapshotParams, an optional navigation ID-or-null - navigationId (default null), an optional navigation params-or-null - navigationParams (default null), an optional string cspNavigationType - (default "other"), an optional user navigation involvement - userInvolvement (default - "none"), an optional boolean targetSnapshotParams, a user navigation involvement + userInvolvement, an optional navigation ID-or-null navigationId + (default null), an optional navigation params-or-null navigationParams + (default null), an optional string cspNavigationType (default "other"), an optional boolean allowPOST (default false), and optional algorithm steps completionSteps (default an empty @@ -102814,18 +102813,19 @@ location.href = '#foo'; data-x="tn-current-session-history-step">current session history step.

    5. Return the result of applying the history - step step to traversable given false, null, null, null, and - null.

    6. + step step to traversable given false, null, null, "none", and null.

    To apply the push/replace history step given a non-negative integer step - and a history handling behavior historyHandling to a - traversable navigable traversable:

    + to a traversable navigable traversable, given a history handling + behavior historyHandling and a user navigation involvement + userInvolvement:

    1. Return the result of applying the history - step step to traversable given false, null, null, null, and - historyHandling.

    2. + step step to traversable given false, null, null, + userInvolvement, and historyHandling.

    Apply the push/replace history step never passes source @@ -102834,15 +102834,17 @@ location.href = '#foo'; data-x="navigate">navigation algorithm.

    To apply the reload history step to a traversable navigable - traversable:

    + traversable given user navigation involvement + userInvolvement:

    1. Let step be traversable's current session history step.

    2. Return the result of applying the history - step step to traversable given true, null, null, null, - and "reload".

    3. + step step to traversable given true, null, null, + userInvolvement, and "reload".

    Apply the reload history step never passes source snapshot @@ -102871,11 +102873,11 @@ location.href = '#foo'; non-negative integer step to a traversable navigable traversable, with boolean checkForCancelation, source snapshot params-or-null sourceSnapshotParams, navigable-or-null - initiatorToCheck, user navigation involvement-or-null - userInvolvementForNavigateEvents, and NavigationType-or-null - navigationType, perform the following steps. They return "initiator-disallowed", "canceled-by-beforeunload", "canceled-by-navigate", or "applied".

    + initiatorToCheck, user navigation involvement userInvolvement, + and NavigationType-or-null navigationType, perform the following steps. + They return "initiator-disallowed", "canceled-by-beforeunload", "canceled-by-navigate", or + "applied".

    1. Assert: This is running within traversable's

    2. If checkForCancelation is true, and the result of checking if unloading is canceled given navigablesCrossingDocuments, traversable, - targetStep, and userInvolvementForNavigateEvents is not "continue", then return that result.

    3. + targetStep, and userInvolvement is not "continue", + then return that result.

    4. Let changingNavigables be the result of get all navigables whose current session history entry will change or reload given traversable and @@ -103054,16 +103056,12 @@ location.href = '#foo';

      then:

        -
      1. Assert: userInvolvementForNavigateEvents is not - null.

      2. -
      3. Let navigation be navigable's active window's navigation API.

      4. Fire a traverse navigate event at - navigation given targetEntry and - userInvolvementForNavigateEvents.

      5. + navigation given targetEntry and userInvolvement.

    5. @@ -103109,9 +103107,9 @@ location.href = '#foo';
    6. In parallel, attempt to populate the history entry's document for targetEntry, given navigable, potentiallyTargetSpecificSourceSnapshotParams, targetSnapshotParams, - userInvolvementForNavigateEvents, - with allowPOST set to allowPOST - and completionSteps set to + userInvolvement, with allowPOST set + to allowPOST and completionSteps set to queue a global task on the navigation and traversal task source given navigable's active window to run afterDocumentPopulated.

    7. From 379e3c05f69b59329017e82d90b1af88385d4050 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 12 Dec 2024 16:53:08 +0900 Subject: [PATCH 6/6] Nit fix --- source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source b/source index 6cf77c626d5..21172f0b332 100644 --- a/source +++ b/source @@ -97897,7 +97897,7 @@ interface NotRestoredReasons { picking a specific ordering, to achieve interoperability.

        -
      1. If currentTopLevelBrowsingContext equals topLevelBrowsingContext, +

      2. If currentTopLevelBrowsingContext is topLevelBrowsingContext, then continue.

      3. Let documentToSearch be topLevelBrowsingContext's active