summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf')
-rw-r--r--toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf101
1 files changed, 101 insertions, 0 deletions
diff --git a/toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf b/toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf
new file mode 100644
index 0000000000..be312c80d4
--- /dev/null
+++ b/toolkit/components/extensions/webidl-api/ExtensionWebIDL.conf
@@ -0,0 +1,101 @@
+# -*- Mode:Python; tab-width:8; indent-tabs-mode:nil -*- */
+# vim: set ts=8 sts=4 et sw=4 tw=80: */
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# WebExtension WebIDL API Bindings Configuration, used by the script
+# `dom/extensions-webidl/GenerateWebIDLBindingsFromJSONSchema.py`
+# to customize the WebIDL generated based on the WebExtensions API JSON Schemas.
+#
+# Generating the WebIDL definitions for some of the WebExtensions API does require
+# some special handling, there are corresponding entries in the configuration tables
+# below.
+#
+
+# Mapping table between the JSON Schema types (represented as keys of the map)
+# and the related WebIDL type (represented by the value in the map).
+# Any mapping missing from this table will fallback to use the "any" webidl type
+# (See GenerateWebIDLBindings.py WebIDLHelpers.webidl_type_from_mapping method).
+#
+# NOTE: Please keep this table in alphabetic order (upper and lower case in two
+# separate alphabetic orders, group of the upcase ones first).
+WEBEXT_TYPES_MAPPING = {
+ "ExpectedError": "any", # Only used in test.assertThrows/assertRejects
+ "Port": "ExtensionPort",
+ "Promise": "Promise<any>",
+ "StreamFilter": "ExtensionStreamFilter",
+ "any": "any",
+ "boolean": "boolean",
+ "number": "float",
+ "function": "Function",
+ "integer": "long",
+ "object": "any", # TODO: as a follow up we may look into generating webidl dictionaries to achieve a more precise mapping
+ "runtime.Port": "ExtensionPort",
+ "string": "DOMString",
+ "types.Setting": "ExtensionSetting",
+}
+
+# Set of the types from the WEBEXT_TYPES_MAPPING that will be threated as primitive
+# types (e.g. used to omit optional attribute in the WebIDL methods type signatures).
+#
+# NOTE: Please keep this table in alphabetic order (upper and lower case in two
+# separate alphabetic orders, group of the update ones first).
+WEBIDL_PRIMITIVE_TYPES = set([
+ "DOMString",
+ "boolean",
+ "float"
+ "long",
+])
+
+# Mapping table for some APIs that do require special handling and a
+# specific stub method should be set in the generated webidl extended
+# attribute `WebExtensionStub`.
+#
+# The key in this map represent the API method name (including the
+# API namespace that is part of), the value is the value to set on the
+# `WebExtensionStub` webidl extended attribute:
+#
+# "namespace.methodName": "WebExtensionStubName",
+#
+# NOTE: Please keep this table in alphabetic order.
+WEBEXT_STUBS_MAPPING = {
+ "dns.resolve": "AsyncAmbiguous",
+ "runtime.connect": "ReturnsPort",
+ "runtime.connectNative": "ReturnsPort",
+ "runtime.getURL": "ReturnsString",
+ # TODO: Bug 1782690 - This method accepts functions/args so we'll need to
+ # serialize them.
+ "scripting.executeScript": "NotImplementedAsync",
+ "scripting.getRegisteredContentScripts": "AsyncAmbiguous",
+ "scripting.unregisterContentScripts": "AsyncAmbiguous",
+ "test.assertEq": "AssertEq",
+ "test.assertRejects": False, # No WebExtensionStub attribute.
+ "test.assertThrows": False, # No WebExtensionStub attribute.
+ "test.withHandlingUserInput": "NotImplementedNoReturn",
+}
+
+WEBEXT_WORKER_HIDDEN_SET = set([
+ "runtime.getFrameId",
+ "runtime.getBackgroundPage",
+])
+
+# Mapping table for the directories where the JSON API schema will be loaded
+# from.
+WEBEXT_SCHEMADIRS_MAPPING = {
+ "toolkit": ["toolkit", "components", "extensions", "schemas"],
+ "browser": ["browser", "components", "extensions", "schemas"],
+ "mobile": ["mobile", "android", "components", "extensions", "schemas"],
+}
+
+# List of toolkit-level WebExtensions API namespaces that are not included
+# in android builds.
+#
+# NOTE: keep this list in sync with the API namespaces excluded in
+# - toolkit/components/extensions/jar.mn
+# - toolkit/components/extensions/schemas/jar.mn
+WEBEXT_ANDROID_EXCLUDED = [
+ "captivePortal",
+ "geckoProfiler",
+ "identity"
+]