From 20ff7325c2855b0e95d1e251bc790cd057adbfc2 Mon Sep 17 00:00:00 2001 From: VeithMetro Date: Fri, 7 Feb 2025 11:45:02 +0100 Subject: [PATCH] Add IWebBrowserExt interface, remove the old .json file --- interfaces/IBrowser.h | 34 ++++++++++-- interfaces/Ids.h | 1 + jsonrpc/WebKitBrowser.json | 105 ------------------------------------- 3 files changed, 30 insertions(+), 110 deletions(-) delete mode 100644 jsonrpc/WebKitBrowser.json diff --git a/interfaces/IBrowser.h b/interfaces/IBrowser.h index 895d6a70..020c13e9 100644 --- a/interfaces/IBrowser.h +++ b/interfaces/IBrowser.h @@ -90,7 +90,8 @@ namespace Exchange { virtual void VisibilityChange(const bool hidden) = 0; // @brief Notifies that the web page requests to close its window virtual void PageClosure() = 0; - /* @json:omit */ + // @brief A Base64 encoded JSON message from legacy $badger bridge + // @param Requested action virtual void BridgeQuery(const string& message) = 0; }; @@ -114,10 +115,12 @@ namespace Exchange { // @param fps: Current FPS virtual uint32_t FPS(uint8_t& fps /* @out */) const = 0; - /* @json:omit */ - virtual uint32_t HeaderList(string& headerlist /* @out */) const = 0; - /* @json:omit */ - virtual uint32_t HeaderList(const string& headerlist ) = 0; + // @property + // @text headers + // @brief Headers to send on all requests that the browser makes + // @param Single string containing a list of headers + virtual Core::hresult HeaderList(string& headerlist /* @out @opaque */) const = 0; + virtual Core::hresult HeaderList(const string& headerlist /* @opaque */) = 0; // @property // @brief UserAgent string used by the browser @@ -151,6 +154,27 @@ namespace Exchange { virtual uint32_t CollectGarbage() = 0; }; + // @json 1.0.0 @text:legacy_lowercase @uncompliant:extended + struct EXTERNAL IWebBrowserExt : virtual public Core::IUnknown { + + enum { ID = ID_WEB_BROWSER_EXT }; + + using IStringIterator = RPC::IIteratorType; + + // @brief Removes contents of a directory from the persistent storage + // @alt:deprecated delete + // @description Use this method to recursively delete contents of a directory + // @param Path to directory (within the persistent storage) to delete contents of (e.g. .cache/wpe/disk-cache) + // @retval ERROR_UNKNOWN_KEY The given path cannot be empty + virtual Core::hresult DeleteDir(const string& path) = 0; + + // @property + // @brief User preferred languages + virtual Core::hresult Languages(IStringIterator*& languages /* @out */) const = 0; + virtual Core::hresult Languages(IStringIterator* const languages) = 0; + + }; + // @json 1.0.0 @uncompliant:extended struct EXTERNAL IBrowserResources : virtual public Core::IUnknown { diff --git a/interfaces/Ids.h b/interfaces/Ids.h index 8289f1eb..3e1dd771 100644 --- a/interfaces/Ids.h +++ b/interfaces/Ids.h @@ -61,6 +61,7 @@ namespace Exchange { ID_BROWSER_SCRIPTING = ID_BROWSER + 7, ID_BROWSER_COOKIEJAR = ID_BROWSER + 8, ID_BROWSER_COOKIEJAR_NOTIFICATION = ID_BROWSER + 9, + ID_WEB_BROWSER_EXT = ID_BROWSER + 10, ID_POWER = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x010, ID_POWER_NOTIFICATION = ID_POWER + 1, diff --git a/jsonrpc/WebKitBrowser.json b/jsonrpc/WebKitBrowser.json deleted file mode 100644 index 984665f6..00000000 --- a/jsonrpc/WebKitBrowser.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "$schema": "interface.schema.json", - "jsonrpc": "2.0", - "info": { - "version": "1.0.0", - "title": "WebKit Browser API", - "class": "WebKitBrowser", - "format": "uncompliant-collapsed", - "description": "WebKitBrowser JSON-RPC interface" - }, - "common": { - "$ref": "common.json" - }, - "include": { - "statecontrol": { - "$ref": "StateControl.json#" - } - }, - "methods": { - "delete": { - "summary": "Removes contents of a directory from the persistent storage", - "description": "Use this method to recursively delete contents of a directory", - "params": { - "type": "object", - "properties": { - "path": { - "type": "string", - "description": "Path to directory (within the persistent storage) to delete contents of", - "example": ".cache/wpe/disk-cache" - } - } - }, - "result": { - "$ref": "#/common/results/void" - }, - "errors": [ - { - "description": "The given path was incorrect", - "$ref": "#/common/errors/unknownkey" - } - ] - } - }, - "properties": { - "languages": { - "summary": "User preferred languages", - "params": { - "type": "array", - "items": { - "type": "string", - "example": "en-US" - } - } - }, - "headers": { - "summary": "Headers to send on all requests that the browser makes", - "params": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "Header name", - "type": "string", - "example": "X-Forwarded-For" - }, - "value": { - "description": "Header value", - "type": "string", - "example": "::1" - } - } - } - } - } - }, - "events": { - "bridgequery": { - "summary": "A Base64 encoded JSON message from legacy $badger bridge", - "obsolete" : true, - "params": { - "type": "string", - "properties": { - "action": { - "type": "string", - "description": "Requested action" - }, - "pid": { - "type": "number", - "description": "Promise Id associated with query" - }, - "args": { - "type": "object", - "description": "Arguments to the action", - "properties": {}, - "required": [] - } - }, - "required": [ - "action" - ] - } - } - } -}