Skip to content

Commit fe23c3b

Browse files
committed
Reorganise into Extension module
1 parent fc058b3 commit fe23c3b

File tree

1 file changed

+145
-88
lines changed

1 file changed

+145
-88
lines changed

index.bs

Lines changed: 145 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,9 @@ WebDriver BiDi extends the set of [=error codes=] from [[WEBDRIVER|WebDriver]]
603603
with the following additional codes:
604604

605605
<dl>
606+
<dt><dfn for=errors export>invalid extension</dfn>
607+
<dd>Tried to install invalid extension.
608+
606609
<dt><dfn for=errors export>no such client window</dfn>
607610
<dd>Tried to interact with an unknown [=client window=].
608611

@@ -645,6 +648,7 @@ with the following additional codes:
645648

646649
<pre class="cddl local-cddl">
647650
ErrorCode = "invalid argument" /
651+
"invalid extension" /
648652
"invalid selector" /
649653
"invalid session id" /
650654
"move target out of bounds" /
@@ -1597,7 +1601,6 @@ session.CapabilityRequest = {
15971601
? platformName: text,
15981602
? proxy: session.ProxyConfiguration,
15991603
? unhandledPromptBehavior: session.UserPromptHandler,
1600-
? extensions: [*session.Extension],
16011604
Extensible
16021605
};
16031606
</pre>
@@ -1728,31 +1731,6 @@ session.SubscriptionRequest = {
17281731
The <code>session.SubscriptionRequest</code> type represents a request to
17291732
subscribe to or unsubscribe from a specific set of events.
17301733

1731-
#### The session.Extension Type #### {#type-session-Extension}
1732-
1733-
<pre class="cddl remote-cddl local-cddl">
1734-
Extension = text
1735-
</pre>
1736-
1737-
The <code>Extension</code> type is base64 encoded web-extension archive (xpi/crx/zip),
1738-
an absolute path to the web-extension archive or absolute path to the unpacked web-extension.
1739-
1740-
<pre class="cddl remote-cddl local-cddl">
1741-
ExtensionDetails = {
1742-
extension: Extension,
1743-
? installTemporary: bool .default true
1744-
? allowPrivateBrowsing: bool .default false
1745-
}
1746-
</pre>
1747-
1748-
The <code>ExtensionDetails</code> type represents a web-extension with its additional properties.
1749-
1750-
<pre class="cddl remote-cddl local-cddl">
1751-
session.Extension = Extension / ExtensionDetails
1752-
</pre>
1753-
1754-
The <code>session.Extension</code> type represents a web-extension to run in the session.
1755-
17561734
### Commands ### {#module-session-commands}
17571735

17581736
#### The session.status Command #### {#command-session-status}
@@ -2036,68 +2014,6 @@ The [=remote end steps=] with |session| and |command parameters| are:
20362014

20372015
</div>
20382016

2039-
#### The session.installWebExtension Command #### {#command-session-installWebExtension}
2040-
2041-
The <dfn export for=commands>session.installWebExtension</dfn> command installs
2042-
a web-extension for a given session.
2043-
2044-
<dl>
2045-
<dt>Command Type</dt>
2046-
<dd>
2047-
<pre class="cddl remote-cddl">
2048-
session.InstallWebExtension = (
2049-
method: "session.installWebExtension",
2050-
params: session.InstallWebExtensionParameters
2051-
)
2052-
2053-
session.InstallWebExtensionParameters = {
2054-
extension: session.Extension
2055-
}
2056-
</pre>
2057-
</dd>
2058-
<dt>Result Type</dt>
2059-
<dd>
2060-
<pre class="cddl">
2061-
session.InstallWebExtensionResult = (
2062-
script.InstallWebExtensionSuccess /
2063-
script.InstallWebExtensionException
2064-
)
2065-
2066-
session.InstallWebExtensionSuccess = {
2067-
type: "success",
2068-
webExtensionId: text
2069-
}
2070-
2071-
session.InstallWebExtensionException = {
2072-
type: "exception",
2073-
exceptionDetails: text
2074-
}
2075-
</pre>
2076-
</dd>
2077-
</dl>
2078-
2079-
<div algorithm="remote end steps for session.installWebExtension">
2080-
The [=remote end steps=] with |session| and |command parameters| are:
2081-
2082-
1. Let the |extension| be the value of the <code>extension</code> field of
2083-
|command parameters|.
2084-
2085-
1. [=Try=] to install web-extension with |session| and |extension|.
2086-
2087-
1. If exception is throw
2088-
2089-
1. Let |exception details| be the exception message.
2090-
2091-
1. Return a new [=/map=] matching the <code>session.InstallWebExtensionException</code>
2092-
production, with the <code>exceptionDetails</code> field set to
2093-
|exception details|.
2094-
2095-
2096-
1. Return a new map matching the <code>session.InstallWebExtensionSuccess</code> production, with
2097-
the <code>webExtensionId</code> field set to the web-extension id.
2098-
2099-
</div>
2100-
21012017
## The browser Module ## {#module-browser}
21022018

21032019
The <dfn export for=modules>browser</dfn> module contains commands for
@@ -11390,6 +11306,147 @@ The [=remote end steps=] given |session| and |command parameters| are:
1139011306
</div>
1139111307

1139211308

11309+
## The extensions Module ## {#module-extensions}
11310+
11311+
The <dfn export for=modules>extensions</dfn> module contains functionality for
11312+
managing and interacting with extensions.
11313+
11314+
### Definition ### {#module-extensions-definition}
11315+
11316+
[=remote end definition=]
11317+
11318+
<pre class="cddl remote-cddl">
11319+
ExtensionsCommand = (
11320+
extensions.Install
11321+
)
11322+
</pre>
11323+
11324+
[=local end definition=]
11325+
11326+
<pre class="cddl local-cddl">
11327+
ExtensionsResult = (
11328+
extensions.InstallResult
11329+
)
11330+
</pre>
11331+
11332+
### Types ### {#module-extensions-types}
11333+
11334+
#### The extensions.Extension Type #### {#type-extensions-Extension}
11335+
11336+
<pre class="cddl local-cddl">
11337+
extensions.ExtensionArchive = {
11338+
files: [+text],
11339+
}
11340+
</pre>
11341+
11342+
<pre class="cddl remote-cddl local-cddl">
11343+
extensions.Extension = {
11344+
installPath: extensions.ExtensionPath / extensions.ExtensionArchivePath / extensions.ExtensionBase64Encoded,
11345+
? allowPrivateBrowsing: bool .default false,
11346+
}
11347+
11348+
extensions.ExtensionPath = {
11349+
type: "path",
11350+
path: text,
11351+
}
11352+
11353+
extensions.ExtensionArchivePath = {
11354+
type: "archive-path",
11355+
path: text,
11356+
}
11357+
11358+
extensions.ExtensionBase64Encoded = {
11359+
type: "base64",
11360+
value: text,
11361+
}
11362+
</pre>
11363+
11364+
The <code>extensions.Extension</code> type represents an extension with its additional properties.
11365+
11366+
<div algorithm>
11367+
To <dfn>expand a install path spec</dfn> given |install path spec|:
11368+
11369+
1. Let |path| be a value of <code>path</code> field of |install path spec| if the value of <code>type</code> of the |install path spec| is equal to <code>path</code>,
11370+
otherwise perform any implementation-defined steps to create a temporary folder and make its path to be the value of |path|.
11371+
11372+
1. Let |archive path| be a value of <code>path</code> field of |install path spec| if the value of <code>type</code> of the |install path spec| is equal to <code>archive-path</code>,
11373+
otherwise if the value of <code>type</code> of the |install path spec| is equal to <code>archive-path</code> perform any implementation-defined steps to create a temporary file
11374+
being a result of Base64 decodeing of the value of <code>value</code> filed of |install path spec| and make its path to be the value of |archive path|,
11375+
otherwise |archive path| is null.
11376+
11377+
1. If |archive path| if not null:
11378+
11379+
1. Perform any implementation-defined steps to unpack archive into |path|.
11380+
11381+
1. Let |extension files| be a result of implementation-defined steps to list all paths in |path| folder.
11382+
11383+
1. Let |extension archive| be a map matching the <code>extensions.ExtensionArchive</code> production, with the <code>files</code> field set to |extension files|.
11384+
11385+
1. Return [=success=] with data |extension archive|.
11386+
11387+
</div>
11388+
11389+
### Commands ### {#module-extensions-commands}
11390+
11391+
#### The extensions.install Command #### {#command-extensions-install}
11392+
11393+
The <dfn export for=commands>extensions.install</dfn> command installs an extension for the session.
11394+
11395+
<dl>
11396+
<dt>Command Type</dt>
11397+
<dd>
11398+
<pre class="cddl remote-cddl">
11399+
extensions.Install = (
11400+
method: "extensions.install",
11401+
params: extensions.InstallParameters
11402+
)
11403+
11404+
extensions.InstallParameters = {
11405+
extension: extensions.Extension,
11406+
}
11407+
</pre>
11408+
</dd>
11409+
<dt>Result Type</dt>
11410+
<dd>
11411+
<pre class="cddl local-cddl">
11412+
extensions.InstallResult = (
11413+
extensionId: text
11414+
)
11415+
</pre>
11416+
</dd>
11417+
</dl>
11418+
11419+
<div algorithm="remote end steps for extensions.install">
11420+
The [=remote end steps=] with |session| and |command parameters| are:
11421+
11422+
1. Let the |extension| be the value of the <code>extension</code> field of |command parameters|
11423+
11424+
1. If installing |extension| isn't supported return [=error=] with error code [=unsupported operation=].
11425+
11426+
1. Let |install path spec| be a value of <code>installPath</code> field of the |extension|.
11427+
11428+
1. Let |extension archive| be the result of [=trying=] to [=expand a install path spec=] with |install path spec|.
11429+
11430+
1. Let |extension files| be a value of <code>files<code> field of |extension archive|.
11431+
11432+
1. If |extension files| does not include entry <code>manifest.json</code> return [=error=] with code [=invalid extension=]
11433+
11434+
1. Perform any implementation-defined steps to install the extension into |session|.
11435+
11436+
1. Let |extension id| be a unique identifier of the |extension| for the browser decided by the implementation-defined steps.
11437+
11438+
1. Let |allow private browsing| be a value of <code>allowPrivateBrowsing</code> field of |command parameters| if present, or false otherwise.
11439+
11440+
1. Perform any implementation-defined steps to enable extension to be run in private browsing based on the valu of |allow private browsing|.
11441+
11442+
1. Let |result| be a [=/map=] matching the
11443+
<code>extensions.InstallResult</code> production with the
11444+
<code>extensionId</code> field set to |extension id|.
11445+
11446+
1. Return [=success=] with data |result|.
11447+
11448+
</div>
11449+
1139311450
# Patches to Other Specifications # {#patches}
1139411451

1139511452
This specification requires some changes to external specifications to provide the necessary

0 commit comments

Comments
 (0)