w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
679 stars 194 forks source link

Automatically accept any "beforeunload" prompt upon navigation or close window. #1782

Closed whimboo closed 8 months ago

whimboo commented 8 months ago

Right now the spec says that we should automatically dismiss any beforeunload prompt upon navigation or window close:

User prompts that are spawned from beforeunload event handlers, are dismissed implicitly upon navigation or close window, regardless of the defined user prompt handler.

But the problem is the definition of dismissed:

To dismiss the current user prompt, do so as if the user would click the Cancel or OK button, whichever is present, in that order.

Given that such prompts have both an OK and Cancel button, we would have to click on Cancel. But that will cause the page to never get unloaded for a navigation, and the wait for navigation to complete steps to hang until the page timeout because.

I'll check for proper tests when implementing this type of prompt for Marionette in Firefox on https://bugzilla.mozilla.org/show_bug.cgi?id=1693857.


Preview | Diff

whimboo commented 8 months ago

CC @gsnedders