From b4c4f7fa87a2c6bbfc1a50160a99c2a474def2a3 Mon Sep 17 00:00:00 2001 From: Kiara Rose Date: Mon, 3 Feb 2025 14:21:59 -0800 Subject: [PATCH] Specification for loading extensions in WebDriver Classic --- specification/webdriver-classic.bs | 210 +++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 specification/webdriver-classic.bs diff --git a/specification/webdriver-classic.bs b/specification/webdriver-classic.bs new file mode 100644 index 00000000..d75f98bd --- /dev/null +++ b/specification/webdriver-classic.bs @@ -0,0 +1,210 @@ +
+Title: webdriver-classic
+Shortname: wecg-webdriver-classic
+Level: 1
+Group: wecg
+Status: w3c/CG-DRAFT
+URL: https://w3c.github.io/webextensions/specification/webdriver-classic.html
+Editor: Kiara Rose, Apple, kiara_rose@apple.com
+Abstract: This specification defines how web extensions should be loaded and unloaded in WebDriver Classic.
+Repository: w3c/webextensions
+
+ +
+ ## Introduction + This section is non-normative. + + This specification is non-normative.The intention of this spec is to + document how extensions should be loaded/unloaded in WebDriver Classic, + for browser vendors who choose to implement it. +
+
+

Endpoints

+ + + + + + + + + + + + + +
POST/session/{session id}/webextensionLoad WebExtension
DELETE/session/{session id}/webextension/{extension id}Unload WebExtension
+
+ +
+

Errors

+ + + + + + + + + + + + +
Error Code + HTTP Status + JSON Error Code + Description +
no such web extension + 404 + no such web extension + No web extension matching the given extension id was found + amongst the session's loaded extensions. +
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. +
+
+ +
+

Commands

+
+

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
+ +

Based on the + + BiDi implementation, 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}
+ +

Based on the + + BiDi implementation, 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 loaded with an id equal to + extension id, return + error code + no such web 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. +

+
+
+