From 45a1c98138e66111b983208c450313143c4df5b2 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Sun, 6 Dec 2020 10:56:07 -0500 Subject: [PATCH 1/9] Fix updating the session history --- source | 84 ++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/source b/source index a5277988f9a..7189859e0e1 100644 --- a/source +++ b/source @@ -84075,9 +84075,10 @@ interface Location { // but see also entry update" -
A navigation to an existing session history entry to recreate that entry's document, which was previously discarded.
+
A navigation intended to recreate the document of an + existing session history entry which was previously discarded, by replacing the session history entry + and updating the current session history entry to it.
"reload"
A navigation intended to reload the current page and replace the "replace"
A non-reload navigation that will replace the current session history entry.
+ + // domfar-reload-note +

The values "reload" and "replace" are the same in every way except for two; "reload" is specifically used when we need to set a request's reload-navigation flag, and to bypass + the Navigate to a fragment algorithm in cases where it + would otherwise be triggered.

Navigation always involves source browsing context, which is the browsing @@ -85125,18 +85134,16 @@ new PaymentRequest(…); // Allowed to use </script> + // domfar-update-dfn

Some of the sections below, to which the above algorithm defers in certain cases, require the user agent to update the session history with the new page, given some navigation - params navigationParams. When a user agent is required to do this, it must - queue a global task on the networking task source, given the - relevant global object of the Document object of the current - entry (not the new one), to run the following steps:

+ params navigationParams and a Document newDocument. When + a user agent is required to do this, it must queue a global task on the + networking task source, given the relevant global object of the + Document object of the current entry (not the new one), to run the + following steps:

    -
  1. Let newDocument be navigationParams's browsing context's active - document.

  2. -
  3. Unload the document of the current entry.

    @@ -85152,16 +85159,27 @@ new PaymentRequest(…); // Allowed to use
  4. If navigationParams's history - handling is "reload" or "entry update"
    + handling is "entry update" or "reload"
      -
    1. Replace the document of the current - entry, and any other entries that reference the same document as that entry, with newDocument.

    2. +
    3. Let newEntry be a new session history entry whose document is newDocument.

    4. -
    5. Traverse the history to the current entry.

    6. +
    7. Replace the document of all entries (except the + current entry) that reference current entry's document with newDocument.

    8. + +
    9. +

      Insert newEntry in place of current entry in + navigationParams's browsing + context's session history.

      + +

      This step does not change the value of current entry.

      +
    10. + +
    11. Traverse the history to newEntry.

    @@ -85171,12 +85189,20 @@ new PaymentRequest(…); // Allowed to use
      -
    1. Replace the current entry with a new session history entry - whose URL is newDocument's

      Let newEntry be a new session history entry whose URL is newDocument's URL and document is newDocument.

    2. -
    3. Traverse the history to the current entry.

    4. +
    5. +

      Insert newEntry in place of current entry in + navigationParams's browsing + context's session history.

      + +

      This step does not change the value of current entry.

      +
    6. + +
    7. Traverse the history to newEntry.

    @@ -85273,7 +85299,8 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but before any script execution, certainly before the parser stops, the user agent must update the - session history with the new page given navigationParams.

    + session history with the new page given navigationParams and + document.

    @@ -85298,9 +85325,10 @@ new PaymentRequest(…); // Allowed to use character encoding.

    Then, with the newly created Document, the user agent must update the - session history with the new page given navigationParams. User agents may do - this before the complete document has been parsed (thus achieving incremental rendering), - and must do this before any scripts are to be executed.

    + session history with the new page given navigationParams and the newly-created + Document. User agents may do this before the complete document has been parsed (thus + achieving incremental rendering), and must do this before any scripts are to be + executed.

    Error messages from the parse process (e.g., XML namespace well-formedness errors) may be reported inline by mutating the Document.

    @@ -85347,7 +85375,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished parsing, the user agent must update the session history with the new page given - navigationParams.

    + navigationParams and document.

    User agents may add content to the head element of the Document, e.g., linking to a style sheet, providing script, or giving the document a title.

    @@ -85435,7 +85463,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished fully loading, the user agent must update the session history with the new page given - navigationParams.

    + navigationParams and document.

    User agents may add content to the head element of the Document, or attributes to the element host element, e.g., to link to a style sheet, to provide a @@ -85480,7 +85508,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished fully loading, the user agent must update the session history with the new page given - navigationParams.

    + navigationParams and document.

    User agents may add content to the head element of the Document, or attributes to the embed element, e.g. to link to a style sheet or to give the @@ -85536,7 +85564,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has been completely set up, the user agent must update the session history with the new page - given navigationParams.

    + given navigationParams and document.

    From 8ab810a9f25e0bc817e8e2f5748f19d5fcf756c7 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Sun, 6 Dec 2020 11:05:56 -0500 Subject: [PATCH 2/9] Clean my vim scoll helpers --- source | 2 -- 1 file changed, 2 deletions(-) diff --git a/source b/source index 7189859e0e1..ba393b22584 100644 --- a/source +++ b/source @@ -84088,7 +84088,6 @@ interface Location { // but see also
    current session history entry. - // domfar-reload-note

    The values "reload" and "replace" are the same in every way except for two; "reload" is specifically used when we need to set a request's - // domfar-update-dfn

    Some of the sections below, to which the above algorithm defers in certain cases, require the user agent to update the session history with the new page, given some navigation params navigationParams and a Document newDocument. When From c5756b36d0b239c1ef3148e92925629c528cc049 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Sun, 6 Dec 2020 11:11:04 -0500 Subject: [PATCH 3/9] Likely fix build --- source | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source b/source index ba393b22584..4fb51c5ede3 100644 --- a/source +++ b/source @@ -84087,15 +84087,15 @@ interface Location { // but see also replace"

    A non-reload navigation that will replace the current session history entry.
    - -

    The values "reload" and "replace" are the same in every way except for two; "reload" is specifically used when we need to set a request's reload-navigation flag, and to bypass - the Navigate to a fragment algorithm in cases where it - would otherwise be triggered.

    +

    The values "reload" and "replace" are nearly identical with two exceptions: "reload" is specifically used when we need to set a request's reload-navigation flag, and to bypass the + Navigate to a fragment algorithm in cases where it would + otherwise be triggered.

    +

    Navigation always involves source browsing context, which is the browsing context which was responsible for starting the navigation.

    From abf1c9de22f00565c11d3f4a28dfe25597cbf368 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 11 Dec 2020 01:46:58 -0700 Subject: [PATCH 4/9] Reflect the latest proposals --- source | 74 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/source b/source index 4fb51c5ede3..62ac0796162 100644 --- a/source +++ b/source @@ -85162,45 +85162,60 @@ new PaymentRequest(…); // Allowed to use
      -
    1. Let newEntry be a new session history entry whose document is newDocument.

    2. - -
    3. Replace the document of all entries (except the - current entry) that reference current entry's

      Replace the document of the current + entry, and any other entries that reference the same document with newDocument.

    4. -
    5. -

      Insert newEntry in place of current entry in - navigationParams's browsing - context's session history.

      +
    6. Traverse the history to newEntry with + sameEntryTraversal set to true.

    7. +
    +
    -

    This step does not change the value of current entry.

    +
    If the navigation was initiated with a URL that equals navigationParams's browsing context's active + document's URL
    + +
    +
      +
    1. +

      Let newEntry be a new session history entry whose URL is newDocument's URL and document is + newDocument.

      + +

      Some browsers copy over the serialized state of current entry, + but this is inconsistent. See issue + #6202 for more discussion on this.

    2. -
    3. Traverse the history to newEntry.

    4. +
    5. Insert newEntry after current entry in + navigationParams's browsing + context's session history.

    6. + +
    7. Traverse the history to newEntry with historyHandling set to "replace".

    -
    If the navigation was initiated with a URL that equals newDocument's URL
    +
    If navigationParams's history + handling is "replace"
    1. Let newEntry be a new session history entry whose URL is newDocument's URL and document is - newDocument.

    2. + data-x="she-url">URL is newDocument's URL and document is + newDocument.

      -
    3. -

      Insert newEntry in place of current entry in - navigationParams's browsing - context's session history.

      - -

      This step does not change the value of current entry.

      -
    4. +
    5. Insert newEntry after current entry in + navigationParams's browsing + context's session history.

    6. -
    7. Traverse the history to newEntry.

    8. +
    9. Traverse the history to newEntry with + historyHandling set to "replace".

    @@ -85208,6 +85223,9 @@ new PaymentRequest(…); // Allowed to use
      +
    1. Assert: navigationParams's history + handling is "default".

    2. +
    3. Remove all the entries in the session history after the current entry. If the current entry is the last entry in the session history, @@ -85728,8 +85746,8 @@ new PaymentRequest(…); // Allowed to use with an optional history handling behavior historyHandling (default "default"), an optional boolean nonBlockingEvents - (default false), and an optional boolean explicitHistoryNavigation (default - false):

      + (default false), an optional boolean explicitHistoryNavigation (default + false), and an optional boolean sameEntryTraversal (default false):

      This algorithm is not just invoked when explicitly going back or forwards in the session history — it is also invoked @@ -85784,7 +85802,7 @@ new PaymentRequest(…); // Allowed to use data-x="she-document">document.

    4. If newDocument is different than the current entry's document, then:

      + data-x="she-document">document or sameEntryTraversal is true, then:

      1. Remove any tasks queued by the history traversal From 7ddf9a3ed11b86eda5738c4203a90a06073eafcf Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 11 Dec 2020 09:36:41 -0700 Subject: [PATCH 5/9] Correct some minor mistakes --- source | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/source b/source index 62ac0796162..67e3b0361af 100644 --- a/source +++ b/source @@ -84075,10 +84075,9 @@ interface Location { // but see also entry update" -

        A navigation intended to recreate the document of an - existing session history entry which was previously discarded, by replacing the session history entry - and updating the current session history entry to it.
        +
        A navigation to an existing session history entry to recreate that entry's document, which was previously discarded.
        "reload"
        A navigation intended to reload the current page and replace the document of the current - entry, and any other entries that reference the same document with newDocument.

      2. + entry, and of any other entries that reference the same document as that entry, with newDocument.

        -
      3. Traverse the history to newEntry with +

      4. Traverse the history to the current entry with sameEntryTraversal set to true.

    @@ -85747,7 +85746,7 @@ new PaymentRequest(…); // Allowed to use data-x="traverse-history-hh">historyHandling (default "default"), an optional boolean nonBlockingEvents (default false), an optional boolean explicitHistoryNavigation (default - false), and an optional boolean sameEntryTraversal (default false):

    + false), and an optional boolean sameEntryTraversal (default false):

    This algorithm is not just invoked when explicitly going back or forwards in the session history — it is also invoked @@ -85802,7 +85801,7 @@ new PaymentRequest(…); // Allowed to use data-x="she-document">document.

  5. If newDocument is different than the current entry's document or sameEntryTraversal is true, then:

    + data-x="she-document">document or sameEntryTraversal is true, then:

    1. Remove any tasks queued by the history traversal From 55f83a77d95005355b77d0470922d326e89d4a69 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 11 Dec 2020 12:12:27 -0700 Subject: [PATCH 6/9] Fix most things --- source | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/source b/source index 67e3b0361af..f278218af00 100644 --- a/source +++ b/source @@ -84088,13 +84088,6 @@ interface Location { // but see also current session history entry. -

      The values "reload" and "replace" are nearly identical with two exceptions: "reload" is specifically used when we need to set a request's reload-navigation flag, and to bypass the - Navigate to a fragment algorithm in cases where it would - otherwise be triggered.

      -

      Navigation always involves source browsing context, which is the browsing context which was responsible for starting the navigation.

      @@ -85165,12 +85158,12 @@ new PaymentRequest(…); // Allowed to use entry, and of any other entries that reference the same document as that entry, with newDocument.

    2. -
    3. Traverse the history to the current entry with - sameEntryTraversal set to true.

    4. +
    5. Traverse the history to the current entry with sameEntryTraversal set to true.

    -
    If the navigation was initiated with a URL that Otherwise, if the navigation was initiated with a URL that equals navigationParams's browsing context's active document's URL
    @@ -85184,8 +85177,8 @@ new PaymentRequest(…); // Allowed to use newDocument.

    Some browsers copy over the serialized state of current entry, - but this is inconsistent. See issue - #6202 for more discussion on this.

    + but this is inconsistent. See issue + #6213 for more discussion on this.

  6. Insert newEntry after current entry in @@ -85198,7 +85191,7 @@ new PaymentRequest(…); // Allowed to use

-
If navigationParams's history +
Otherwise, if navigationParams's history handling is "replace"
@@ -85208,7 +85201,7 @@ new PaymentRequest(…); // Allowed to use data-x="concept-document-url">URL and document is newDocument.

-
  • Insert newEntry after current entry in +

  • Insert newEntry after the current entry in navigationParams's browsing context's session history.

  • @@ -85239,9 +85232,7 @@ new PaymentRequest(…); // Allowed to use data-x="concept-document-url">URL and document is newDocument.

    -
  • Traverse the history to the new entry, with historyHandling set to navigationParams's history handling.

  • +
  • Traverse the history to the new entry.

  • @@ -85314,8 +85305,8 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but before any script execution, certainly before the parser stops, the user agent must update the - session history with the new page given navigationParams and - document.

    + session history with the new page given navigationParams and the newly-created + Document.

    @@ -85390,7 +85381,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished parsing, the user agent must update the session history with the new page given - navigationParams and document.

    + navigationParams and the newly-created Document.

    User agents may add content to the head element of the Document, e.g., linking to a style sheet, providing script, or giving the document a title.

    @@ -85478,7 +85469,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished fully loading, the user agent must update the session history with the new page given - navigationParams and document.

    + navigationParams and the newly-created Document.

    User agents may add content to the head element of the Document, or attributes to the element host element, e.g., to link to a style sheet, to provide a @@ -85523,7 +85514,7 @@ new PaymentRequest(…); // Allowed to use

    After creating the Document object, but potentially before the page has finished fully loading, the user agent must update the session history with the new page given - navigationParams and document.

    + navigationParams and the newly-created Document.

    User agents may add content to the head element of the Document, or attributes to the embed element, e.g. to link to a style sheet or to give the From 342aefc27c05ebd027637e33790b5bc41964b6dc Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 11 Dec 2020 13:19:20 -0700 Subject: [PATCH 7/9] Use navigation-params-hh instead of sameEntryTraversal flag --- source | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source b/source index f278218af00..70c547a7f78 100644 --- a/source +++ b/source @@ -85159,7 +85159,8 @@ new PaymentRequest(…); // Allowed to use data-x="she-document">document as that entry, with newDocument.

  • Traverse the history to the current entry with sameEntryTraversal set to true.

  • + data-x="traverse-history-hh">historyHandling set to navigationParams's history handling.

    @@ -85736,8 +85737,8 @@ new PaymentRequest(…); // Allowed to use with an optional history handling behavior historyHandling (default "default"), an optional boolean nonBlockingEvents - (default false), an optional boolean explicitHistoryNavigation (default - false), and an optional boolean sameEntryTraversal (default false):

    + (default false), and an optional boolean explicitHistoryNavigation (default + false):

    This algorithm is not just invoked when explicitly going back or forwards in the session history — it is also invoked @@ -85792,7 +85793,9 @@ new PaymentRequest(…); // Allowed to use data-x="she-document">document.

  • If newDocument is different than the current entry's document or sameEntryTraversal is true, then:

    + data-x="she-document">document, or historyHandling is "entry update" or "reload", + then:

    1. Remove any tasks queued by the history traversal From 6a3a6d6947d1d415b4609e66fc2e14cae74ae55a Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 11 Dec 2020 17:44:19 -0500 Subject: [PATCH 8/9] Nits --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 70c547a7f78..01074c7b447 100644 --- a/source +++ b/source @@ -85182,7 +85182,7 @@ new PaymentRequest(…); // Allowed to use #6213 for more discussion on this.

    2. -
    3. Insert newEntry after current entry in +

    4. Insert newEntry after the current entry in navigationParams's browsing context's session history.

    5. @@ -85571,7 +85571,7 @@ new PaymentRequest(…); // Allowed to use

      After creating the Document object, but potentially before the page has been completely set up, the user agent must update the session history with the new page - given navigationParams and document.

      + given navigationParams and the newly-created Document.

      From 6608d7791a3262e2268533ea7531ab0d92090ff5 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Fri, 11 Dec 2020 18:01:21 -0500 Subject: [PATCH 9/9] Change the assertion while we're there --- source | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source b/source index 01074c7b447..660503df6ee 100644 --- a/source +++ b/source @@ -85751,6 +85751,9 @@ new PaymentRequest(…); // Allowed to use

      If entry's document is null, then:

        +
      1. Assert: historyHandling is "default".

      2. +
      3. Let request be a new request whose url is entry's URL.

      4. @@ -85758,9 +85761,6 @@ new PaymentRequest(…); // Allowed to use
      5. If explicitHistoryNavigation is true, then set request's history-navigation flag.

      6. -
      7. Assert: historyHandling is not "replace".

      8. -
      9. Navigate the browsing context to request with historyHandling