Open jrandolf opened 9 months ago
Oh, sorry I missed that there is an HTML patch, I'll read that :)
So generally a concern I have at the moment is that we don't have any mechanism to specify the behaviour when the dialog is intercepted. I slightly worry that the default here being different to the default for alerts is confusing (with alerts we actually show the alert, even if there's an event, and rely on the subscriber sending a command to continue. If possible I think we ought to do that by default in this case as well, but also make it configurable in some way).
@jgraham The problem with that approach is the blocking behavior of file dialogs, so you cannot set multiple file choosers in parallel.
IIRC, there was a consensus in TPAC to not allow that blocking behavior for file dialogs. Perhaps @OrKoN can confirm.
So generally a concern I have at the moment is that we don't have any mechanism to specify the behaviour when the dialog is intercepted. I slightly worry that the default here being different to the default for alerts is confusing (with alerts we actually show the alert, even if there's an event, and rely on the subscriber sending a command to continue. If possible I think we ought to do that by default in this case as well, but also make it configurable in some way). IIRC, there was a consensus in TPAC to not allow that blocking behavior for file dialogs.
I think we touched upon that at TPAC and the idea is that file dialogs might not actually block the execution on the page so it is possible for the user to continue doing things (in the background via scripts and trigger other dialogs) while the dialog is showing that might have unpredictable results. It is different from the alerts where the loop is actually blocked while waiting for the alert resolution. We also discussed that some user agents might not implement a dialog at all. So, the current version would be preferred from the Puppeteer's perspective.
@jimevans @shs96c do you have insights into what would be preferred by Selenium? I feel like if the client opts into intercepting the dialogs programmatically, there might be no need to show it on screen. WDYT?
Conceptually file dialogs are similar to alert-type prompts, so I'm keen to make sure we don't end up with different behaviour in each case.
With alerts we currently send the client an event, and you're required to respond with a command to dismiss the alert (and provide the return value for the types where that makes sense).
The proposal here is that with file prompts opting in to getting the event means that you don't get a prompt at all, but only get an event, and can provide the value asynchronously if required. Technically that does make some sense (an alert is fundamentally synchronous, whereas you can provide an input to a file dialog at any time), but it's not clear whether or not that difference is enough to justify having a totally different model compared to alerts.
I'm also not sure about just subscribing to an event having side effects on browser behaviour. It is true that with e.g. network request interception we don't block the request if it matches a pattern but there isn't any session with a subscription to the relevant event. So there is some precedent there. But it also seems meaningfully different that interception is itself a webdriver feature, and without someone subscribing to the event it would be possible for anyone (even a human interacting with the browser) to unblock the request.
Why does this only intercept the show picker algorithm for file inputs? Seems like it would be useful to provide a way to intercept all the show picker algorithms?
Why does this only intercept the show picker algorithm for file inputs? Seems like it would be useful to provide a way to intercept all the show picker algorithms?
For now, we are limiting the scope of this PR to file inputs.
I have updated the PR to include the capability processing to reflect the latest discussion at the working group. PTAL
The Browser Testing and Tools Working Group just discussed File upload status
.
The Browser Testing and Tools Working Group just discussed File dialog handling
.
Using the userPromptOpened events jgraham: that sounds great! I was hoping for that
So I assume that we will have a custom type for file open dialogs then which are emitted as browsingContext.userPromptOpened
events? We should then probably update the PR summary to reflect that. @sadym-chromium can you please check? Thanks.
This PR implements the event portion of file dialog flow.
Relevant HTML spec: https://github.com/whatwg/html/pull/9844
Issue: https://github.com/w3c/webdriver-bidi/issues/494 Input.setFiles PR: https://github.com/w3c/webdriver-bidi/pull/514
Preview | Diff