w3c / webdriver-bidi

Bidirectional WebDriver protocol for browser automation
https://w3c.github.io/webdriver-bidi/
363 stars 40 forks source link

Emit `browsingContext.navigationStarted` before any navigation events #657

Open jrandolf-2 opened 7 months ago

jrandolf-2 commented 7 months ago

Currently, we emit browsingContext.navigationStarted after history navigation in https://html.spec.whatwg.org/#beginning-navigation. It may be unexpected for clients particular because history navigation is a form of navigation that appears suddenly, without a prior event indicating navigation has started.

The following is a proposed spec change for the HTML spec that triggers browsingContext.navigationStarted before any navigation events occurs: https://github.com/whatwg/html/pull/10132

Cc: @whimboo @jgraham @OrKoN @Lightning00Blade

whimboo commented 7 months ago

Please note that for history navigation operations such as pushState(), there is an issue filed at https://github.com/w3c/webdriver-bidi/issues/502. And as outlined there, the HTML specification is not going through the navigation steps at all for session history.

css-meeting-bot commented 7 months ago

The Browser Testing and Tools Working Group just discussed Emit browsingContext.navigationStarted before any navigation events.

The full IRC log of that discussion <AutomatedTester> Topic: Emit browsingContext.navigationStarted before any navigation events
<AutomatedTester> github: https://github.com/w3c/webdriver-bidi/issues/657
<jrandolf> q+
<AutomatedTester> ack next
<AutomatedTester> jrandolf: in the html spec that we have events that come out. Sometimes these events don't come back in an order that makes sense
<AutomatedTester> ... we, chrome, want to propose that we move some of these events so that they happen earlier
<AutomatedTester> q?
<whimboo> q+
<AutomatedTester> ack next
<AutomatedTester> whimboo: for normal navigations this should be fine. I would need jgraham to review too. I am concerned about hash navigations on this
<jrandolf> q+
<AutomatedTester> ... I think we should probably look into this more deeply
<AutomatedTester> q?
<AutomatedTester> jrandolf: on chromium side, we fragment navigation is sequential for us too
<AutomatedTester> ... the cancellation event can still happen before the started and I think we should be sending that started event
<AutomatedTester> ... and the started event could be faked on fragment navigation
<AutomatedTester> ... and have the started before erroring can occur
<AutomatedTester> q?
<AutomatedTester> ack next
<AutomatedTester> q?
<AutomatedTester> whimboo: could we have some use cases here so we can see the scenarios and the expectations
<whimboo> present-
jrandolf-2 commented 7 months ago

Related event: https://developer.mozilla.org/en-US/docs/Web/API/Navigation/navigate_event