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

fix: fix navigation events #1850

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

fix: fix navigation events #1850

wants to merge 1 commit into from

Conversation

jrandolf
Copy link
Contributor

@jrandolf jrandolf commented Feb 13, 2024

This PR swaps out the deferred promises for event emission and uses a combination of init and requestWillBeSent for navigationStarted. We also introduce random UUIDs for fragment navigation.

Closes #1858

@jrandolf jrandolf force-pushed the jrandolf/fix-loader-id branch 12 times, most recently from 5c3e942 to 697526a Compare February 13, 2024 19:58
@jrandolf jrandolf marked this pull request as ready for review February 13, 2024 20:04
@jrandolf jrandolf marked this pull request as draft February 14, 2024 09:06
@OrKoN OrKoN added the puppeteer Run Puppeteer test when added to PR label Feb 14, 2024
this.#eventManager.registerEvent(
{
type: 'event',
method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted,
Copy link
Collaborator

Choose a reason for hiding this comment

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

The PR title is misleading. #documentChanged is called after CDP call Page.navigate or after Page.lifecycleEvent: init, and has nothing to do with requestWillBeSent.

@jrandolf jrandolf force-pushed the jrandolf/fix-loader-id branch 10 times, most recently from cd49ab6 to 1eafaf4 Compare February 14, 2024 13:29
@jrandolf jrandolf changed the title fix: use requestWillBeSent for navigation started fix: fix navigation events Feb 14, 2024
@jrandolf jrandolf force-pushed the jrandolf/fix-loader-id branch 6 times, most recently from 8655535 to 33dda82 Compare February 15, 2024 21:43
@jrandolf
Copy link
Contributor Author

jrandolf commented Feb 19, 2024

We need to wait till w3c/webdriver-bidi#662 resolves. Currently, CDP doesn't have an event that emits only for non-same-document navigation. Combinations of events also do not work. The closest event is Page.frameRequestedNavigation, but that is only for renderer-initiated navigation.

https://chromium-review.googlesource.com/c/chromium/src/+/5300245 implements an event that captures all navigations (which is still technically not spec-compliant). If w3c/webdriver-bidi#657 resolves to emit navigationStarted for all navigations, then the CL should work as is (+ tests), but if not, the CL needs to be modified to remove navigations not satisfying the resolved criteria.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
puppeteer Run Puppeteer test when added to PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

browsingContext.navigationStarted is not implemented correctly.
4 participants