Skip to content

Commit 3941e9a

Browse files
committed
Add support for loading and unloading web extension in webdriver classic.
This is a pre-requisite to adding support for cross browser testing for web extensions. PR to test these new commands in WPT: web-platform-tests/wpt#49786
1 parent 9cb696c commit 3941e9a

File tree

1 file changed

+148
-0
lines changed

1 file changed

+148
-0
lines changed

index.html

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,18 @@ <h3>Endpoints</h3>
10401040
<td>/session/{<var>session id</var>}/print</td>
10411041
<td><a>Print Page</a></td>
10421042
</tr>
1043+
1044+
<tr>
1045+
<td>POST</td>
1046+
<td>/session/{<var>session id</var>}/webextension</td>
1047+
<td><a>Load WebExtension</a></td>
1048+
</tr>
1049+
1050+
<tr>
1051+
<td>DELETE</td>
1052+
<td>/session/{<var>session id</var>}/webextension/{extension id}</td>
1053+
<td><a>Unload WebExtension</a></td>
1054+
</tr>
10431055
</table>
10441056
</section> <!-- /Endpoints -->
10451057

@@ -1218,6 +1230,13 @@ <h3>Errors</h3>
12181230
using the given search parameters.
12191231
</tr>
12201232

1233+
<tr>
1234+
<td><dfn>no such extension</dfn>
1235+
<td>404
1236+
<td><code>no such extension</code>
1237+
<td>No extension matching the given extension id was found.
1238+
</tr>
1239+
12211240
<tr>
12221241
<td><dfn>no such frame</dfn>
12231242
<td>404
@@ -1292,6 +1311,20 @@ <h3>Errors</h3>
12921311
<td>A screen capture was made impossible.
12931312
</tr>
12941313

1314+
<tr>
1315+
<td><dfn>unable to load extension</dfn>
1316+
<td>500
1317+
<td><code>unable to load extension</code>
1318+
<td>A <a>command</a> to load an extension could not be satisfied.
1319+
</tr>
1320+
1321+
<tr>
1322+
<td><dfn>unable to unload extension</dfn>
1323+
<td>500
1324+
<td><code>unable to unload extension</code>
1325+
<td>A <a>command</a> to unload an extension could not be satisfied.
1326+
</tr>
1327+
12951328
<tr>
12961329
<td><dfn>unexpected alert open</dfn>
12971330
<td>500
@@ -11368,6 +11401,121 @@ <h3><dfn>Print Page</dfn></h3>
1136811401
</section> <!-- /Print Page -->
1136911402
</section> <!-- /Print -->
1137011403

