Skip to content

Always fire popstate and restore persisted state sync - #7815

Merged
domenic merged 1 commit into
mainfrom
popstate-hashchange
Apr 27, 2022
Merged

domenic merged 1 commit into
mainfrom
popstate-hashchange

Conversation

@domenic

@domenic domenic commented Apr 12, 2022 •

Copy link
Copy Markdown
Member

Closes #1792 by aligning with Gecko. The alternative model involved delaying popstate until after the load event, which is what Blink and WebKit do. But the Gecko model is simpler and has fewer edge cases around multiple state changes and such.

(See WHATWG Working Mode: Changes for more details.)


/browsing-the-web.html ( diff )

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 and has fewer edge cases around multiple state changes and such.
@domenic domenic added normative change topic: history Session history, the History interface, pushState(), popstate and scroll restoration topic: events Event handlers, their content and IDL attributes, and the events HTML fires interop Implementations are not interoperable with each other labels Apr 12, 2022
@domenic
domenic requested review from ajklein, annevk and smaug---- and removed request for ajklein April 12, 2022 16:52

@annevk annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird that hashchange wouldn't happen in the same task, but from the tests it does look like that is what happens.

One thing I wondered about while reading this is when "restore persisted state" runs. The way it's written now you could observe from the popstate event listener that nothing happened. But wouldn't it make more sense for it to run first?

@domenic

domenic commented Apr 26, 2022 •

Copy link
Copy Markdown
Member Author

I'm not really sure what makes more sense, but it generally seems interoperable that in the cases this change doesn't touch (i.e. cases where popstate would be after the load event anyway in Chromium and WebKit) everyone uses the order [popstate, scroll restoration, hashchange]: test results.

I guess we should try to expand the linked tests to also include scroll restoration if possible... seems hard though since all our traversal tests so far result in load being the first event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interop Implementations are not interoperable with each other normative change topic: events Event handlers, their content and IDL attributes, and the events HTML fires topic: history Session history, the History interface, pushState(), popstate and scroll restoration

Development

Successfully merging this pull request may close these issues.

popstate/hashchange dispatching doesn't match what browsers do.

2 participants