Skip to content

Commit f2a8b62

Browse files
authored
Merge pull request #760 from kiaraarose/main
Specification for loading extensions in WebDriver Classic
2 parents 4f7fad3 + b4c4f7f commit f2a8b62

File tree

1 file changed

+210
-0
lines changed

1 file changed

+210
-0
lines changed

specification/webdriver-classic.bs

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<pre class="metadata">
2+
Title: webdriver-classic
3+
Shortname: wecg-webdriver-classic
4+
Level: 1
5+
Group: wecg
6+
Status: w3c/CG-DRAFT
7+
URL: https://w3c.github.io/webextensions/specification/webdriver-classic.html
8+
Editor: Kiara Rose, Apple, [email protected]
9+
Abstract: This specification defines how web extensions should be loaded and unloaded in WebDriver Classic.
10+
Repository: w3c/webextensions
11+
</pre>
12+
13+
<section class="non-normative">
14+
## Introduction
15+
<em>This section is non-normative.</em>
16+
17+
This specification is non-normative.The intention of this spec is to
18+
document how extensions should be loaded/unloaded in WebDriver Classic,
19+
for browser vendors who choose to implement it.
20+
</section>
21+
<section>
22+
<h3> Endpoints</h3>
23+
24+
<table class=simple>
25+
<tr>
26+
<td>POST</td>
27+
<td>/session/{<var>session id</var>}/webextension</td>
28+
<td>Load WebExtension</td>
29+
</tr>
30+
31+
<tr>
32+
<td>DELETE</td>
33+
<td>/session/{<var>session id</var>}/webextension/{<var>extension id</var>}</td>
34+
<td>Unload WebExtension</td>
35+
</tr>
36+
</table>
37+
</section>
38+
39+
<section>
40+
<h3>Errors</h3>
41+
<table class=simple>
42+
<tr>
43+
<th>Error Code
44+
<th>HTTP Status
45+
<th>JSON Error Code
46+
<th>Description
47+
</tr>
48+
49+
<tr>
50+
<td>no such web extension
51+
<td>404
52+
<td><code>no such web extension</code>
53+
<td>No web extension matching the given extension id was found
54+
amongst the <var>session</var>&apos;s loaded extensions.
55+
</tr>
56+
57+
<tr>
58+
<td>unable to load extension
59+
<td>500
60+
<td><code>unable to load extension</code>
61+
<td>A command to load an extension could not be satisfied.
62+
</tr>
63+
64+
<tr>
65+
<td>unable to unload extension
66+
<td>500
67+
<td><code>unable to unload extension</code>
68+
<td>A command to unload an extension could not be satisfied.
69+
</tr>
70+
</table>
71+
</section>
72+
73+
<section>
74+
<h3>Commands</h3>
75+
<section>
76+
<h2>WebExtensions</h2>
77+
<p>The WebExtensions API provides an interface that allows
78+
extensions to modify and enhance the capability of the browser.
79+
This section describes the interaction with WebExtensions.
80+
81+
<section>
82+
<h3>Load WebExtension</h3>
83+
<table class="simple jsoncommand">
84+
<tr>
85+
<th>HTTP Method</th>
86+
<th>URI Template</th>
87+
</tr>
88+
<tr>
89+
<td>POST</td>
90+
<td>/session/{<var>session id</var>}/webextension</td>
91+
</tr>
92+
</table>
93+
94+
<p>Based on the
95+
<a href="https://www.w3.org/TR/webdriver-bidi/#command-webExtension-install">
96+
BiDi implementation</a>, the remote end steps, given <var>session</var>,
97+
<var>URL variables</var> and <var>parameters</var> are:
98+
99+
<ol>
100+
<li><p>If <var>session</var>&apos;s current browsing context
101+
is no longer open, return
102+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a> with
103+
<a href="https://w3c.github.io/webdriver/#dfn-error">error code</a>
104+
no such window.
105+
106+
<li><p>If loading web extensions isn't supported, return
107+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
108+
with <a href="https://w3c.github.io/webdriver/#dfn-error">error code</a>
109+
unsupported operation.
110+
<li><p>Let <var>type hint</var> be the result of getting the
111+
property "<code>type</code>" from <var>parameters</var>.
112+
<ol>
113+
<li type='a'><p> If <var>type hint</var> does not have the value of
114+
"path", "archivePath", or "base64", return
115+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
116+
with <a href="https://w3c.github.io/webdriver/#dfn-error">
117+
error code</a> invalid argument.
118+
<li type='a'><p>If the implementation does not support loading web
119+
extensions using <var>type hint</var>, return
120+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
121+
with <a href="https://w3c.github.io/webdriver/#dfn-error">
122+
error code</a> unsupported operation.
123+
<li type='a'><p>Let <var>value</var> be the result of
124+
getting the property"<code>value</code>" from
125+
<var>parameters</var>. If <var>value</var> is
126+
<code>null</code>, return
127+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
128+
with <a href="https://w3c.github.io/webdriver/#dfn-error">
129+
error code</a> invalid argument.
130+
<li type='a'><p>If <var>type hint</var> has the value "path" and the
131+
implementation supports loading a web extension given a
132+
path to it's resources, the implementation should load the
133+
extension located at the path stored in "<code>value</code>".
134+
<li type='a'><p>If <var>type hint</var> has the value "archivePath"
135+
and the implementation supports loading a web extension
136+
given a path to a ZIP of it's resources, the implementation
137+
should extract the ZIP and load the extension located at
138+
the path stored in "<code>value</code>". If this extraction
139+
fails, return <a href="https://w3c.github.io/webdriver/#dfn-error">
140+
error</a> with <a href="https://w3c.github.io/webdriver/#dfn-error">
141+
error code</a> unable to load extension.
142+
<li type='a'><p>If <var>type hint</var> has the value "base64" and the
143+
implementation supports loading a web extension given a
144+
Base64 encoded string of the ZIP representation of the
145+
extension's resources, the implementation should extract
146+
the archive from the encoded string stored in
147+
"<code>value</code>". If this extraction fails, return
148+
error with <a href="https://w3c.github.io/webdriver/#dfn-error">
149+
error code</a> unable to load extension.
150+
</ol>
151+
<li><p>If the extension fails to load, return
152+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a> with
153+
<a href="https://w3c.github.io/webdriver/#dfn-error">error code</a>
154+
unable to load extension.
155+
<li><p>Let <var>result</var> be the identifier of the loaded extension.
156+
157+
<li><p>Return success with <var>result</var>.
158+
</ol>
159+
160+
</section> <!-- /Load WebExtension -->
161+
162+
<section>
163+
<h3>Unload WebExtension</h3>
164+
<table class="simple jsoncommand">
165+
<tr>
166+
<th>HTTP Method</th>
167+
<th>URI Template</th>
168+
</tr>
169+
<tr>
170+
<td>DELETE</td>
171+
<td>/session/{<var>session id</var>}/webextension/{<var>extension id</var>}</td>
172+
</tr>
173+
</table>
174+
175+
<p>Based on the
176+
<a href="https://www.w3.org/TR/webdriver-bidi/#command-webExtension-uninstall">
177+
BiDi implementation</a>, the remote end steps, given <var>session</var>,
178+
<var>URL variables</var> and <var>parameters</var> are:
179+
180+
<ol>
181+
<li><p>If <var>session</var>&apos;s current browsing context is no
182+
longer open, return
183+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a> with
184+
<a href="https://w3c.github.io/webdriver/#dfn-error">error code</a>
185+
no such window.
186+
187+
<li><p>If unloading web extensions isn't supported, return
188+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
189+
with <a href="https://w3c.github.io/webdriver/#dfn-error">
190+
error code</a> unsupported operation.
191+
192+
<li><p>Let <var>extension id</var> be <var>URL variables</var>
193+
["<code>extension id</code>"].
194+
195+
<li><p>If the browser has no web extension loaded with an id equal to
196+
<var>extension id</var>, return
197+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a> code
198+
no such web extension.
199+
200+
<li><p>Perform any implementation defined steps to unload the extension.
201+
If these steps failed, return
202+
<a href="https://w3c.github.io/webdriver/#dfn-error">error</a>
203+
with <a href="https://w3c.github.io/webdriver/#dfn-error">error code</a>
204+
unable to unload extension.
205+
206+
<li><p>Return success with data <code>null</code>.
207+
</ol>
208+
</section> <!-- /Unload WebExtension -->
209+
</section> <!-- /WebExtensions -->
210+
</section> <!-- /Commands -->

0 commit comments

Comments
 (0)