summaryrefslogtreecommitdiffstats
path: root/devtools/shared/specs/targets
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /devtools/shared/specs/targets
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/specs/targets')
-rw-r--r--devtools/shared/specs/targets/content-process.js55
-rw-r--r--devtools/shared/specs/targets/moz.build13
-rw-r--r--devtools/shared/specs/targets/parent-process.js24
-rw-r--r--devtools/shared/specs/targets/webextension.js18
-rw-r--r--devtools/shared/specs/targets/window-global.js156
-rw-r--r--devtools/shared/specs/targets/worker.js30
6 files changed, 296 insertions, 0 deletions
diff --git a/devtools/shared/specs/targets/content-process.js b/devtools/shared/specs/targets/content-process.js
new file mode 100644
index 0000000000..3c7edef4a2
--- /dev/null
+++ b/devtools/shared/specs/targets/content-process.js
@@ -0,0 +1,55 @@
+/* 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/. */
+"use strict";
+
+const {
+ types,
+ Arg,
+ Option,
+ RetVal,
+ generateActorSpec,
+} = require("resource://devtools/shared/protocol.js");
+
+types.addDictType("contentProcessTarget.workers", {
+ error: "nullable:string",
+ workers: "nullable:array:workerDescriptor",
+});
+
+const contentProcessTargetSpec = generateActorSpec({
+ typeName: "contentProcessTarget",
+
+ methods: {
+ listWorkers: {
+ request: {},
+ response: RetVal("contentProcessTarget.workers"),
+ },
+
+ pauseMatchingServiceWorkers: {
+ request: {
+ origin: Option(0, "string"),
+ },
+ response: {},
+ },
+ },
+
+ events: {
+ workerListChanged: {
+ type: "workerListChanged",
+ },
+ "resource-available-form": {
+ type: "resource-available-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-destroyed-form": {
+ type: "resource-destroyed-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-updated-form": {
+ type: "resource-updated-form",
+ resources: Arg(0, "array:json"),
+ },
+ },
+});
+
+exports.contentProcessTargetSpec = contentProcessTargetSpec;
diff --git a/devtools/shared/specs/targets/moz.build b/devtools/shared/specs/targets/moz.build
new file mode 100644
index 0000000000..9c22a1a241
--- /dev/null
+++ b/devtools/shared/specs/targets/moz.build
@@ -0,0 +1,13 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+DevToolsModules(
+ "content-process.js",
+ "parent-process.js",
+ "webextension.js",
+ "window-global.js",
+ "worker.js",
+)
diff --git a/devtools/shared/specs/targets/parent-process.js b/devtools/shared/specs/targets/parent-process.js
new file mode 100644
index 0000000000..dca2c777fa
--- /dev/null
+++ b/devtools/shared/specs/targets/parent-process.js
@@ -0,0 +1,24 @@
+/* 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/. */
+"use strict";
+
+const { generateActorSpec } = require("resource://devtools/shared/protocol.js");
+const { extend } = require("resource://devtools/shared/extend.js");
+const {
+ windowGlobalTargetSpecPrototype,
+} = require("resource://devtools/shared/specs/targets/window-global.js");
+
+const parentProcessTargetSpecPrototype = extend(
+ windowGlobalTargetSpecPrototype,
+ {
+ typeName: "parentProcessTarget",
+ }
+);
+
+const parentProcessTargetSpec = generateActorSpec(
+ parentProcessTargetSpecPrototype
+);
+
+exports.parentProcessTargetSpecPrototype = parentProcessTargetSpecPrototype;
+exports.parentProcessTargetSpec = parentProcessTargetSpec;
diff --git a/devtools/shared/specs/targets/webextension.js b/devtools/shared/specs/targets/webextension.js
new file mode 100644
index 0000000000..4eeffb3da7
--- /dev/null
+++ b/devtools/shared/specs/targets/webextension.js
@@ -0,0 +1,18 @@
+/* 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/. */
+"use strict";
+
+const { generateActorSpec } = require("resource://devtools/shared/protocol.js");
+const { extend } = require("resource://devtools/shared/extend.js");
+const {
+ parentProcessTargetSpecPrototype,
+} = require("resource://devtools/shared/specs/targets/parent-process.js");
+
+const webExtensionTargetSpec = generateActorSpec(
+ extend(parentProcessTargetSpecPrototype, {
+ typeName: "webExtensionTarget",
+ })
+);
+
+exports.webExtensionTargetSpec = webExtensionTargetSpec;
diff --git a/devtools/shared/specs/targets/window-global.js b/devtools/shared/specs/targets/window-global.js
new file mode 100644
index 0000000000..597e0eb0e8
--- /dev/null
+++ b/devtools/shared/specs/targets/window-global.js
@@ -0,0 +1,156 @@
+/* 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/. */
+"use strict";
+
+const {
+ types,
+ generateActorSpec,
+ RetVal,
+ Option,
+ Arg,
+} = require("resource://devtools/shared/protocol.js");
+
+types.addDictType("windowGlobalTarget.switchtoframe", {
+ message: "string",
+});
+
+types.addDictType("windowGlobalTarget.listframes", {
+ frames: "array:windowGlobalTarget.window",
+});
+
+types.addDictType("windowGlobalTarget.window", {
+ id: "string",
+ parentID: "nullable:string",
+ url: "nullable:string", // should be present if not destroying
+ title: "nullable:string", // should be present if not destroying
+ destroy: "nullable:boolean", // not present if not destroying
+});
+
+types.addDictType("windowGlobalTarget.workers", {
+ workers: "array:workerDescriptor",
+});
+
+// @backward-compat { legacy }
+// reload is preserved for third party tools. See Bug 1717837.
+// DevTools should use Descriptor::reloadDescriptor instead.
+types.addDictType("windowGlobalTarget.reload", {
+ force: "boolean",
+});
+
+// @backward-compat { version 87 } See backward-compat note for `reconfigure`.
+types.addDictType("windowGlobalTarget.reconfigure", {
+ cacheDisabled: "nullable:boolean",
+ colorSchemeSimulation: "nullable:string",
+ printSimulationEnabled: "nullable:boolean",
+ restoreFocus: "nullable:boolean",
+ serviceWorkersTestingEnabled: "nullable:boolean",
+});
+
+const windowGlobalTargetSpecPrototype = {
+ typeName: "windowGlobalTarget",
+
+ methods: {
+ detach: {
+ request: {},
+ response: {},
+ },
+ focus: {
+ request: {},
+ response: {},
+ },
+ goForward: {
+ request: {},
+ response: {},
+ },
+ goBack: {
+ request: {},
+ response: {},
+ },
+ // @backward-compat { legacy }
+ // reload is preserved for third party tools. See Bug 1717837.
+ // DevTools should use Descriptor::reloadDescriptor instead.
+ reload: {
+ request: {
+ options: Option(0, "windowGlobalTarget.reload"),
+ },
+ response: {},
+ },
+ navigateTo: {
+ request: {
+ url: Option(0, "string"),
+ },
+ response: {},
+ },
+ // @backward-compat { version 87 } Starting with version 87, targets which
+ // support the watcher will rely on the configuration actor to update their
+ // configuration flags. However we need to keep this request until all
+ // browsing context targets support the watcher (eg webextensions).
+ reconfigure: {
+ request: {
+ options: Option(0, "windowGlobalTarget.reconfigure"),
+ },
+ response: {},
+ },
+ switchToFrame: {
+ request: {
+ windowId: Option(0, "string"),
+ },
+ response: RetVal("windowGlobalTarget.switchtoframe"),
+ },
+ listFrames: {
+ request: {},
+ response: RetVal("windowGlobalTarget.listframes"),
+ },
+ listWorkers: {
+ request: {},
+ response: RetVal("windowGlobalTarget.workers"),
+ },
+ logInPage: {
+ request: {
+ text: Option(0, "string"),
+ category: Option(0, "string"),
+ flags: Option(0, "string"),
+ },
+ response: {},
+ },
+ },
+ events: {
+ tabNavigated: {
+ type: "tabNavigated",
+ url: Option(0, "string"),
+ title: Option(0, "string"),
+ state: Option(0, "string"),
+ isFrameSwitching: Option(0, "boolean"),
+ },
+ frameUpdate: {
+ type: "frameUpdate",
+ frames: Option(0, "nullable:array:windowGlobalTarget.window"),
+ selected: Option(0, "nullable:number"),
+ destroyAll: Option(0, "nullable:boolean"),
+ },
+ workerListChanged: {
+ type: "workerListChanged",
+ },
+
+ "resource-available-form": {
+ type: "resource-available-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-destroyed-form": {
+ type: "resource-destroyed-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-updated-form": {
+ type: "resource-updated-form",
+ resources: Arg(0, "array:json"),
+ },
+ },
+};
+
+const windowGlobalTargetSpec = generateActorSpec(
+ windowGlobalTargetSpecPrototype
+);
+
+exports.windowGlobalTargetSpecPrototype = windowGlobalTargetSpecPrototype;
+exports.windowGlobalTargetSpec = windowGlobalTargetSpec;
diff --git a/devtools/shared/specs/targets/worker.js b/devtools/shared/specs/targets/worker.js
new file mode 100644
index 0000000000..d329f5b9dd
--- /dev/null
+++ b/devtools/shared/specs/targets/worker.js
@@ -0,0 +1,30 @@
+/* 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/. */
+"use strict";
+
+const {
+ Arg,
+ generateActorSpec,
+} = require("resource://devtools/shared/protocol.js");
+
+const workerTargetSpec = generateActorSpec({
+ typeName: "workerTarget",
+ methods: {},
+ events: {
+ "resource-available-form": {
+ type: "resource-available-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-destroyed-form": {
+ type: "resource-destroyed-form",
+ resources: Arg(0, "array:json"),
+ },
+ "resource-updated-form": {
+ type: "resource-updated-form",
+ resources: Arg(0, "array:json"),
+ },
+ },
+});
+
+exports.workerTargetSpec = workerTargetSpec;