Skip to content

Conversation

@juliandescottes
Copy link
Contributor

No description provided.

@juliandescottes
Copy link
Contributor Author

cc @OrKoN @sadym-chromium

await subscribe_events(events=[CONTEXT_LOAD_EVENT])
on_entry = wait_for_event(CONTEXT_LOAD_EVENT)

result = await bidi_session.browsing_context.navigate(
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to this specific test: do we actually have a way to trigger an error with navigate? I guess a navigate call with beforeunload handler navigating elsewhere would trigger the condition of a new navigation before a commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That should work. In practice any scenario that notifies BiDi about a "canceled"/"navigation failed" status. From a quick read of the HTML spec I can see: CSP issues, beforeunload, unloading a tab, closing/destroying a document.

Eg wait=complete + closing a tab before the navigation finishes should lead to an error.

@juliandescottes
Copy link
Contributor Author

Copy pasting the current status for this test from w3c/webdriver-bidi#763

With the current implementation Chrome fails when

  • wait=interactive + redirect immediately
  • wait=complete + redirect immediately
  • wait=complete + redirect on DOMContentLoaded

Firefox fails in the same cases as Chrome, but also in:

  • wait=interactive + redirect on DOMContentLoaded

@juliandescottes
Copy link
Contributor Author

@OrKoN @sadym-chromium do we agree that beyond the edge cases mentioned in the inline comments, all those navigate calls should succeed?

@OrKoN
Copy link
Contributor

OrKoN commented Aug 26, 2025

@sadym-chromium could you please review? I saw that you started looking into this in GoogleChromeLabs/chromium-bidi#3671

@sadym-chromium
Copy link
Contributor

@OrKoN @sadym-chromium do we agree that beyond the edge cases mentioned in the inline comments, all those navigate calls should succeed?

Currently, Chrome fail the command if the navigation was replaced by another navigation before the command successfully finished. According to the specification (extended in w3c/webdriver-bidi#799), those commands should be successfully finished. I agree that if we don't agree on changing that behavior, we need to align WPT with the spec.

Let me take a deeper look at the WPT you proposed


any_string(result["navigation"])

event = await wait_for_future_safe(on_entry)
Copy link
Contributor

Choose a reason for hiding this comment

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

This wait is tricky, as it can be triggered for the CONTEXT_LOAD_EVENT of the first navigation, the same moment the "Redirect on load" happens. I would tight the logic to browsingContext.navigationStarted events, as they should be emitted for each navigaiton.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, so waiting for 2 navigation started events. In addition to that I can also wait for a context load event for the second URL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that Firefox is not capturing the 2nd navigation started, but arguably that's a bug on our end. I would propose the following: only wait for CONTEXT_LOAD_EVENT here, but for the final url (to address your initial concern) and add another navigation_started test to cover the issue I just found.

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.

Let's use browsingContext.navigationStarted to detect the second navigation is actually started.

@juliandescottes
Copy link
Contributor Author

@OrKoN @sadym-chromium do we agree that beyond the edge cases mentioned in the inline comments, all those navigate calls should succeed?

Currently, Chrome fail the command if the navigation was replaced by another navigation before the command successfully finished. According to the specification (extended in w3c/webdriver-bidi#799), those commands should be successfully finished. I agree that if we don't agree on changing that behavior, we need to align WPT with the spec.

Let me take a deeper look at the WPT you proposed

Thanks for checking, as long as we have the same understanding of the spec (ie, all the tests here should PASS) I'm OK, I don't want to revisit this part of the spec :) But since no browser passed the tests currently I preferred to check first.

@juliandescottes juliandescottes enabled auto-merge (rebase) August 27, 2025 16:38
auto-merge was automatically disabled August 27, 2025 16:38

Pull request was closed

@jgraham jgraham merged commit d7e074e into web-platform-tests:master Aug 27, 2025
27 of 29 checks passed
@jgraham
Copy link
Contributor

jgraham commented Aug 27, 2025

Flaky test seems to be an existing issue.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants