Open Bug 1908952 Opened 1 year ago Updated 4 months ago

Add support for "url" field in "browsingContext.navigationFailed" and "browsingContext.navigationStarted" events in case of beforeunload

Categories

(Remote Protocol :: WebDriver BiDi, task, P2)

task
Points:
3

Tracking

(Not tracked)

People

(Reporter: Sasha, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [webdriver:backlog])

In the scope of bug 1846601 we introduced the "browsingContext.navigationFailed" and "browsingContext.navigationStarted" events in case of beforeunload prompt to be opened, but at the moment of the implementation there was no way to get the url which a user intended to navigate when the navigation was interrupted by beforeunload prompt. So we need first to get a platform support for it (see bug 1908951).

Let's revisit for future milestones, the scenarios impacted sound pretty edge casey.

Points: --- → 3
Priority: -- → P2
Whiteboard: [webdriver:backlog]

This currently makes some playwright logic fail (see https://github.com/microsoft/playwright/pull/34281). While we wait for a platform notification to know about the URL, maybe we should at least return an empty string here to have a valid payload?

Flags: needinfo?(aborovova)

(In reply to Julian Descottes [:jdescottes] from comment #2)

This currently makes some playwright logic fail (see https://github.com/microsoft/playwright/pull/34281). While we wait for a platform notification to know about the URL, maybe we should at least return an empty string here to have a valid payload?

Sure, sounds good to me

Flags: needinfo?(aborovova)

There is an additional issue with the navigationStarted event with beforeunload handlers/prompts.
At the moment the event is fired too late compared to what the spec expects.

Spec:
navigation-started should be emitted from https://html.spec.whatwg.org/#beginning-navigation
while the beforeunload handler should only triggered at step 22.1

But we currently emit navigation-started only right before the prompt is opened, after the script of the beforeunload event handler has been executed. So anything observable from this script (eg a console log, a history update ...) will be received before browsingContext.navigationStarted, which is unexpected.

You need to log in before you can comment on or make changes to this bug.