Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always fire popstate and restore persisted state sync #7815

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

domenic
Copy link
Member

@domenic domenic commented Apr 12, 2022

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 topic: events interop Implementations are not interoperable with each other labels Apr 12, 2022
@domenic domenic requested review from annevk, ajklein and smaug---- and removed request for ajklein April 12, 2022 16:52
Copy link
Member

@annevk annevk left a comment

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
Copy link
Member Author

domenic commented Apr 26, 2022

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.

@domenic domenic merged commit 3db5bb0 into main Apr 27, 2022
@domenic domenic deleted the popstate-hashchange branch April 27, 2022 17:06
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 topic: history
Development

Successfully merging this pull request may close these issues.

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