diff --git a/index.bs b/index.bs index b7e6f3cf..12e902c7 100644 --- a/index.bs +++ b/index.bs @@ -603,6 +603,9 @@ WebDriver BiDi extends the set of [=error codes=] from [[WEBDRIVER|WebDriver]] with the following additional codes:
ErrorCode = "invalid argument" / + "invalid extension" / "invalid selector" / "invalid session id" / "move target out of bounds" / @@ -1597,7 +1601,6 @@ session.CapabilityRequest = { ? platformName: text, ? proxy: session.ProxyConfiguration, ? unhandledPromptBehavior: session.UserPromptHandler, - ? extensions: [*session.Extension], Extensible };@@ -1728,31 +1731,6 @@ session.SubscriptionRequest = { The
session.SubscriptionRequest
type represents a request to
subscribe to or unsubscribe from a specific set of events.
-#### The session.Extension Type #### {#type-session-Extension}
-
--Extension = text -- -The
Extension
type is base64 encoded web-extension archive (xpi/crx/zip),
-an absolute path to the web-extension archive or absolute path to the unpacked web-extension.
-
--ExtensionDetails = { - extension: Extension, - ? installTemporary: bool .default true - ? allowPrivateBrowsing: bool .default false -} -- -The
ExtensionDetails
type represents a web-extension with its additional properties.
-
--session.Extension = Extension / ExtensionDetails -- -The
session.Extension
type represents a web-extension to run in the session.
-
### Commands ### {#module-session-commands}
#### The session.status Command #### {#command-session-status}
@@ -2036,68 +2014,6 @@ The [=remote end steps=] with |session| and |command parameters| are:
-#### The session.installWebExtension Command #### {#command-session-installWebExtension}
-
-The session.installWebExtension command installs
-a web-extension for a given session.
-
-- session.InstallWebExtension = ( - method: "session.installWebExtension", - params: session.InstallWebExtensionParameters - ) - - session.InstallWebExtensionParameters = { - extension: session.Extension - } --
- session.InstallWebExtensionResult = ( - script.InstallWebExtensionSuccess / - script.InstallWebExtensionException - ) - - session.InstallWebExtensionSuccess = { - type: "success", - webExtensionId: text - } - - session.InstallWebExtensionException = { - type: "exception", - exceptionDetails: text - } --
extension
field of
- |command parameters|.
-
-1. [=Try=] to install web-extension with |session| and |extension|.
-
-1. If exception is throw
-
- 1. Let |exception details| be the exception message.
-
- 1. Return a new [=/map=] matching the session.InstallWebExtensionException
- production, with the exceptionDetails
field set to
- |exception details|.
-
-
-1. Return a new map matching the session.InstallWebExtensionSuccess
production, with
- the webExtensionId
field set to the web-extension id.
-
-+ExtensionsCommand = ( + extensions.Install +) ++ +[=local end definition=] + +
+ExtensionsResult = ( + extensions.InstallResult +) ++ +### Types ### {#module-extensions-types} + +#### The extensions.Extension Type #### {#type-extensions-Extension} + +
+extensions.ExtensionArchive = { + files: [+text], +} ++ +
+extensions.Extension = { + installPath: extensions.ExtensionPath / extensions.ExtensionArchivePath / extensions.ExtensionBase64Encoded, + ? allowPrivateBrowsing: bool .default false, +} + +extensions.ExtensionPath = { + type: "path", + path: text, +} + +extensions.ExtensionArchivePath = { + type: "archive-path", + path: text, +} + +extensions.ExtensionBase64Encoded = { + type: "base64", + value: text, +} ++ +The
extensions.Extension
type represents an extension with its additional properties.
+
+path
field of |install path spec| if the value of type
of the |install path spec| is equal to path
,
+ otherwise perform any implementation-defined steps to create a temporary folder and make its path to be the value of |path|.
+
+1. Let |archive path| be a value of path
field of |install path spec| if the value of type
of the |install path spec| is equal to archive-path
,
+ otherwise if the value of type
of the |install path spec| is equal to archive-path
perform any implementation-defined steps to create a temporary file
+ being a result of Base64 decodeing of the value of value
filed of |install path spec| and make its path to be the value of |archive path|,
+ otherwise |archive path| is null.
+
+1. If |archive path| if not null:
+
+ 1. Perform any implementation-defined steps to unpack archive into |path|.
+
+1. Let |extension files| be a result of implementation-defined steps to list all paths in |path| folder.
+
+1. Let |extension archive| be a map matching the extensions.ExtensionArchive
production, with the files
field set to |extension files|.
+
+1. Return [=success=] with data |extension archive|.
+
++ extensions.Install = ( + method: "extensions.install", + params: extensions.InstallParameters + ) + + extensions.InstallParameters = { + extension: extensions.Extension, + } ++
+ extensions.InstallResult = ( + extensionId: text + ) ++
extension
field of |command parameters|
+
+1. If installing |extension| isn't supported return [=error=] with error code [=unsupported operation=].
+
+1. Let |install path spec| be a value of installPath
field of the |extension|.
+
+1. Let |extension archive| be the result of [=trying=] to [=expand a install path spec=] with |install path spec|.
+
+1. Let |extension files| be a value of files field of |extension archive|.
+
+1. If |extension files| does not include entry manifest.json
return [=error=] with code [=invalid extension=]
+
+1. Perform any implementation-defined steps to install the extension into |session|.
+
+1. Let |extension id| be a unique identifier of the |extension| for the browser decided by the implementation-defined steps.
+
+1. Let |allow private browsing| be a value of allowPrivateBrowsing
field of |command parameters| if present, or false otherwise.
+
+1. Perform any implementation-defined steps to enable extension to be run in private browsing based on the valu of |allow private browsing|.
+
+1. Let |result| be a [=/map=] matching the
+ extensions.InstallResult
production with the
+ extensionId
field set to |extension id|.
+
+1. Return [=success=] with data |result|.
+
+