Bug 1172897 - Rename ChildProcessActor to ContentProcessTargetActor. r=ochameau
MozReview-Commit-ID: 60kELwh0N3f
--- a/devtools/client/framework/target-from-url.js
+++ b/devtools/client/framework/target-from-url.js
@@ -43,17 +43,17 @@ exports.targetFromURL = async function t
const params = url.searchParams;
const type = params.get("type");
if (!type) {
throw new Error("targetFromURL, missing type parameter");
}
let id = params.get("id");
// Allows to spawn a chrome enabled target for any context
- // (handy to debug chrome stuff in a child process)
+ // (handy to debug chrome stuff in a content process)
let chrome = params.has("chrome");
let form, isBrowsingContext;
if (type === "tab") {
// Fetch target for a remote tab
id = parseInt(id, 10);
if (isNaN(id)) {
throw new Error(`targetFromURL, wrong tab id '${id}', should be a number`);
@@ -74,17 +74,17 @@ exports.targetFromURL = async function t
id = parseInt(id, 10);
if (isNaN(id)) {
id = 0;
}
const response = await client.getProcess(id);
form = response.form;
chrome = true;
if (id != 0) {
- // Child processes are not exposing browsing context target actors with the full
+ // Content processes are not exposing browsing context target actors with the full
// set of tab-scoped actors we would get from a browser tab. Instead, they only
// support debugger and console.
isBrowsingContext = false;
}
} catch (ex) {
if (ex.error == "noProcess") {
throw new Error(`targetFromURL, process with id '${id}' doesn't exist`);
}
--- a/devtools/docs/backend/actor-hierarchy.md
+++ b/devtools/docs/backend/actor-hierarchy.md
@@ -68,36 +68,37 @@ RootActor (root.js)
| Returned by "connect" on FrameTargetActorProxy.
|
|-- WorkerTargetActor (worker.js)
| Targets a worker (applies to various kinds like web worker, service
| worker, etc.).
| Returned by "listWorkers" request to the root actor to get all workers.
| Returned by "listWorkers" request to a FrameTargetActorProxy to get
| workers for a specific frame.
- | Returned by "listWorkers" request to a ChildProcessActor to get workers
- | for the chrome of the child process.
+ | Returned by "listWorkers" request to a ContentProcessTargetActor to get
+ | workers for the chrome of the child process.
|
|-- ChromeWindowTargetActor (chrome-window.js)
| Targets a single window, such as a browser window in Firefox, but it can
| be used to reach any window in the parent process.
| Extends the abstract class BrowsingContextTargetActor.
| Returned by "getWindow" request to the root actor.
|
|-- ParentProcessTargetActor (parent-process.js)
| Targets all resources in the parent process of Firefox (chrome documents,
| JSMs, JS XPCOM, etc.).
| Extends the abstract class BrowsingContextTargetActor.
| Extended by WebExtensionChildActor.
| Returned by "getProcess" request without any argument.
|
- |-- ChildProcessActor (child-process.js)
- | Targets the chrome of the child process (e10s).
- | Returned by "getProcess" request with a id argument,
- | matching the targeted process.
+ |-- ContentProcessTargetActor (content-process.js)
+ | Targets all resources in a content process of Firefox (chrome sandboxes,
+ | frame scripts, documents, etc.)
+ | Returned by "getProcess" request with a id argument, matching the
+ | targeted process.
|
\-- BrowserAddonActor (addon.js)
Targets the javascript of add-ons.
Returned by "listAddons" request.
```
## Target Actors
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -24,17 +24,16 @@ DevToolsModules(
'addon.js',
'addons.js',
'animation-type-longhand.js',
'animation.js',
'array-buffer.js',
'breakpoint.js',
'call-watcher.js',
'canvas.js',
- 'child-process.js',
'common.js',
'css-properties.js',
'csscoverage.js',
'device.js',
'emulation.js',
'environment.js',
'errordocs.js',
'frame.js',
--- a/devtools/server/actors/root.js
+++ b/devtools/server/actors/root.js
@@ -514,17 +514,18 @@ RootActor.prototype = {
if ((!("id" in request)) || request.id === 0) {
if (this._parentProcessTargetActor && (!this._parentProcessTargetActor.docShell ||
this._parentProcessTargetActor.docShell.isBeingDestroyed)) {
this._globalActorPool.removeActor(this._parentProcessTargetActor);
this._parentProcessTargetActor = null;
}
if (!this._parentProcessTargetActor) {
// Create a ParentProcessTargetActor for the parent process
- const { ParentProcessTargetActor } = require("devtools/server/actors/targets/parent-process");
+ const { ParentProcessTargetActor } =
+ require("devtools/server/actors/targets/parent-process");
this._parentProcessTargetActor = new ParentProcessTargetActor(this.conn);
this._globalActorPool.addActor(this._parentProcessTargetActor);
}
return { form: this._parentProcessTargetActor.form() };
}
const { id } = request;
rename from devtools/server/actors/child-process.js
rename to devtools/server/actors/targets/content-process.js
--- a/devtools/server/actors/child-process.js
+++ b/devtools/server/actors/targets/content-process.js
@@ -1,27 +1,34 @@
/* 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";
+/*
+ * Target actor for all resources in a content process of Firefox (chrome sandboxes, frame
+ * scripts, documents, etc.)
+ *
+ * See devtools/docs/backend/actor-hierarchy.md for more details.
+ */
+
const { Cc, Ci, Cu } = require("chrome");
const Services = require("Services");
const { ChromeDebuggerActor } = require("devtools/server/actors/thread");
const { WebConsoleActor } = require("devtools/server/actors/webconsole");
const makeDebugger = require("devtools/server/actors/utils/make-debugger");
const { ActorPool } = require("devtools/server/main");
const { assert } = require("devtools/shared/DevToolsUtils");
-const { TabSources } = require("./utils/TabSources");
+const { TabSources } = require("devtools/server/actors/utils/TabSources");
loader.lazyRequireGetter(this, "WorkerTargetActorList", "devtools/server/actors/worker/worker-list", true);
-function ChildProcessActor(connection) {
+function ContentProcessTargetActor(connection) {
this.conn = connection;
this._contextPool = new ActorPool(this.conn);
this.conn.addActorPool(this._contextPool);
this.threadActor = null;
// Use a see-everything debugger
this.makeDebugger = makeDebugger.bind(null, {
findDebuggees: dbg => dbg.findAllGlobals(),
@@ -30,20 +37,20 @@ function ChildProcessActor(connection) {
const sandboxPrototype = {
get tabs() {
const tabs = [];
const windowEnumerator = Services.ww.getWindowEnumerator();
while (windowEnumerator.hasMoreElements()) {
const window = windowEnumerator.getNext().QueryInterface(Ci.nsIDOMWindow);
const tabChildGlobal = window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell)
- .sameTypeRootTreeItem
- .QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIContentFrameMessageManager);
+ .getInterface(Ci.nsIDocShell)
+ .sameTypeRootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIContentFrameMessageManager);
tabs.push(tabChildGlobal);
}
return tabs;
},
};
// Scope into which the webconsole executes:
// A sandbox with chrome privileges with a `tabs` getter.
@@ -53,20 +60,20 @@ function ChildProcessActor(connection) {
sandboxPrototype,
});
this._consoleScope = sandbox;
this._workerList = null;
this._workerTargetActorPool = null;
this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
}
-exports.ChildProcessActor = ChildProcessActor;
+exports.ContentProcessTargetActor = ContentProcessTargetActor;
-ChildProcessActor.prototype = {
- actorPrefix: "process",
+ContentProcessTargetActor.prototype = {
+ actorPrefix: "contentProcessTarget",
get isRootActor() {
return true;
},
get exited() {
return !this._contextPool;
},
@@ -155,11 +162,11 @@ ChildProcessActor.prototype = {
// window mediator doesn't work in child.
// it doesn't throw, but doesn't return any window
},
postNest: function() {
},
};
-ChildProcessActor.prototype.requestTypes = {
- "listWorkers": ChildProcessActor.prototype.onListWorkers,
+ContentProcessTargetActor.prototype.requestTypes = {
+ "listWorkers": ContentProcessTargetActor.prototype.onListWorkers,
};
--- a/devtools/server/actors/targets/moz.build
+++ b/devtools/server/actors/targets/moz.build
@@ -2,13 +2,14 @@
# 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-proxy.js',
'frame.js',
'parent-process.js',
'worker.js',
)
--- a/devtools/server/performance/memory.js
+++ b/devtools/server/performance/memory.js
@@ -10,18 +10,17 @@ const { expectState } = require("devtool
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
loader.lazyRequireGetter(this, "DeferredTask",
"resource://gre/modules/DeferredTask.jsm", true);
loader.lazyRequireGetter(this, "StackFrameCache",
"devtools/server/actors/utils/stack", true);
loader.lazyRequireGetter(this, "ChromeUtils");
loader.lazyRequireGetter(this, "ParentProcessTargetActor", "devtools/server/actors/targets/parent-process", true);
-loader.lazyRequireGetter(this, "ChildProcessActor",
- "devtools/server/actors/child-process", true);
+loader.lazyRequireGetter(this, "ContentProcessTargetActor", "devtools/server/actors/targets/content-process", true);
/**
* A class that returns memory data for a parent actor's window.
* Using a tab-scoped actor with this instance will measure the memory footprint of its
* parent tab. Using a global-scoped actor instance however, will measure the memory
* footprint of the chrome window referenced by its root actor.
*
* To be consumed by actor's, like MemoryActor using this module to
@@ -139,17 +138,17 @@ Memory.prototype = {
*
* @returns {String} The snapshot id.
*/
saveHeapSnapshot: expectState("attached", function(boundaries = null) {
// If we are observing the whole process, then scope the snapshot
// accordingly. Otherwise, use the debugger's debuggees.
if (!boundaries) {
if (this.parent instanceof ParentProcessTargetActor ||
- this.parent instanceof ChildProcessActor) {
+ this.parent instanceof ContentProcessTargetActor) {
boundaries = { runtime: true };
} else {
boundaries = { debugger: this.dbg };
}
}
return ChromeUtils.saveHeapSnapshotGetId(boundaries);
}, "saveHeapSnapshot"),
--- a/devtools/server/startup/content-process.jsm
+++ b/devtools/server/startup/content-process.jsm
@@ -71,20 +71,20 @@ function init(msg) {
const loader = setupServer(mm);
// Connect both parent/child processes debugger servers RDP via message
// managers
const { DebuggerServer } = loader.require("devtools/server/main");
const conn = DebuggerServer.connectToParent(prefix, mm);
conn.parentMessageManager = mm;
- const { ChildProcessActor } =
- loader.require("devtools/server/actors/child-process");
+ const { ContentProcessTargetActor } =
+ loader.require("devtools/server/actors/targets/content-process");
const { ActorPool } = loader.require("devtools/server/main");
- const actor = new ChildProcessActor(conn);
+ const actor = new ContentProcessTargetActor(conn);
const actorPool = new ActorPool(conn);
actorPool.addActor(actor);
conn.addActorPool(actorPool);
const response = { actor: actor.form() };
mm.sendAsyncMessage("debug:content-process-actor", response);
});
}
--- a/devtools/server/tests/unit/test_MemoryActor_saveHeapSnapshot_03.js
+++ b/devtools/server/tests/unit/test_MemoryActor_saveHeapSnapshot_03.js
@@ -1,15 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Test that we can save full runtime heap snapshots when attached to the
-// ParentProcessTargetActor or a ChildProcessActor.
+// ParentProcessTargetActor or a ContentProcessTargetActor.
const { OS } = require("resource://gre/modules/osfile.jsm");
const run_test = makeFullRuntimeMemoryActorTest(async function(client, memoryFront) {
const snapshotFilePath = await memoryFront.saveHeapSnapshot();
ok(!!(await OS.File.stat(snapshotFilePath)),
"Should have the heap snapshot file");
const snapshot = ChromeUtils.readHeapSnapshot(snapshotFilePath);
--- a/devtools/shared/client/debugger-client.js
+++ b/devtools/shared/client/debugger-client.js
@@ -509,18 +509,18 @@ DebuggerClient.prototype = {
this.registerClient(traceClient);
}
onResponse(response, traceClient);
return [response, traceClient];
});
},
/**
- * Fetch the ParentProcessTargetActor for the main process or ChildProcessActor for a
- * a given child process ID.
+ * Fetch the ParentProcessTargetActor for the main process or
+ * ContentProcessTargetActor for a given content process ID.
*
* @param number id
* The ID for the process to attach (returned by `listProcesses`).
* Connected to the main process if omitted, or is 0.
*/
getProcess: function(id) {
const packet = {
to: "root",
--- a/devtools/shared/client/root-client.js
+++ b/devtools/shared/client/root-client.js
@@ -86,18 +86,18 @@ RootClient.prototype = {
* List the running processes.
*
* @param function onResponse
* Called with the response packet.
*/
listProcesses: DebuggerClient.requester({ type: "listProcesses" }),
/**
- * Retrieve all service worker registrations as well as workers from the parent
- * and child processes. Listing service workers involves merging information coming from
+ * Retrieve all service worker registrations as well as workers from the parent and
+ * content processes. Listing service workers involves merging information coming from
* registrations and workers, this method will combine this information to present a
* unified array of serviceWorkers. If you are only interested in other workers, use
* listWorkers.
*
* @return {Object}
* - {Array} service
* array of form-like objects for serviceworkers
* - {Array} shared