summaryrefslogtreecommitdiffstats
path: root/devtools/shared/specs/targets
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/shared/specs/targets')
-rw-r--r--devtools/shared/specs/targets/browsing-context.js166
-rw-r--r--devtools/shared/specs/targets/chrome-window.js18
-rw-r--r--devtools/shared/specs/targets/content-process.js46
-rw-r--r--devtools/shared/specs/targets/frame.js19
-rw-r--r--devtools/shared/specs/targets/moz.build15
-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/worker.js19
8 files changed, 325 insertions, 0 deletions
diff --git a/devtools/shared/specs/targets/browsing-context.js b/devtools/shared/specs/targets/browsing-context.js
new file mode 100644
index 0000000000..f40dfff471
--- /dev/null
+++ b/devtools/shared/specs/targets/browsing-context.js
@@ -0,0 +1,166 @@
+/* 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("devtools/shared/protocol");
+
+types.addDictType("browsingContextTarget.attach", {
+ threadActor: "number",
+ cacheDisabled: "boolean",
+ javascriptEnabled: "boolean",
+ traits: "json",
+});
+
+types.addDictType("browsingContextTarget.switchtoframe", {
+ message: "string",
+});
+
+types.addDictType("browsingContextTarget.listframes", {
+ frames: "array:browsingContextTarget.window",
+});
+
+types.addDictType("browsingContextTarget.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("browsingContextTarget.workers", {
+ workers: "array:workerDescriptor",
+});
+
+types.addDictType("browsingContextTarget.reload", {
+ force: "boolean",
+});
+
+types.addDictType("browsingContextTarget.reconfigure", {
+ javascriptEnabled: "nullable:boolean",
+ cacheDisabled: "nullable:boolean",
+ serviceWorkersTestingEnabled: "nullable:boolean",
+ performReload: "nullable:boolean",
+});
+
+const browsingContextTargetSpecPrototype = {
+ typeName: "browsingContextTarget",
+
+ methods: {
+ attach: {
+ request: {},
+ response: RetVal("browsingContextTarget.attach"),
+ },
+ detach: {
+ request: {},
+ response: {},
+ },
+ ensureCSSErrorReportingEnabled: {
+ request: {},
+ response: {},
+ },
+ focus: {
+ request: {},
+ response: {},
+ },
+ goForward: {
+ request: {},
+ response: {},
+ },
+ goBack: {
+ request: {},
+ response: {},
+ },
+ reload: {
+ request: {
+ options: Option(0, "browsingContextTarget.reload"),
+ },
+ response: {},
+ },
+ navigateTo: {
+ request: {
+ url: Option(0, "string"),
+ },
+ response: {},
+ },
+ reconfigure: {
+ request: {
+ options: Option(0, "browsingContextTarget.reconfigure"),
+ },
+ response: {},
+ },
+ switchToFrame: {
+ request: {
+ windowId: Option(0, "string"),
+ },
+ response: RetVal("browsingContextTarget.switchtoframe"),
+ },
+ listFrames: {
+ request: {},
+ response: RetVal("browsingContextTarget.listframes"),
+ },
+ listWorkers: {
+ request: {},
+ response: RetVal("browsingContextTarget.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"),
+ nativeConsoleAPI: Option(0, "boolean"),
+ state: Option(0, "string"),
+ isFrameSwitching: Option(0, "boolean"),
+ },
+ frameUpdate: {
+ type: "frameUpdate",
+ frames: Option(0, "nullable:array:browsingContextTarget.window"),
+ selected: Option(0, "nullable:number"),
+ destroyAll: Option(0, "nullable:boolean"),
+ },
+ tabDetached: {
+ type: "tabDetached",
+ // This is to make browser_dbg_navigation.js to work as it expect to
+ // see a packet object when listening for tabDetached
+ from: Option(0, "string"),
+ },
+ 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 browsingContextTargetSpec = generateActorSpec(
+ browsingContextTargetSpecPrototype
+);
+
+exports.browsingContextTargetSpecPrototype = browsingContextTargetSpecPrototype;
+exports.browsingContextTargetSpec = browsingContextTargetSpec;
diff --git a/devtools/shared/specs/targets/chrome-window.js b/devtools/shared/specs/targets/chrome-window.js
new file mode 100644
index 0000000000..31aae450c8
--- /dev/null
+++ b/devtools/shared/specs/targets/chrome-window.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("devtools/shared/protocol");
+const { extend } = require("devtools/shared/extend");
+const {
+ browsingContextTargetSpecPrototype,
+} = require("devtools/shared/specs/targets/browsing-context");
+
+const chromeWindowTargetSpec = generateActorSpec(
+ extend(browsingContextTargetSpecPrototype, {
+ typeName: "chromeWindowTarget",
+ })
+);
+
+exports.chromeWindowTargetSpec = chromeWindowTargetSpec;
diff --git a/devtools/shared/specs/targets/content-process.js b/devtools/shared/specs/targets/content-process.js
new file mode 100644
index 0000000000..3391bad736
--- /dev/null
+++ b/devtools/shared/specs/targets/content-process.js
@@ -0,0 +1,46 @@
+/* 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,
+ Option,
+ RetVal,
+ generateActorSpec,
+} = require("devtools/shared/protocol");
+
+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",
+ },
+ tabDetached: {
+ type: "tabDetached",
+ from: Option(0, "string"),
+ },
+ },
+});
+
+exports.contentProcessTargetSpec = contentProcessTargetSpec;
diff --git a/devtools/shared/specs/targets/frame.js b/devtools/shared/specs/targets/frame.js
new file mode 100644
index 0000000000..6b9f4ef44c
--- /dev/null
+++ b/devtools/shared/specs/targets/frame.js
@@ -0,0 +1,19 @@
+/* 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("devtools/shared/protocol");
+const { extend } = require("devtools/shared/extend");
+const {
+ browsingContextTargetSpecPrototype,
+} = require("devtools/shared/specs/targets/browsing-context");
+
+// Bug 1467560: Update `generateActorSpec` support extension more naturally
+const frameTargetSpec = generateActorSpec(
+ extend(browsingContextTargetSpecPrototype, {
+ typeName: "frameTarget",
+ })
+);
+
+exports.frameTargetSpec = frameTargetSpec;
diff --git a/devtools/shared/specs/targets/moz.build b/devtools/shared/specs/targets/moz.build
new file mode 100644
index 0000000000..0fb59649bd
--- /dev/null
+++ b/devtools/shared/specs/targets/moz.build
@@ -0,0 +1,15 @@
+# -*- 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(
+ "browsing-context.js",
+ "chrome-window.js",
+ "content-process.js",
+ "frame.js",
+ "parent-process.js",
+ "webextension.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..b74d646983
--- /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("devtools/shared/protocol");
+const { extend } = require("devtools/shared/extend");
+const {
+ browsingContextTargetSpecPrototype,
+} = require("devtools/shared/specs/targets/browsing-context");
+
+const parentProcessTargetSpecPrototype = extend(
+ browsingContextTargetSpecPrototype,
+ {
+ 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..bf55ec2c7b
--- /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("devtools/shared/protocol");
+const { extend } = require("devtools/shared/extend");
+const {
+ parentProcessTargetSpecPrototype,
+} = require("devtools/shared/specs/targets/parent-process");
+
+const webExtensionTargetSpec = generateActorSpec(
+ extend(parentProcessTargetSpecPrototype, {
+ typeName: "webExtensionTarget",
+ })
+);
+
+exports.webExtensionTargetSpec = webExtensionTargetSpec;
diff --git a/devtools/shared/specs/targets/worker.js b/devtools/shared/specs/targets/worker.js
new file mode 100644
index 0000000000..93ebff7701
--- /dev/null
+++ b/devtools/shared/specs/targets/worker.js
@@ -0,0 +1,19 @@
+/* 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("devtools/shared/protocol");
+
+const workerTargetSpec = generateActorSpec({
+ typeName: "workerTarget",
+ methods: {},
+ events: {
+ "resource-available-form": {
+ type: "resource-available-form",
+ resources: Arg(0, "array:json"),
+ },
+ },
+});
+
+exports.workerTargetSpec = workerTargetSpec;