From a392308f29ba9190e4383688264251b96356ee34 Mon Sep 17 00:00:00 2001
From: Mike Pennisi
Date: Fri, 16 Jun 2017 19:55:03 -0400
Subject: [PATCH] Introduce "Automation" section
---
index.bs | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 130 insertions(+), 1 deletion(-)
diff --git a/index.bs b/index.bs
index 91c848b..ce20418 100644
--- a/index.bs
+++ b/index.bs
@@ -44,7 +44,19 @@ spec: sensors; urlPrefix: https://w3c.github.io/sensors/#
spec: manifest; urlPrefix: https://w3c.github.io/manifest/#
type: dfn
text: install; url: dfn-install
-
+spec: webdriver; urlPrefix: https://w3c.github.io/webdriver/webdriver-spec.html#
+ type: dfn
+ text: current browsing context; url: dfn-current-browsing-context
+ text: WebDriver error; url: dfn-error
+ text: WebDriver error code; url: dfn-error-code
+ text: extension command; url: dfn-extension-commands
+ text: extension command name; url: dfn-extension-command-name
+ text: extension command prefix; url: dfn-extension-command-prefix
+ text: invalid argument; url: dfn-invalid-argument
+ text: local end; url: dfn-local-end
+ text: remote end steps; url: dfn-remote-end-steps
+ text: session; url: dfn-session
+ text: success; url: dfn-success
spec: dom
@@ -60,6 +72,10 @@ spec: html
spec: storage
type: enum-value
for: PermissionName; text: "persistent-storage"
+spec: infra
+ type: dfn
+ text: list
+ for: list; text: append
spec: ui-events
type: dfn
text: user agent
@@ -974,6 +990,119 @@ spec: webidl
+
+
+ Automation
+
+
+ For the purposes of user-agent automation and application testing, this
+ document defines the following extension command for the
+ [[WebDriver]] specification.
+
+
+
+ dictionary PermissionSetParameters {
+ required PermissionDescriptor descriptor;
+ required PermissionState state;
+ boolean oneRealm = false;
+ };
+
+
+
+
+ Set Permission
+
+
+
+
+ HTTP Method |
+ Prefix |
+ Name |
+
+
+ POST |
+ /session/{session id}/permissions |
+ set |
+
+
+
+ The Set Permission extension command simulates user
+ modification of a {{PermissionDescriptor}}'s permission state.
+ The remote end steps are:
+
+ - Let |parameters| be the |parameters| argument, converted to an IDL
+ value of type {{PermissionSetParameters}}. If this throws an
+ exception, return a WebDriver error with WebDriver error
+ code invalid argument.
+
- Let |rootDesc| be
+ |parameters|.{{PermissionSetParameters/descriptor}}.
+ - Let |typedDescriptor| be the object |rootDesc| refers to,
+ converted to an IDL value of
+
|rootDesc|.{{PermissionDescriptor/name}}
's permission
+ descriptor type. If this throws an exception, return a WebDriver
+ error with WebDriver error code invalid
+ argument.
+ - If |parameters|.{{PermissionSetParameters/state}} is an inappropriate
+ permission state for any implementation-defined reason, return a
+ WebDriver error with WebDriver error code invalid
+ argument.
+
+ For example, user agents that define the {{"midi"}}
+ feature as "always on" may choose to reject command
+ to set the permission state to {{"denied"}} at this step.
+
+
+ - Let |settings| be the environment settings object of the
+ current browsing context's active document.
+ - If |settings| is a non-secure context and
+
|rootDesc|.{{PermissionDescriptor/name}}
isn't allowed
+ in non-secure contexts, return a WebDriver error with
+ WebDriver error code invalid argument.
+ - If |parameters|.{{PermissionSetParameters/oneRealm}} is true, let
+ |targets| be a list whose sole member is |settings|.
+ - Otherwise, let |targets| be a list containing all
+ environment settings objects whose [=environment settings
+ object/origin=] is the same as the
+ [=environment settings object/origin=] of |settings|.
+
+ - Let |tasks| be an empty list.
+
-
+ For each environment settings object |target| in |targets|:
+
+ - Queue a task |task| on the permission task source
+ of |target|'s [=environment settings object/responsible browsing
+ context=] to perform the following step:
+
+ - Interpret |parameters|.{{PermissionSetParameters/state}} as if
+ it were the result of an invocation of permission state
+ for |typedDescriptor| with the argument |target| made at this
+ moment.
+
+
+ - Append |task| to |tasks|.
+
+
+ Wait for all tasks in |tasks| to have executed.
+ Return success with data `null`.
+
+
+ To set permission for
{name: {{"midi"}}, sysex: true}
of the
+
current browsing context of the
session with ID 23 to
+ "`granted`", the
local end would POST to
+ `/session/23/permissions/set` with the body:
+
+
+ {
+ "descriptor": {
+ "name": "midi",
+ "sysex": true
+ },
+ "state": "granted"
+ }
+
+
+
+