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

Support automatic user prompt handing in WebDriver BiDi #10189

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

jgraham
Copy link
Member

@jgraham jgraham commented Mar 8, 2024

This reads the return value from the WebDriver BiDi user prompt opened algorithm and uses it to decide whether to show the prompt, or skip showing it but act as if it had been accepted or canceled.

At present the prompt opened function can return three values: "none", which causes the prompt to be displayed, "accept", which acts as if the prompt was accepted, and "dismiss" which acts as if the prompt was rejected. The WebDriver side is responsible for ensuring that only valid responses are sent for each prompt type (e.g. for an alert there isn't a "dismiss" option).

(See WHATWG Working Mode: Changes for more details.)


/browsing-the-web.html ( diff )
/timers-and-user-prompts.html ( diff )

source Outdated Show resolved Hide resolved
source Outdated Show resolved Hide resolved
Copy link
Contributor

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

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

This PR does not handle dismiss yet?

@jgraham jgraham force-pushed the prompt_handler branch 2 times, most recently from 06090d4 to bb7b60e Compare June 12, 2024 09:38
@jgraham
Copy link
Member Author

jgraham commented Jun 18, 2024

This PR does not handle dismiss yet?

Well it does, on the assumption that none/accept/dismiss are the only available options. In that case "dismiss" is what happens when the return value is neither "none" nor "accept". I think for beforeUnload it needs some changes to make the behavior well-defined (we set a variable inside a conditional and later assume it has a value)

This reads the return value from the WebDriver BiDi user prompt opened
algorithm and uses it to decide whether to show the prompt, or skip
showing it but act as if it had been accepted or canceled.

At present the prompt opened function can return three values: "none",
which causes the prompt to be displayed, "accept", which acts as if
the prompt was accepted, and "dismiss" which acts as if the prompt was
rejected. The WebDriver side is responsible for ensuring that only
valid responses are sent for each prompt type (e.g. for an alert there
isn't a "dismiss" option).
@whimboo
Copy link

whimboo commented Jul 4, 2024

@OrKoN is there anything else you would like to add? Otherwise we could find someone to review this PR @jgraham?

@whimboo
Copy link

whimboo commented Aug 8, 2024

@jgraham is that PR ready for a general review now?

@jgraham
Copy link
Member Author

jgraham commented Nov 14, 2024

Yes, as far as I'm concerned this can be reviewed.

@OrKoN
Copy link
Contributor

OrKoN commented Nov 14, 2024

@domenic would you have a chance to review this PR? Thanks!

@domenic
Copy link
Member

domenic commented Nov 15, 2024

I pushed some editorial nits.

My main question is whether it makes sense to always show the prompt in the way you have specified, or if you should avoid showing the prompt if userPromptHandler is "none". The latter makes more sense to me, but isn't the approach you've taken here; instead, you always show the prompts, but only pause for user input in some cases.

@jgraham
Copy link
Member Author

jgraham commented Nov 19, 2024

A user prompt handler of "none" means "no handler", not "no prompt". So in that case we still need to show the prompt so that a user can interact with it.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

Ah, right, I have no idea how I lost that context someone between the start of the review (where it was clear) and the end. Thanks for your patient explanation!

@domenic domenic merged commit ea72316 into whatwg:main Nov 20, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants