From bb780318e7208b4a2ddf9e835c713b5cfd71f922 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 27 Jun 2023 16:55:54 -0400 Subject: [PATCH 01/16] Initial quick changes for base URL --- source | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/source b/source index 3338bb1f8f0..cdee5538e85 100644 --- a/source +++ b/source @@ -6943,6 +6943,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

The fallback base URL of a Document object document is the URL record obtained by running these steps:

+ // TODO(domfarolino): Do this.
  1. If document is an iframe srcdoc document, then return document's @@ -94278,6 +94279,7 @@ interface BeforeUnloadEvent : Event {

  2. Return browsingContext and document.

+ // TODO(domfarolino): Change this to no longer need to care about container origin.

To determine the origin, given a URL url, a sandboxing flag set sandboxFlags, an origin-or-null sourceOrigin, and an origin-or-null @@ -94865,6 +94867,11 @@ interface BeforeUnloadEvent : Event { data-x="document-state-nav-target-name">navigable target name is cleared.

+
  • +

    A base URL, which is a URL or null, + initially null.

    +
  • +
  • Nested histories, a list of nested histories, initially an empty list.

  • @@ -95721,6 +95728,9 @@ location.href = '#foo';
  • Let initiatorOriginSnapshot be sourceDocument's origin.

  • +
  • Let initiatorBaseURLSnapshot be sourceDocument's document base + URL.

  • + -
  • If url is about:blank, then set documentState's origin to documentState's initiator origin.

  • +
  • +

    If url is about:blank, then:

    + +
      +
    1. Set documentState's origin to + documentState's initiator + origin.

    2. + +
    3. Set documentState's base URL + to initiatorBaseURLSnapshot.

    4. + domfarolino +
    +
  • + // TODO(domfarolino): Set this correctly.
  • Otherwise, if url is about:srcdoc, then set documentState's origin to @@ -97677,6 +97698,7 @@ location.href = '#foo';

  • + // TODO(domfarolino): Make sure we get the origin set correctly here.

    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 From 36031822681ddfc1dd2bd7b13e96186d49a4e5a6 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 28 Jun 2023 11:19:01 -0400 Subject: [PATCH 02/16] More night-time base URL progress --- source | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/source b/source index cdee5538e85..24480a7f3c0 100644 --- a/source +++ b/source @@ -6943,7 +6943,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    The fallback base URL of a Document object document is the URL record obtained by running these steps:

    - // TODO(domfarolino): Do this. +
    1. If document is an iframe srcdoc document, then return document's @@ -94110,13 +94110,9 @@ interface BeforeUnloadEvent : Event {

    2. Let sandboxFlags be the result of determining the creation sandboxing flags given browsingContext and embedder.

    3. -
    4. Let origin be the result of determining the - origin given about:blank, sandboxFlags, creatorOrigin, - and null.

    5. + origin given about:blank, sandboxFlags, and + creatorOrigin.

    6. Let permissionsPolicy be the result of creating a permissions policy @@ -94279,11 +94275,9 @@ interface BeforeUnloadEvent : Event {

    7. Return browsingContext and document.

    - // TODO(domfarolino): Change this to no longer need to care about container origin.

    To determine the origin, given a URL - url, a sandboxing flag set sandboxFlags, an - origin-or-null sourceOrigin, and an origin-or-null - containerOrigin:

    + url, a sandboxing flag set sandboxFlags, and an + origin-or-null initiatorOrigin:

    1. If sandboxFlags has its sandboxed origin browsing @@ -94297,14 +94291,14 @@ interface BeforeUnloadEvent : Event {

      If url is about:srcdoc, then:

        -
      1. Assert: containerOrigin is non-null.

      2. +
      3. Assert: initiatorOrigin is non-null.

      4. -
      5. Return containerOrigin.

      6. +
      7. Return initiatorOrigin.

    2. If url matches about:blank and - sourceOrigin is non-null, then return sourceOrigin.

    3. + initiatorOrigin is non-null, then return initiatorOrigin.

    4. Return url's origin.

    @@ -96008,11 +96002,11 @@ location.href = '#foo';
  • Set documentState's base URL to initiatorBaseURLSnapshot.

  • - domfarolino + - // TODO(domfarolino): Set this correctly. +
  • Otherwise, if url is about:srcdoc, then set documentState's origin to @@ -96053,8 +96047,8 @@ location.href = '#foo';

  • Let responseOrigin be the result of determining the origin given response's URL, - finalSandboxFlags, documentState's initiator origin, and null.

  • + finalSandboxFlags, and documentState's initiator origin.

  • Let coop be a new cross-origin opener policy.

  • @@ -97698,7 +97692,6 @@ location.href = '#foo'; - // TODO(domfarolino): Make sure we get the origin set correctly here.

    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 @@ -97728,8 +97721,8 @@ location.href = '#foo';

  • Let responseOrigin be the result of determining the origin given response's URL, targetSnapshotParams's sandboxing - flags, null, and entry's document - state's origin.

  • + flags, and entry's document state's + origin.

  • Let coop be a new cross-origin opener policy.

  • @@ -98114,9 +98107,8 @@ location.href = '#foo';
  • Set responseOrigin to the result of determining the origin given response's URL, - finalSandboxFlags, entry's document - state's initiator origin, and - null.

  • + finalSandboxFlags, entry's and document + state's initiator origin.

  • If navigable is a top-level traversable, then:

    From a30d972fa6f3870aa55652ed88b59e8f0c4fe1d3 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 28 Jun 2023 11:58:00 -0400 Subject: [PATCH 03/16] One more dfn --- source | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source b/source index 24480a7f3c0..77fc70bccd2 100644 --- a/source +++ b/source @@ -10586,6 +10586,14 @@ partial interface Document {

    Each Document has a navigation id, which is a navigation ID or null, initially null.

    +

    Each Document has a about base + URL, which is a URL or null, initially null.

    + +domfarolino +

    This is only populated for "about:"-schemed + Documents, and gets populated from the document state's upon creation.

    +

    The DocumentOrShadowRoot interface

    DOM defines the base URL, which is a URL or null, - initially null.

    +

    A about base URL, which is a + URL or null, initially null.

    + + domfarolino +

    This.

  • Nested histories, a list From e71fda2323d7a5c8a6b57722e8e5a328170ef66c Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 28 Jun 2023 14:48:08 -0400 Subject: [PATCH 04/16] More --- source | 63 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/source b/source index 77fc70bccd2..77e17f1b102 100644 --- a/source +++ b/source @@ -6943,24 +6943,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    The fallback base URL of a Document object document is the URL record obtained by running these steps:

    -
      -
    1. If document is an iframe srcdoc document, then return document's - container document's document base - URL.

    2. -
    3. - +

      If document's URL's scheme is "about", then:

      - +
        +
      1. Assert: document's about base URL is non-null.

      2. -

        If document's URL is - about:blank, and document's browsing - context's creator base URL is non-null, then return that creator base - URL.

        +
      3. Return document's about base + URL.

      4. +
    4. @@ -10586,13 +10580,11 @@ partial interface Document {

      Each Document has a navigation id, which is a navigation ID or null, initially null.

      -

      Each Document has a about base +

      Each Document has an about base URL, which is a URL or null, initially null.

      -domfarolino

      This is only populated for "about:"-schemed - Documents, and gets populated from the document state's upon creation.

      + Documents.

      The DocumentOrShadowRoot interface

      @@ -94021,6 +94013,7 @@ interface BeforeUnloadEvent : Event {
    5. An initial URL, a URL or null, initially null.

    6. +
    7. A creator base URL, null or an algorithm that returns a URL, initially null.

    8. @@ -94104,6 +94097,7 @@ interface BeforeUnloadEvent : Event {
    9. Set creatorOrigin to creator's origin.

    10. +
    11. Set browsingContext's creator base URL to an algorithm which returns creator's base URL.

    12. @@ -94870,11 +94864,13 @@ interface BeforeUnloadEvent : Event {
    13. -

      A about base URL, which is a +

      An about base URL, which is a URL or null, initially null.

      - domfarolino -

      This.

      +

      This will be populated only for "about:"-schemed + Documents and will be the fallback base URL for those + Documents. It is a snapshot of the initiator Document's document + base URL.

    14. Nested histories, a list @@ -96011,19 +96007,24 @@ location.href = '#foo'; documentState's initiator origin.

    15. -
    16. Set documentState's base URL - to initiatorBaseURLSnapshot.

    17. - +
    18. Set documentState's about base + URL to initiatorBaseURLSnapshot.

  • - -
  • Otherwise, if url is about:srcdoc, then set - documentState's origin to - navigable's parent's active document's origin.

  • +
  • +

    Otherwise, if url is about:srcdoc, then:

    + +
      +
    1. Set documentState's origin to + navigable's parent's active document's origin.

    2. + +
    3. Set documentState's about base + URL to initiatorBaseURLSnapshot.

    4. +
    +
  • Let historyEntry be a new session history entry, with its URL set to url and its Date: Wed, 28 Jun 2023 15:25:22 -0400 Subject: [PATCH 05/16] More --- source | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/source b/source index 77e17f1b102..caccf563344 100644 --- a/source +++ b/source @@ -93352,6 +93352,10 @@ interface BeforeUnloadEvent : Event {

    navigable target name
    targetName
    + +
    about base URL
    +
    document's about base + URL
  • @@ -94090,6 +94094,8 @@ interface BeforeUnloadEvent : Event {
  • Let creatorOrigin be null.

    +
  • Let creatorBaseURL be null.

  • +
  • If creator is non-null, then:

    @@ -94097,9 +94103,8 @@ interface BeforeUnloadEvent : Event {
  • Set creatorOrigin to creator's origin.

  • - -
  • Set browsingContext's creator base URL to an algorithm which - returns creator's base URL.

  • +
  • Set creatorBaseURL to creator's document base + URL.

  • Set browsingContext's virtual browsing context group ID to @@ -94185,6 +94190,9 @@ interface BeforeUnloadEvent : Event {

    is initial about:blank
    true
    + +
    about base URL
    +
    creatorBaseURL
  • @@ -95595,6 +95603,9 @@ location.href = '#foo';
    navigation timing type
    a NavigationTimingType used for creating the navigation timing entry for the new Document
    + +
    about base URL
    +
    a URL or null, initially null.

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

    navigation timing type
    "navigate"
    + +
    about base URL
    +
    null
    @@ -96503,6 +96517,9 @@ location.href = '#foo';
    navigation timing type
    "navigate"
    + +
    about base URL
    +
    null
    @@ -97805,6 +97822,10 @@ location.href = '#foo';
    navigation timing type
    navTimingType
    + +
    about base URL
    +
    entry's document state's's about base URL
    @@ -98203,6 +98224,9 @@ location.href = '#foo';
    origin
    oldDocState's origin
    +
    about base URL
    +
    oldDocState's about base URL
    +
    resource
    oldDocState's resource
    @@ -98424,6 +98448,10 @@ location.href = '#foo';
    navigation timing type
    navTimingType
    + +
    about base URL
    +
    entry's document state about base URL
    @@ -100056,6 +100084,9 @@ location.href = '#foo';
    current document readiness
    "loading"
    + +
    about base URL
    +
    navigationParams's about base URL
    @@ -100529,6 +100560,9 @@ new PaymentRequest(…); // Allowed to use
    navigation timing type
    navTimingType
    + +
    about base URL
    +
    null
    From 40df819ef0af56234afb6b5ca805e2575e916cb0 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 28 Jun 2023 15:32:03 -0400 Subject: [PATCH 06/16] Get rid of browsing context's creator base URL algorithm --- source | 4 ---- 1 file changed, 4 deletions(-) diff --git a/source b/source index caccf563344..e5d0f0ec90e 100644 --- a/source +++ b/source @@ -94017,10 +94017,6 @@ interface BeforeUnloadEvent : Event {
  • An initial URL, a URL or null, initially null.

  • - -
  • A creator base URL, null or an algorithm that returns a URL, - initially null.

  • -
  • A virtual browsing context group ID integer, initially 0. This is used by cross-origin opener policy reporting, to keep track of the browsing context group switches that would From feac40d474d9c89e8bde5da02fd581138765a60b Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Thu, 29 Jun 2023 19:18:24 -0400 Subject: [PATCH 07/16] Revert determining the source changes --- source | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/source b/source index e5d0f0ec90e..9cf92cb9c25 100644 --- a/source +++ b/source @@ -94115,7 +94115,7 @@ interface BeforeUnloadEvent : Event {

  • Let origin be the result of determining the origin given about:blank, sandboxFlags, and - creatorOrigin.

  • + creatorOrigin, and null.

  • Let permissionsPolicy be the result of creating a permissions policy @@ -94282,8 +94282,9 @@ interface BeforeUnloadEvent : Event {

    To determine the origin, given a URL - url, a sandboxing flag set sandboxFlags, and an - origin-or-null initiatorOrigin:

    + url, a sandboxing flag set sandboxFlags, an + origin-or-null sourceOrigin, and an origin-or-null + containerOrigin:

    1. If sandboxFlags has its sandboxed origin browsing @@ -94297,14 +94298,14 @@ interface BeforeUnloadEvent : Event {

      If url is about:srcdoc, then:

        -
      1. Assert: initiatorOrigin is non-null.

      2. +
      3. Assert: containerOrigin is non-null.

      4. -
      5. Return initiatorOrigin.

      6. +
      7. Return containerOrigin.

    2. If url matches about:blank and - initiatorOrigin is non-null, then return initiatorOrigin.

    3. + sourceOrigin is non-null, then return sourceOrigin.

    4. Return url's origin.

    @@ -96066,8 +96067,8 @@ location.href = '#foo';
  • Let responseOrigin be the result of determining the origin given response's URL, - finalSandboxFlags, and documentState's initiator origin.

  • + finalSandboxFlags, documentState's initiator origin, and null.

  • Let coop be a new cross-origin opener policy.

  • @@ -97746,8 +97747,8 @@ location.href = '#foo';
  • Let responseOrigin be the result of determining the origin given response's URL, targetSnapshotParams's sandboxing - flags, and entry's document state's - origin.

  • + flags, null, and entry's document + state's origin.

  • Let coop be a new cross-origin opener policy.

  • @@ -98136,8 +98137,9 @@ location.href = '#foo';
  • Set responseOrigin to the result of determining the origin given response's URL, - finalSandboxFlags, entry's and document - state's initiator origin.

  • + finalSandboxFlags, entry's document + state's initiator origin, and + null.

  • If navigable is a top-level traversable, then:

    From 802156457eb6aedd5f7f02c3bf354ac7e035d428 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 30 Jun 2023 16:15:00 -0400 Subject: [PATCH 08/16] Create top-level case --- source | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source b/source index 9cf92cb9c25..900c3a64f31 100644 --- a/source +++ b/source @@ -93190,6 +93190,10 @@ interface BeforeUnloadEvent : Event {
    navigable target name
    targetName
    + +
    about base URL
    +
    document's about base + URL
  • From 5e09faf1aee501158ac325116602c0572d56ece8 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 30 Jun 2023 16:30:47 -0400 Subject: [PATCH 09/16] Commas --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 900c3a64f31..5c90629f5fe 100644 --- a/source +++ b/source @@ -94118,8 +94118,8 @@ interface BeforeUnloadEvent : Event { flags given browsingContext and embedder.

  • Let origin be the result of determining the - origin given about:blank, sandboxFlags, and - creatorOrigin, and null.

  • + origin given about:blank, sandboxFlags, creatorOrigin, + and null.

  • Let permissionsPolicy be the result of creating a permissions policy From 69dc60d3c01e988f70f748ae64af6193a6fca1f5 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 4 Jul 2023 14:47:40 -0400 Subject: [PATCH 10/16] Address review --- source | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source b/source index 5c90629f5fe..db30ffd68b0 100644 --- a/source +++ b/source @@ -6945,8 +6945,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    1. -

      If document's URL's scheme is "about", then:

      +

      If document is an iframe + srcdoc document, then:

      1. Assert: document's

      2. +
      3. If document's URL is + about:blank and document's about base URL is non-null, then return + document's about base URL.

      4. +
      5. Return document's URL.

      6. @@ -94192,7 +94197,7 @@ interface BeforeUnloadEvent : Event {
        true
        about base URL
        -
        creatorBaseURL
        +
        creatorBaseURL
        @@ -95606,7 +95611,12 @@ location.href = '#foo'; entry">creating the navigation timing entry for the new Document
        about base URL
        -
        a URL or null, initially null.
        +
        +

        a URL or null

        + +

        This is used to populate the resulting Document's about base URL.

        +

        Once a navigation params struct is created, this standard does not From b780dd43169c72e91248e423c1196ae8b4f5ee4f Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 4 Jul 2023 15:11:55 -0400 Subject: [PATCH 11/16] Collapse blank/srcdoc inheritance scenarios --- source | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/source b/source index db30ffd68b0..46e324d535f 100644 --- a/source +++ b/source @@ -96022,7 +96022,7 @@ location.href = '#foo';

      7. -

        If url is about:blank, then:

        +

        If url is about:blank or about:srcdoc, then:

        1. Set documentState's origin to @@ -96034,20 +96034,6 @@ location.href = '#foo';

      8. -
      9. -

        Otherwise, if url is about:srcdoc, then:

        - -
          -
        1. Set documentState's origin to - navigable's parent's active document's origin.

        2. - -
        3. Set documentState's about base - URL to initiatorBaseURLSnapshot.

        4. -
        -
      10. -
      11. Let historyEntry be a new session history entry, with its URL set to url and its document state set to From 1a6ea059c63e35be533b84448684e2cf3aada388 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 4 Jul 2023 15:27:27 -0400 Subject: [PATCH 12/16] Handle javascript: navigations --- source | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source b/source index 46e324d535f..1a7de610a8f 100644 --- a/source +++ b/source @@ -96344,6 +96344,10 @@ location.href = '#foo';

        origin
        initiatorOriginSnapshot
        +
        about base URL
        +
        oldDocState's about base + URL
        +
        resource
        null
        From 6957edf6b789a640378fc31ce251656f7ad5a125 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Tue, 4 Jul 2023 15:38:50 -0400 Subject: [PATCH 13/16] Copy active document's about base URL for JS navs --- source | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source b/source index 1a7de610a8f..adad9599077 100644 --- a/source +++ b/source @@ -96520,7 +96520,8 @@ location.href = '#foo';
        "navigate"
        about base URL
        -
        null
        +
        targetNavigable's active document's about base URL
      12. From 0301744903156aaf45dc9012fe26ccba5a8da158 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 12 Jul 2023 14:54:03 +0900 Subject: [PATCH 14/16] Nit fixes --- source | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source b/source index adad9599077..2e2eb785369 100644 --- a/source +++ b/source @@ -95611,12 +95611,8 @@ location.href = '#foo'; entry">creating the navigation timing entry for the new Document
        about base URL
        -
        -

        a URL or null

        - -

        This is used to populate the resulting Document's about base URL.

        -
        +
        a URL or null used to populate the new Document's about base URL

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

        1. Set documentState's origin to - documentState's initiator - origin.

        2. + initiatorOriginSnapshot.

        3. Set documentState's about base URL to initiatorBaseURLSnapshot.

        4. @@ -97826,7 +97821,7 @@ location.href = '#foo';
          navTimingType
          about base URL
          -
          entry's document state's's entry's document state's about base URL
          @@ -98453,7 +98448,7 @@ location.href = '#foo';
          navTimingType
          about base URL
          -
          entry's document state entry's document state's about base URL
          From b8e91be040e71e46de376d91d5f4b28a93def7e9 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Jul 2023 10:24:29 -0400 Subject: [PATCH 15/16] Object/embed case --- source | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source b/source index 2e2eb785369..3d956c53021 100644 --- a/source +++ b/source @@ -95611,8 +95611,13 @@ location.href = '#foo'; entry">creating the navigation timing entry for the new Document
          about base URL
          -
          a URL or null used to populate the new Document's about base URL
          +
          +

          a URL or null used to populate the new Document's about base URL

          + +

          This is only populated for "about:"-schemed + Documents that will be created by these navigation params.

          +

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

          "navigate"
          about base URL
          -
          null
          +
          documentState's about base + URL
        From f447e34156b95fb6bfdd3100c8f2d12e043f2a1e Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Jul 2023 10:29:28 -0400 Subject: [PATCH 16/16] Actually, remove the navigation-params note since domenic@ removed it in his nits --- source | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source b/source index 3d956c53021..86735d9eddd 100644 --- a/source +++ b/source @@ -95611,13 +95611,8 @@ location.href = '#foo'; entry">creating the navigation timing entry for the new Document
        about base URL
        -
        -

        a URL or null used to populate the new Document's about base URL

        - -

        This is only populated for "about:"-schemed - Documents that will be created by these navigation params.

        -
        +
        a URL or null used to populate the new Document's about base URL

        Once a navigation params struct is created, this standard does not