From 3941e9acc6250e8da299fad0d1ba5b35a899e7a1 Mon Sep 17 00:00:00 2001 From: Kiara Rose Date: Thu, 19 Dec 2024 15:15:16 -0500 Subject: [PATCH] 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: https://github.com/web-platform-tests/wpt/pull/49786 --- index.html | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/index.html b/index.html index 88179a51..cc81b0ea 100644 --- a/index.html +++ b/index.html @@ -1040,6 +1040,18 @@

Endpoints

/session/{session id}/print Print Page + + + POST + /session/{session id}/webextension + Load WebExtension + + + + DELETE + /session/{session id}/webextension/{extension id} + Unload WebExtension + @@ -1218,6 +1230,13 @@

Errors

using the given search parameters. + + no such extension + 404 + no such extension + No extension matching the given extension id was found. + + no such frame 404 @@ -1292,6 +1311,20 @@

Errors

A screen capture was made impossible. + + unable to load extension + 500 + unable to load extension + A command to load an extension could not be satisfied. + + + + unable to unload extension + 500 + unable to unload extension + A command to unload an extension could not be satisfied. + + unexpected alert open 500 @@ -11368,6 +11401,121 @@

Print Page

+
+

WebExtensions

+ +

The WebExtensions API provides an interface that allows extensions to modify +and enhance the capability of the browser. This section describes the interaction +with WebExtensions. + +

+

Load WebExtension

+ + + + + + + + + + +
HTTP MethodURI Template
POST/session/{session id}/webextension
+ +

The remote end steps, given session, URL +variables and parameters are: + +

    +
  1. If session's current browsing context + is no longer open, return error with error + code no such window. + +

  2. If loading web extensions isn't supported, return error with + error code unsupported operation. +

  3. Let type hint be the result of getting the property + "type" from parameters. +

      +
    1. If type hint does not have the value of + "path", "archivePath", or "base64", return error with + error code invalid argument. +

    2. If the implementation does not support loading web + extensions using type hint, return error + with error code unsupported operation. +

    3. Let value be the result of + getting the property"value" from + parameters. If value is + null, return error with + error code invalid argument. +

    4. If type hint has the value "path" and the + implementation supports loading a web extension given a path to + it's resources, the implementation should load the extension + located at the path stored in "value". +

    5. If type hint has the value "archivePath" + and the implementation supports loading a web extension given a + path to a ZIP of it's resources, the implementation should extract + the ZIP and load the extension located at the path stored in + "value". If this extraction fails, return error + with error code unable to load extension. +

    6. If type hint has the value "base64" and the + implementation supports loading a web extension given a Base64 + encoded string of the ZIP representation of the extension's + resources, the implementation should extract the archive from the + encoded string stored in "value". If this extraction + fails, return error with error code + unable to load extension. +

    +
  4. If the extension fails to load, return error with + error code unable to load extension. +

  5. Let result be the identifier of the loaded extension. + +

  6. Return success with result. +

+ +
+ +
+

Unload WebExtension

+ + + + + + + + + + +
HTTP MethodURI Template
DELETE/session/{session id}/webextension/{extension id}
+ +

The remote end steps, given session, URL +variables and parameters are: + +

    +
  1. If session's current browsing context + is no longer open, return error with error + code no such window. + +

  2. If unloading web extensions isn't supported, return error with + error code unsupported operation. + +

  3. Let extension id be URL variables + ["extension id"]. + +

  4. If the browser has no web extension installed with an id equal to + extension id, return error code + no such extension. + +

  5. Perform any implementation defined steps to unload the extension. + If these steps failed, return error with error code + unable to unload extension. + +

  6. Return success with data null. + +

+
+ +
+

Privacy