11404+
<section>
11405+
<h2>WebExtensions</h2>
11406+
11407+
<p>The WebExtensions API provides an interface that allows extensions to modify
11408+
and enhance the capability of the browser. This section describes the interaction
11409+
with WebExtensions.
11410+
11411+
<section>
11412+
<h3><dfn>Load WebExtension</dfn></h3>
11413+
11414+
<table class="simple jsoncommand">
11415+
<tr>
11416+
<th>HTTP Method</th>
11417+
<th>URI Template</th>
11418+
</tr>
11419+
<tr>
11420+
<td>POST</td>
11421+
<td>/session/{<var>session id</var>}/webextension</td>
11422+
</tr>
11423+
</table>
11424+
11425+
<p>The <a>remote end steps</a>, given <var>session</var>, <var>URL
11426+
variables</var> and <var>parameters</var> are:
11427+
11428+
<ol>
11429+
<li><p>If <var>session</var>&apos;s <a>current browsing context</a>
11430+
is <a>no longer open</a>, return <a>error</a> with <a>error
11431+
code</a> <a>no such window</a>.
11432+
11433+
<li><p>If loading web extensions isn't supported, return <a>error</a> with
11434+
<a>error code</a> <a>unsupported operation</a>.
11435+
<li><p>Let <var>type hint</var> be the result of <a>getting the property</a>
11436+
"<code>type</code>" from <var>parameters</var>.
11437+
<ol style="list-style-type:lower-alpha">
11438+
<li><p> If <var>type hint</var> does not have the value of
11439+
"path", "archivePath", or "base64", return <a>error</a> with
11440+
<a>error code</a> <a>invalid argument</a>.
11441+
<li><p>If the implementation does not support loading web
11442+
extensions using <var>type hint</var>, return <a>error</a>
11443+
with <a>error code</a> <a>unsupported operation</a>.
11444+
<li><p>Let <var>value</var> be the result of
11445+
<a>getting the property</a>"<code>value</code>" from
11446+
<var>parameters</var>. If <var>value</var> is
11447+
<a><code>null</code></a>, return <a>error</a> with
11448+
<a>error code</a> <a>invalid argument</a>.
11449+
<li><p>If <var>type hint</var> has the value "path" and the
11450+
implementation supports loading a web extension given a path to
11451+
it's resources, the implementation should load the extension
11452+
located at the path stored in "<code>value</code>".
11453+
<li><p>If <var>type hint</var> has the value "archivePath"
11454+
and the implementation supports loading a web extension given a
11455+
path to a ZIP of it's resources, the implementation should extract
11456+
the ZIP and load the extension located at the path stored in
11457+
"<code>value</code>". If this extraction fails, return <a>error</a>
11458+
with <a>error code</a> <a>unable to load extension</a>.
11459+
<li><p>If <var>type hint</var> has the value "base64" and the
11460+
implementation supports loading a web extension given a Base64
11461+
encoded string of the ZIP representation of the extension's
11462+
resources, the implementation should extract the archive from the
11463+
encoded string stored in "<code>value</code>". If this extraction
11464+
fails, return <a>error</a> with <a>error code</a>
11465+
<a>unable to load extension</a>.
11466+
</ol>
11467+
<li><p>If the extension fails to load, return <a>error</a> with
11468+
<a>error code</a> <a>unable to load extension</a>.
11469+
<li><p>Let <var>result</var> be the identifier of the loaded extension.
11470+
11471+
<li><p>Return <a>success</a> with <var>result</var>.
11472+
</ol>
11473+
11474+
</section> <!-- /Load WebExtension -->
11475+
11476+
<section>
11477+
<h3><dfn>Unload WebExtension</dfn></h3>
11478+
11479+
<table class="simple jsoncommand">
11480+
<tr>
11481+
<th>HTTP Method</th>
11482+
<th>URI Template</th>
11483+
</tr>
11484+
<tr>
11485+
<td>DELETE</td>
11486+
<td>/session/{<var>session id</var>}/webextension/{extension id}</td>
11487+
</tr>
11488+
</table>
11489+
11490+
<p>The <a>remote end steps</a>, given <var>session</var>, <var>URL
11491+
variables</var> and <var>parameters</var> are:
11492+
11493+
<ol>
11494+
<li><p>If <var>session</var>&apos;s <a>current browsing context</a>
11495+
is <a>no longer open</a>, return <a>error</a> with <a>error
11496+
code</a> <a>no such window</a>.
11497+
11498+
<li><p>If unloading web extensions isn't supported, return <a>error</a> with
11499+
<a>error code</a> <a>unsupported operation</a>.
11500+
11501+
<li><p>Let <var>extension id</var> be <var>URL variables</var>
11502+
["<code>extension id</code>"].
11503+
11504+
<li><p>If the browser has no web extension installed with an id equal to
11505+
<var>extension id</var>, return <a>error code</a>
11506+
<a>no such extension</a>.
11507+
11508+
<li><p>Perform any implementation defined steps to unload the extension.
11509+
If these steps failed, return <a>error</a> with <a>error code</a>
11510+
<a>unable to unload extension</a>.
11511+
11512+
<li><p>Return <a>success</a> with data <a><code>null</code></a>.
11513+
11514+
</ol>
11515+
</section> <!-- /Unload WebExtension -->
11516+
11517+
</section> <!-- WebExtensions -->
11518+
1137111519

1137211520
<section class=appendix>
1137311521
<h2>Privacy</h2>

0 commit comments

Comments
 (0)