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

Add browsingContext.historyUpdated event #740

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

OrKoN
Copy link
Contributor

@OrKoN OrKoN commented Jul 2, 2024

This change adds browsingContext.historyUpdated event to notify the client when a history update happens.

Issue: #502
HTML spec: whatwg/html#10587


Preview | Diff

Copy link
Contributor

@whimboo whimboo left a comment

Choose a reason for hiding this comment

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

Thank you Alex for getting started on this event! For now I have two questions. See inline.

index.bs Show resolved Hide resolved
Copy link
Contributor

@sadym-chromium sadym-chromium left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

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

Thanks, I feel like we should at least have the context info in the event payload, otherwise it will be hard to use?

index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
index.bs Outdated Show resolved Hide resolved
@OrKoN
Copy link
Contributor Author

OrKoN commented Aug 29, 2024

Thanks, I feel like we should at least have the context info in the event payload, otherwise it will be hard to use?

thanks for reviewing, totally! It was a while since I started this PR draft 😅

Copy link
Contributor

@juliandescottes juliandescottes left a comment

Choose a reason for hiding this comment

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

Thanks for the update, looks good to me!

Copy link
Member

@jgraham jgraham left a comment

Choose a reason for hiding this comment

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

A couple of comments, but no blockers.

@@ -4365,6 +4366,48 @@ navigated</dfn> steps given |navigable| and |navigation status|:

</div>

#### The browsingContext.historyUpdated Event #### {#event-browsingContext-historyUpdated}

Copy link
Member

Choose a reason for hiding this comment

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

I know we don't have this for the other events, but it could be useful to have some informative text indicating that this is only fired for pushState and friends, not for history updates caused by navigation.

params: browsingContext.HistoryUpdatedParameters
)

browsingContext.HistoryUpdatedParameters = {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should also include a string indicating the type of the history update to distinguish pushState from replaceState?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we could add it eventually. So far we didn't expose it and didn't have a use case for it so adding it would involve extra implementation work. Also we could add the serialized history state to be able to distinguish multiple updates if there are use cases.

@OrKoN
Copy link
Contributor Author

OrKoN commented Sep 16, 2024

Thanks for reviews! I plan to publish the HTML spec change for review and start working on WPT in the next weeks. For now, I will leave the PR open to incorporate potential updates during the implementation or WPT authoring.

@OrKoN
Copy link
Contributor Author

OrKoN commented Sep 26, 2024

Draft WPT tests: web-platform-tests/wpt#48347 I am still clarifying some details on the HTML spec PR.

@OrKoN
Copy link
Contributor Author

OrKoN commented Oct 7, 2024

There have been additional discussions on the HTML spec PR resulting in the call being moved to a different place in the HTML spec. PTAL and let me know if you have concerns about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants