Skip to content

Commit f3bc5e3

Browse files
committed
Specification for loading extensions in WebDriver Classic
1 parent 4f7fad3 commit f3bc5e3

File tree

1 file changed

+177
-0
lines changed

1 file changed

+177
-0
lines changed

specification/webdriver-classic.bs

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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>
14+
<h3> Endpoints</h3>
15+
16+
<table class=simple>
17+
<tr>
18+
<td>POST</td>
19+
<td>/session/{<var>session id</var>}/webextension</td>
20+
<td>Load WebExtension</td>
21+
</tr>
22+
23+
<tr>
24+
<td>DELETE</td>
25+
<td>/session/{<var>session id</var>}/webextension/{<var>extension id/var>}</td>
26+
<td>Unload WebExtension</td>
27+
</tr>
28+
</table>
29+
</section>
30+
31+
<section>
32+
<h3>Errors</h3>
33+
<table class=simple>
34+
<tr>
35+
<th>Error Code
36+
<th>HTTP Status
37+
<th>JSON Error Code
38+
<th>Description
39+
</tr>
40+
41+
<tr>
42+
<td>no such web extension
43+
<td>404
44+
<td><code>no such web extension</code>
45+
<td>No web extension matching the given extension id was found
46+
amongst the <var>session</var>&apos;s loaded extensions.
47+
</tr>
48+
49+
<tr>
50+
<td>unable to load extension
51+
<td>500
52+
<td><code>unable to load extension</code>
53+
<td>A command to load an extension could not be satisfied.
54+
</tr>
55+
56+
<tr>
57+
<td>unable to unload extension
58+
<td>500
59+
<td><code>unable to unload extension</code>
60+
<td>A command to unload an extension could not be satisfied.
61+
</tr>
62+
</table>
63+
</section>
64+
65+
<section>
66+
<h3>Commands</h3>
67+
<section>
68+
<h2>WebExtensions</h2>
69+
<p>The WebExtensions API provides an interface that allows
70+
extensions to modify and enhance the capability of the browser.
71+
This section describes the interaction with WebExtensions.
72+
73+
<section>
74+
<h3>Load WebExtension</h3>
75+
<table class="simple jsoncommand">
76+
<tr>
77+
<th>HTTP Method</th>
78+
<th>URI Template</th>
79+
</tr>
80+
<tr>
81+
<td>POST</td>
82+
<td>/session/{<var>session id</var>}/webextension</td>
83+
</tr>
84+
</table>
85+
86+
<p>The remote end steps, given <var>session</var>, <var>URL
87+
variables</var> and <var>parameters</var> are:
88+
89+
<ol>
90+
<li><p>If <var>session</var>&apos;s current browsing context
91+
is no longer open, return error with error
92+
code no such window.
93+
94+
<li><p>If loading web extensions isn't supported, return error
95+
with error code unsupported operation.
96+
<li><p>Let <var>type hint</var> be the result of getting the
97+
property "<code>type</code>" from <var>parameters</var>.
98+
<ol>
99+
<li type='a'><p> If <var>type hint</var> does not have the value of
100+
"path", "archivePath", or "base64", return error with
101+
error code invalid argument.
102+
<li type='a'><p>If the implementation does not support loading web
103+
extensions using <var>type hint</var>, return error
104+
with error code unsupported operation.
105+
<li type='a'><p>Let <var>value</var> be the result of
106+
getting the property"<code>value</code>" from
107+
<var>parameters</var>. If <var>value</var> is
108+
<code>null</code>, return error with
109+
error code invalid argument.
110+
<li type='a'><p>If <var>type hint</var> has the value "path" and the
111+
implementation supports loading a web extension given a
112+
path to it's resources, the implementation should load the
113+
extension located at the path stored in "<code>value</code>".
114+
<li type='a'><p>If <var>type hint</var> has the value "archivePath"
115+
and the implementation supports loading a web extension
116+
given a path to a ZIP of it's resources, the implementation
117+
should extract the ZIP and load the extension located at
118+
the path stored in "<code>value</code>". If this extraction
119+
fails, return error with error code
120+
unable to load extension.
121+
<li type='a'><p>If <var>type hint</var> has the value "base64" and the
122+
implementation supports loading a web extension given a
123+
Base64 encoded string of the ZIP representation of the
124+
extension's resources, the implementation should extract
125+
the archive from the encoded string stored in
126+
"<code>value</code>". If this extraction fails, return
127+
error with error code
128+
unable to load extension.
129+
</ol>
130+
<li><p>If the extension fails to load, return error with
131+
error code unable to load extension.
132+
<li><p>Let <var>result</var> be the identifier of the loaded extension.
133+
134+
<li><p>Return success with <var>result</var>.
135+
</ol>
136+
137+
</section> <!-- /Load WebExtension -->
138+
139+
<section>
140+
<h3>Unload WebExtension</h3>
141+
<table class="simple jsoncommand">
142+
<tr>
143+
<th>HTTP Method</th>
144+
<th>URI Template</th>
145+
</tr>
146+
<tr>
147+
<td>DELETE</td>
148+
<td>/session/{<var>session id</var>}/webextension/{<var>extension id/var>}</td>
149+
</tr>
150+
</table>
151+
152+
<p>The remote end steps, given <var>session</var>, <var>URL
153+
variables</var> and <var>parameters</var> are:
154+
155+
<ol>
156+
<li><p>If <var>session</var>&apos;s current browsing context
157+
is no longer open, return error with error code no such window.
158+
159+
<li><p>If unloading web extensions isn't supported, return error
160+
with error code unsupported operation.
161+
162+
<li><p>Let <var>extension id</var> be <var>URL variables</var>
163+
["<code>extension id</code>"].
164+
165+
<li><p>If the browser has no web extension loaded with an id equal to
166+
<var>extension id</var>, return error code
167+
no such web extension.
168+
169+
<li><p>Perform any implementation defined steps to unload the extension.
170+
If these steps failed, return error with error code
171+
unable to unload extension.
172+
173+
<li><p>Return success with data <code>null</code>.
174+
</ol>
175+
</section> <!-- /Unload WebExtension -->
176+
</section> <!-- /WebExtensions -->
177+
</section> <!-- /Commands -->

0 commit comments

Comments
 (0)