From 3db5bb00f32ae665537b73b2e214924c44501556 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 27 Apr 2022 13:06:34 -0400 Subject: [PATCH] Always fire popstate and restore persisted state sync Closes #1792 by aligning with Gecko. The alternative model involved delaying popstate until after the load event, which is what WebKit and Blink do. But the Gecko model is simpler, more deterministic (since the load event depends on network timing), and has fewer edge cases around multiple consecutive state changes. --- source | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/source b/source index 3dea7873420..177c17952b9 100644 --- a/source +++ b/source @@ -90415,9 +90415,8 @@ new PaymentRequest(…); // Allowed to use mode.

  • Traverse the history to the new entry, with historyHandling set to historyHandling and with - nonBlockingEvents set to true. This will scroll to the - fragment given in what is now the document's historyHandling set to historyHandling. This will + scroll to the fragment given in what is now the document's URL.

  • Invoke WebDriver BiDi fragment navigated with browsingContext, @@ -90559,9 +90558,8 @@ new PaymentRequest(…); // Allowed to use

    To traverse the history to a session history entry entry, with an optional history handling behavior historyHandling (default "default"), an optional boolean nonBlockingEvents - (default false), and an optional boolean explicitHistoryNavigation (default - false):

    + data-x="hh-default">default"), 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 @@ -90773,28 +90771,22 @@ new PaymentRequest(…); // Allowed to use

  • Set newDocument's latest entry to entry.

  • -
  • -

    If nonBlockingEvents is false, then run the following steps - immediately. Otherwise, queue a global task on the DOM - manipulation task source given newDocument's relevant global - object to run the following steps instead.

    +
  • If stateChanged is true, then fire an + event named popstate at newDocument's + relevant global object, using PopStateEvent, with the state attribute initialized to + state.

  • -
      -
    1. If stateChanged is true, then fire an - event named popstate at newDocument's - relevant global object, using PopStateEvent, with the state attribute initialized to state.

    2. - -
    3. Restore persisted state from entry.

    4. - -
    5. If hashChanged is true, then fire an - event named hashchange at the browsing - context's active window, using HashChangeEvent, with the oldURL attribute initialized to oldURL - and the newURL attribute initialized to - newURL.

    6. -
    - +
  • Restore persisted state from entry.

  • + +
  • If hashChanged is true, then queue a global task on the DOM + manipulation task source given newDocument's relevant global + object to fire an event named hashchange at newDocument's relevant global + object, using HashChangeEvent, with the oldURL attribute initialized to oldURL and + the newURL attribute initialized to + newURL.