Re: WebDriver and permission door hangers

Hello Mathieu!

On 11 March 2016 at 01:09, Mathieu Hofman <Mathieu.Hofman@citrix.com> wrote:
> From my reading of the spec, I cannot find anything related to the handling of asynchronous user prompts such as permissions and other door hangers.

This is correct, and with intention. The WG wants to complete a base
specification on top of which other extensions can be built later.

At our latest F2F in Sapporo, we talked specifically about adding a
cross-browser permission API. This was originally at the request of
the Web Bluetooth WG, but the principle applies to all user agent
features that require some form of user intervention to gain
privileges.

> The spec allows handling of "alert" type user prompts, but those are defined as modal and blocking [1]. Door hangers are neither of those, as there can be multiple active prompts / door hangers at the same time, and they don't interrupt the user JS execution.

This is true. window.confirm/alert/prompt are special beasts from the
dark ages of the web.

> Furthermore the current user prompt handling seems tailored to simple dismiss / accept use cases, whereas some door hangers can be asking more complex input from the user.
>
> I'm not sure how this use case can be solved in a generic way, but maybe something like an API to list all browser prompts for the session, with information on the prompt type (to differentiate between multiple prompts), list of its inputs and a way to select/fill an input, list actions and a way to trigger one, and maybe a way to dismiss a prompt since it seems to be a common feature.

Fundamentally permissions boil down to arbitrary user agent defined
input data, and we would have to support that.

For example, not all UAs might support “allow”, “deny”, “always
allow”, “always deny”, “not now”. Similarly plug-in handling varies a
lot.

Simon and I discussed what an API could look like and you can read
more about the technical discussion we had in the minutes at
https://www.w3.org/2015/10/25-webdriver-minutes.html#item08.

Once the base specification nears completion, we should revisit this
discussion and create a strawman proposal. WebDriver has explicitly
been designed so that extensions can be built on top of it.

> The existing "alert" prompt could be expressed as a specific type of this generic prompt.

Alerts, confirmations, and prompts are defined in a very specific way
in HTML. Importantly, they pause the JS execution runtime, and in some
browsers, also block the UI. WebDriver needs to handle these
specifically because a range of other commands will not succeed if a
modal dialogue is present.

There is however no reason we cannot generalise the interfaces for
dealing with door-hangers and other types of permissions dialogues, to
make them work cross-browser and cross-platform.

Received on Friday, 11 March 2016 19:23:55 UTC