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

Add enableDragAndDrop capability #504

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 67 additions & 27 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
text: confirm; url: timers-and-user-prompts.html#dom-confirm
text: context mode; url: /canvas.html#offscreencanvas-context-mode
text: default classic script fetch options; url: webappapis.html#default-classic-script-fetch-options
text: drag and drop operations; url: dnd.html#dnd
text: environment settings object's Realm; url: webappapis.html#environment-settings-object's-realm
text: handled; url: webappapis.html#concept-error-handled
text: history handling behavior; url: browsing-the-web.html#history-handling-behavior
Expand Down Expand Up @@ -1036,33 +1037,8 @@ To <dfn>close the WebSocket connections</dfn> given |session|:

## Establishing a Connection ## {#establishing}

WebDriver clients opt in to a bidirectional connection by requesting a
capability with the name "<code>webSocketUrl</code>" and value
true.

This specification defines an
[=additional webdriver capability=] with the [=capability name=] "<code>webSocketUrl</code>".

<div algorithm="webSocketUrl capability deserialization algorithm">
The [=additional capability deserialization algorithm=] for the
"<code>webSocketUrl</code>" capability, with parameter |value| is:

1. If |value| is not a boolean, return [=error=] with [=error code|code=]
[=invalid argument=].

1. Return [=success=] with data |value|.

</div>

<div algorithm="webSocketUrl capability serialization algorithm">
The [=matched capability serialization algorithm=] for the "<code>webSocketUrl</code>" capability,
with parameter |value| is:

1. If |value| is false, return [=success=] with data null.

1. Return [=success=] with data true.

</div>
WebDriver clients opt in to a bidirectional connection by requesting the
[=WebSocket URL=] capability with value true.

<div algorithm="webSocketUrl new session algorithm">
The [=WebDriver new session algorithm=] defined by this specification,
Expand Down Expand Up @@ -1396,6 +1372,7 @@ session.CapabilityRequest = {
? acceptInsecureCerts: bool,
? browserName: text,
? browserVersion: text,
? enableDragAndDrop: bool,
? platformName: text,
? proxy: {
? proxyType: "pac" / "direct" / "autodetect" / "system" / "manual",
Expand All @@ -1407,13 +1384,75 @@ session.CapabilityRequest = {
? socksProxy: text,
? socksVersion: 0..255,
},
? webSocketUrl: bool,
Extensible
};
</pre>

The <code>session.CapabilityRequest</code> type represents a specific set of
requested capabilities.

WebDriver BiDi defines [=additional WebDriver capability|additional WebDriver
capabilities=]. The following tables enumerates the capabilities each
implementation must support for WebDriver BiDi.

<pre class=simpledef>
Capability: <dfn export>WebSocket URL</dfn>
Key: "<code>webSocketUrl</code>"
Value type: boolean
Description: Defines the current session's support for bidirection connection.
</pre>

<pre class=simpledef>
Capability: <dfn export>Drag and Drop Support</dfn>
Key: "<code>enableDragAndDrop</code>"
Value type: boolean
Description: Defines the current session's drag and drop support.
</pre>

<div algorithm="webSocketUrl capability deserialization algorithm">
The [=additional capability deserialization algorithm=] for the
"<code>webSocketUrl</code>" capability, with parameter |value| is:

1. If |value| is not a boolean, return [=error=] with [=error code|code=]
[=invalid argument=].

1. Return [=success=] with data |value|.

</div>

<div algorithm="webSocketUrl capability serialization algorithm">
The [=matched capability serialization algorithm=] for the "<code>webSocketUrl</code>" capability,
with parameter |value| is:

1. If |value| is false, return [=success=] with data null.

1. Return [=success=] with data true.

</div>

<div algorithm="enableDragAndDrop capability deserialization algorithm">
The [=additional capability deserialization algorithm=] for the
"<code>enableDragAndDrop</code>" capability, with parameter |value| is:

1. If |value| is not a boolean, return [=error=] with [=error code|code=]
[=invalid argument=].

1. Return [=success=] with data |value|.

</div>

<div algorithm="enableDragAndDrop capability serialization algorithm">
The [=matched capability serialization algorithm=] for the "<code>enableDragAndDrop</code>" capability,
with parameter |value| is:

1. If |value| is false, the [=endpoint node=] must disable [=drag
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is too broad: we don't want to disable drag and drop for other sessions and/or regular user input. I believe we only want to make sure that the actions dispatched by the WebDriver BiDi client don't get converted into a drag and drop, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly the problem is drag and drop must be completely disabled on the endpoint. This is because while drag and drop is happening, all inputs (other sessions, regular user input, etc) gets ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, it's impossible to separate regular user input and BiDi input for drag and drop. The reason is that drag and drop is predominantly a OS API, meaning when it happens, you must either delegate it to the OS or delegate it to the browser (similar to how Chromium does it). You cannot have both control it at the same time since the OS expects to be able to end the drag itself.

and drop operations=].

1. Return [=success=] with data |value|.

</div>

#### The session.SubscriptionRequest Type #### {#type-session-SubscriptionRequest}

<pre class="cddl remote-cddl">
Expand Down Expand Up @@ -1508,6 +1547,7 @@ This is a [=static command=].
sessionId: text,
capabilities: {
acceptInsecureCerts: bool,
enableDragAndDrop: bool,
browserName: text,
browserVersion: text,
platformName: text,
Expand Down