--- a/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_chrome-debugging.js
@@ -32,21 +32,21 @@ function test() {
promise.all([gAttached.promise, gNewGlobal.promise, gNewChromeSource.promise])
.then(resumeAndCloseConnection)
.then(finish)
.catch(aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
- testChromeActor();
+ testParentProcessTargetActor();
});
}
-function testChromeActor() {
+function testParentProcessTargetActor() {
gClient.getProcess().then(aResponse => {
gClient.addListener("newGlobal", onNewGlobal);
let actor = aResponse.form.actor;
gClient.attachTab(actor, (response, tabClient) => {
tabClient.attachThread(null, (aResponse, aThreadClient) => {
gThreadClient = aThreadClient;
gThreadClient.addListener("newSource", onNewSource);
--- a/devtools/client/framework/connect/connect.js
+++ b/devtools/client/framework/connect/connect.js
@@ -118,17 +118,17 @@ var onConnectionReady = async function([
for (let i = 0; i < response.tabs.length; i++) {
buildTabLink(response.tabs[i], parent, i == response.selected);
}
const gParent = document.getElementById("globalActors");
// Build the Remote Process button
// If Fx<39, chrome target actors were used to be exposed on RootActor
- // but in Fx>=39, chrome is debuggable via getProcess() and ChromeActor
+ // but in Fx>=39, chrome is debuggable via getProcess() and ParentProcessTargetActor
if (globals.consoleActor || gClient.mainRoot.traits.allowChromeProcess) {
const a = document.createElement("a");
a.onclick = function() {
if (gClient.mainRoot.traits.allowChromeProcess) {
gClient.getProcess()
.then(aResponse => {
openToolbox(aResponse.form, true);
});
--- a/devtools/client/framework/test/browser_target_remote.js
+++ b/devtools/client/framework/test/browser_target_remote.js
@@ -2,17 +2,17 @@
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Ensure target is closed if client is closed directly
function test() {
waitForExplicitFinish();
- getChromeActors((client, response) => {
+ getParentProcessActors((client, response) => {
const options = {
form: response,
client: client,
chrome: true
};
TargetFactory.forRemoteTab(options).then(target => {
target.on("close", () => {
--- a/devtools/client/framework/test/browser_target_support.js
+++ b/devtools/client/framework/test/browser_target_support.js
@@ -47,17 +47,17 @@ async function testTarget(client, target
close(target, client);
}
// Ensure target is closed if client is closed directly
function test() {
waitForExplicitFinish();
- getChromeActors((client, response) => {
+ getParentProcessActors((client, response) => {
const options = {
form: response,
client: client,
chrome: true
};
TargetFactory.forRemoteTab(options).then(testTarget.bind(null, client));
});
--- a/devtools/client/framework/test/head.js
+++ b/devtools/client/framework/test/head.js
@@ -19,17 +19,17 @@ function toggleAllTools(state) {
if (state) {
Services.prefs.setBoolPref(tool.visibilityswitch, true);
} else {
Services.prefs.clearUserPref(tool.visibilityswitch);
}
}
}
-function getChromeActors(callback) {
+function getParentProcessActors(callback) {
const { DebuggerServer } = require("devtools/server/main");
const { DebuggerClient } = require("devtools/shared/client/debugger-client");
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
const client = new DebuggerClient(DebuggerServer.connectPipe());
--- a/devtools/client/webide/modules/app-manager.js
+++ b/devtools/client/webide/modules/app-manager.js
@@ -236,17 +236,17 @@ var AppManager = exports.AppManager = {
}
return this.getTarget().then(target => {
target.activeTab.reload();
}, console.error);
},
getTarget: function() {
if (this.selectedProject.type == "mainProcess") {
- // Fx >=39 exposes a ChromeActor to debug the main process
+ // Fx >=39 exposes a ParentProcessTargetActor to debug the main process
if (this.connection.client.mainRoot.traits.allowChromeProcess) {
return this.connection.client.getProcess()
.then(aResponse => {
return TargetFactory.forRemoteTab({
form: aResponse.form,
client: this.connection.client,
chrome: true
});
--- a/devtools/docs/backend/actor-hierarchy.md
+++ b/devtools/docs/backend/actor-hierarchy.md
@@ -77,20 +77,21 @@ RootActor (root.js)
| 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.
|
- |-- ChromeActor (chrome.js)
- | Targets all resources in the parent process of firefox
- | (chrome documents, JSM, JS XPCOM, etc.).
+ |-- 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.
|
\-- BrowserAddonActor (addon.js)
@@ -120,17 +121,17 @@ Tab-scoped actors are accessed via the t
the `actorID` for each tab-scoped actor.
The tab-scoped actors expect to find the following properties on the target
actor:
- threadActor:
ThreadActor instance for the given target,
only defined once `attach` request is called, or on construction.
- isRootActor: (historical name)
- Always false, except on ChromeActor.
+ Always false, except on ParentProcessTargetActor.
Despite the attribute name, it is being used to accept all resources
(like chrome one) instead of limiting only to content resources.
- makeDebugger:
Helper function used to create Debugger object for the target.
(See actors/utils/make-debugger.js for more info)
In addition to this, the actors inheriting from BrowsingContextTargetActor,
expose many other attributes and events:
--- a/devtools/server/actors/moz.build
+++ b/devtools/server/actors/moz.build
@@ -25,17 +25,16 @@ DevToolsModules(
'addons.js',
'animation-type-longhand.js',
'animation.js',
'array-buffer.js',
'breakpoint.js',
'call-watcher.js',
'canvas.js',
'child-process.js',
- 'chrome.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
@@ -97,17 +97,17 @@ function RootActor(connection, parameter
this._onServiceWorkerRegistrationListChanged =
this.onServiceWorkerRegistrationListChanged.bind(this);
this._onProcessListChanged = this.onProcessListChanged.bind(this);
this._extraActors = {};
this._globalActorPool = new ActorPool(this.conn);
this.conn.addActorPool(this._globalActorPool);
- this._chromeActor = null;
+ this._parentProcessTargetActor = null;
this._processActors = new Map();
}
RootActor.prototype = {
constructor: RootActor,
applicationType: "browser",
traits: {
@@ -144,17 +144,17 @@ RootActor.prototype = {
// Trait added in Gecko 38, indicating that all features necessary for
// grabbing allocations from the MemoryActor are available for the performance tool
memoryActorAllocations: true,
// Added in Firefox 40. Indicates that the backend supports registering custom
// commands through the WebConsoleCommands API.
webConsoleCommands: true,
// Whether root actor exposes chrome target actors and access to any window.
// If allowChromeProcess is true, you can:
- // * get a ChromeActor instance to debug chrome and any non-content
+ // * get a ParentProcessTargetActor instance to debug chrome and any non-content
// resource via getProcess requests
// * get a ChromeWindowTargetActor instance to debug windows which could be chrome,
// like browser windows via getWindow requests
// If allowChromeProcess is defined, but not true, it means that root actor
// no longer expose chrome target actors, but also that the above requests are
// forbidden for security reasons.
get allowChromeProcess() {
return DebuggerServer.allowChromeProcess;
@@ -218,17 +218,17 @@ RootActor.prototype = {
this._parameters.onShutdown();
}
this._extraActors = null;
this.conn = null;
this._tabActorPool = null;
this._globalActorPool = null;
this._chromeWindowActorPool = null;
this._parameters = null;
- this._chromeActor = null;
+ this._parentProcessTargetActor = null;
this._processActors.clear();
},
/**
* Gets the "root" form, which lists all the global actors that affect the entire
* browser. This can replace usages of `listTabs` that only wanted the global actors
* and didn't actually care about tabs.
*/
@@ -507,29 +507,29 @@ RootActor.prototype = {
}
if (("id" in request) && typeof (request.id) != "number") {
return { error: "wrongParameter",
message: "getProcess requires a valid `id` attribute." };
}
// If the request doesn't contains id parameter or id is 0
// (id == 0, based on onListProcesses implementation)
if ((!("id" in request)) || request.id === 0) {
- if (this._chromeActor && (!this._chromeActor.docShell ||
- this._chromeActor.docShell.isBeingDestroyed)) {
- this._globalActorPool.removeActor(this._chromeActor);
- this._chromeActor = null;
+ if (this._parentProcessTargetActor && (!this._parentProcessTargetActor.docShell ||
+ this._parentProcessTargetActor.docShell.isBeingDestroyed)) {
+ this._globalActorPool.removeActor(this._parentProcessTargetActor);
+ this._parentProcessTargetActor = null;
}
- if (!this._chromeActor) {
- // Create a ChromeActor for the parent process
- const { ChromeActor } = require("devtools/server/actors/chrome");
- this._chromeActor = new ChromeActor(this.conn);
- this._globalActorPool.addActor(this._chromeActor);
+ if (!this._parentProcessTargetActor) {
+ // Create a ParentProcessTargetActor for the 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._chromeActor.form() };
+ return { form: this._parentProcessTargetActor.form() };
}
const { id } = request;
const mm = Services.ppmm.getChildAt(id);
if (!mm) {
return { error: "noProcess",
message: "There is no process with id '" + id + "'." };
}
--- a/devtools/server/actors/targets/browsing-context.js
+++ b/devtools/server/actors/targets/browsing-context.js
@@ -5,17 +5,18 @@
"use strict";
/* global XPCNativeWrapper */
/*
* BrowsingContextTargetActor is an abstract class used by target actors that hold
* documents, such as frames, chrome windows, etc.
*
- * This class is extended by FrameTargetActor, ChromeActor, and ChromeWindowTargetActor.
+ * This class is extended by FrameTargetActor, ParentProcessTargetActor, and
+ * ChromeWindowTargetActor.
*
* See devtools/docs/backend/actor-hierarchy.md for more details.
*
* For performance matters, this file should only be loaded in the targeted context's
* process. For example, it shouldn't be evaluated in the parent process until we try to
* debug a document living in the parent process.
*/
@@ -229,17 +230,17 @@ const browsingContextTargetPrototype = {
this.makeDebugger = makeDebugger.bind(null, {
findDebuggees: () => {
return this.windows.concat(this.webextensionsContentScriptGlobals);
},
shouldAddNewGlobalAsDebuggee: this._shouldAddNewGlobalAsDebuggee
});
// Flag eventually overloaded by sub classes in order to watch new docshells
- // Used by the ChromeActor to list all frames in the Browser Toolbox
+ // Used by the ParentProcessTargetActor to list all frames in the Browser Toolbox
this.listenForNewDocShells = false;
this.traits = {
reconfigure: true,
// Supports frame listing via `listFrames` request and `frameUpdate` events
// as well as frame switching via `switchToFrame` request
frames: true,
// Do not require to send reconfigure request to reset the document state
@@ -776,17 +777,17 @@ const browsingContextTargetPrototype = {
if (webProgress.DOMWindow == this.window &&
this.window != this._originalWindow) {
this._changeTopLevelDocument(this._originalWindow);
}
},
_isRootDocShell(docShell) {
// Should report as root docshell:
- // - New top level window's docshells, when using ChromeActor against a
+ // - New top level window's docshells, when using ParentProcessTargetActor against a
// process. It allows tracking iframes of the newly opened windows
// like Browser console or new browser windows.
// - MozActivities or window.open frames on B2G, where a new root docshell
// is spawn in the child process of the app.
return !docShell.parent;
},
_docShellToWindow(docShell) {
--- a/devtools/server/actors/targets/moz.build
+++ b/devtools/server/actors/targets/moz.build
@@ -4,10 +4,11 @@
# 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',
'frame-proxy.js',
'frame.js',
+ 'parent-process.js',
'worker.js',
)
rename from devtools/server/actors/chrome.js
rename to devtools/server/actors/targets/parent-process.js
--- a/devtools/server/actors/chrome.js
+++ b/devtools/server/actors/targets/parent-process.js
@@ -1,57 +1,64 @@
/* 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 the entire parent process.
+ *
+ * This actor extends BrowsingContextTargetActor.
+ * This actor is extended by WebExtensionChildActor.
+ *
+ * See devtools/docs/backend/actor-hierarchy.md for more details.
+ */
+
const { Ci } = require("chrome");
const Services = require("Services");
-const { DebuggerServer } = require("../main");
+const { DebuggerServer } = require("devtools/server/main");
const {
getChildDocShells,
BrowsingContextTargetActor,
browsingContextTargetPrototype
} = require("devtools/server/actors/targets/browsing-context");
-const makeDebugger = require("./utils/make-debugger");
+const makeDebugger = require("devtools/server/actors/utils/make-debugger");
const { extend } = require("devtools/shared/extend");
const { ActorClassWithSpec } = require("devtools/shared/protocol");
-const { browsingContextTargetSpec } = require("devtools/shared/specs/targets/browsing-context");
+const { parentProcessTargetSpec } = require("devtools/shared/specs/targets/parent-process");
/**
- * Creates a target actor for debugging all the chrome content in the current process.
- * Most of the implementation is inherited from BrowsingContextTargetActor. ChromeActor is
- * a child of RootActor, it can be instantiated via RootActor.getProcess request.
- * ChromeActor exposes all tab actors via its form() request, like
- * BrowsingContextTargetActor.
+ * Protocol.js expects only the prototype object, and does not maintain the prototype
+ * chain when it constructs the ActorClass. For this reason we are using `extend` to
+ * maintain the properties of BrowsingContextTargetActor.prototype
+ */
+const parentProcessTargetPrototype = extend({}, browsingContextTargetPrototype);
+
+/**
+ * Creates a target actor for debugging all the chrome content in the parent process.
+ * Most of the implementation is inherited from BrowsingContextTargetActor.
+ * ParentProcessTargetActor is a child of RootActor, it can be instantiated via
+ * RootActor.getProcess request. ParentProcessTargetActor exposes all tab actors via its
+ * form() request, like BrowsingContextTargetActor.
*
* History lecture:
* All tab actors used to also be registered as global actors, so that the root actor was
* also exposing tab actors for the main process. Tab actors ended up having RootActor as
* parent actor, but more and more features of the tab actors were relying on
* BrowsingContextTargetActor. So we are now exposing a process actor that offers the same
* API as BrowsingContextTargetActor by inheriting its functionality. Global actors are
* now only the actors that are meant to be global, and are no longer related to any
* specific scope/document.
*
* @param connection DebuggerServerConnection
* The connection to the client.
*/
-
-/**
- * Protocol.js expects only the prototype object, and does not maintain the prototype
- * chain when it constructs the ActorClass. For this reason we are using `extend` to
- * maintain the properties of BrowsingContextTargetActor.prototype
- * */
-
-const chromePrototype = extend({}, browsingContextTargetPrototype);
-
-chromePrototype.initialize = function(connection) {
+parentProcessTargetPrototype.initialize = function(connection) {
BrowsingContextTargetActor.prototype.initialize.call(this, connection);
// This creates a Debugger instance for chrome debugging all globals.
this.makeDebugger = makeDebugger.bind(null, {
findDebuggees: dbg => dbg.findAllGlobals(),
shouldAddNewGlobalAsDebuggee: () => true
});
@@ -82,55 +89,55 @@ chromePrototype.initialize = function(co
.getInterface(Ci.nsIDocShell)
: null;
Object.defineProperty(this, "docShell", {
value: docShell,
configurable: true
});
};
-chromePrototype.isRootActor = true;
+parentProcessTargetPrototype.isRootActor = true;
/**
* Getter for the list of all docshells in this targetActor
* @return {Array}
*/
-Object.defineProperty(chromePrototype, "docShells", {
+Object.defineProperty(parentProcessTargetPrototype, "docShells", {
get: function() {
// Iterate over all top-level windows and all their docshells.
let docShells = [];
const e = Services.ww.getWindowEnumerator();
while (e.hasMoreElements()) {
const window = e.getNext();
const docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
docShells = docShells.concat(getChildDocShells(docShell));
}
return docShells;
}
});
-chromePrototype.observe = function(subject, topic, data) {
+parentProcessTargetPrototype.observe = function(subject, topic, data) {
BrowsingContextTargetActor.prototype.observe.call(this, subject, topic, data);
if (!this.attached) {
return;
}
subject.QueryInterface(Ci.nsIDocShell);
if (topic == "chrome-webnavigation-create") {
this._onDocShellCreated(subject);
} else if (topic == "chrome-webnavigation-destroy") {
this._onDocShellDestroy(subject);
}
};
-chromePrototype._attach = function() {
+parentProcessTargetPrototype._attach = function() {
if (this.attached) {
return false;
}
BrowsingContextTargetActor.prototype._attach.call(this);
// Listen for any new/destroyed chrome docshell
Services.obs.addObserver(this, "chrome-webnavigation-create");
@@ -146,17 +153,17 @@ chromePrototype._attach = function() {
if (docShell == this.docShell) {
continue;
}
this._progressListener.watch(docShell);
}
return undefined;
};
-chromePrototype._detach = function() {
+parentProcessTargetPrototype._detach = function() {
if (!this.attached) {
return false;
}
Services.obs.removeObserver(this, "chrome-webnavigation-create");
Services.obs.removeObserver(this, "chrome-webnavigation-destroy");
// Iterate over all top-level windows.
@@ -176,38 +183,38 @@ chromePrototype._detach = function() {
return undefined;
};
/* ThreadActor hooks. */
/**
* Prepare to enter a nested event loop by disabling debuggee events.
*/
-chromePrototype.preNest = function() {
+parentProcessTargetPrototype.preNest = function() {
// Disable events in all open windows.
const e = Services.wm.getEnumerator(null);
while (e.hasMoreElements()) {
const win = e.getNext();
const windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowUtils.suppressEventHandling(true);
windowUtils.suspendTimeouts();
}
};
/**
* Prepare to exit a nested event loop by enabling debuggee events.
*/
-chromePrototype.postNest = function(nestData) {
+parentProcessTargetPrototype.postNest = function(nestData) {
// Enable events in all open windows.
const e = Services.wm.getEnumerator(null);
while (e.hasMoreElements()) {
const win = e.getNext();
const windowUtils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
windowUtils.resumeTimeouts();
windowUtils.suppressEventHandling(false);
}
};
-chromePrototype.typeName = "Chrome";
-exports.chromePrototype = chromePrototype;
-exports.ChromeActor = ActorClassWithSpec(browsingContextTargetSpec, chromePrototype);
+exports.parentProcessTargetPrototype = parentProcessTargetPrototype;
+exports.ParentProcessTargetActor =
+ ActorClassWithSpec(parentProcessTargetSpec, parentProcessTargetPrototype);
--- a/devtools/server/actors/webextension.js
+++ b/devtools/server/actors/webextension.js
@@ -3,69 +3,72 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { extend } = require("devtools/shared/extend");
const { Ci, Cu, Cc } = require("chrome");
const Services = require("Services");
-const { ChromeActor, chromePrototype } = require("./chrome");
+const {
+ ParentProcessTargetActor,
+ parentProcessTargetPrototype,
+} = require("devtools/server/actors/targets/parent-process");
const makeDebugger = require("./utils/make-debugger");
const { ActorClassWithSpec } = require("devtools/shared/protocol");
const { browsingContextTargetSpec } = require("devtools/shared/specs/targets/browsing-context");
loader.lazyRequireGetter(this, "unwrapDebuggerObjectGlobal", "devtools/server/actors/thread", true);
loader.lazyRequireGetter(this, "ChromeUtils");
const FALLBACK_DOC_MESSAGE = "Your addon does not have any document opened yet.";
/**
* Creates a target actor for debugging all the contexts associated to a target
* WebExtensions add-on running in a child extension process. Most of the implementation
- * is inherited from ChromeActor (which inherits most of its implementation from
- * BrowsingContextTargetActor).
+ * is inherited from ParentProcessTargetActor (which inherits most of its implementation
+ * from BrowsingContextTargetActor).
*
* WebExtensionChildActor is created by a WebExtensionParentActor counterpart, when its
* parent actor's `connect` method has been called (on the listAddons RDP package),
* it runs in the same process that the extension is running into (which can be the main
* process if the extension is running in non-oop mode, or the child extension process
* if the extension is running in oop-mode).
*
- * A WebExtensionChildActor contains all tab actors, like a regular ChromeActor
- * or BrowsingContextTargetActor.
+ * A WebExtensionChildActor contains all tab actors, like a regular
+ * ParentProcessTargetActor or BrowsingContextTargetActor.
*
* History lecture:
* - The add-on actors used to not inherit BrowsingContextTargetActor because of the
* different way the add-on APIs where exposed to the add-on itself, and for this reason
* the Addon Debugger has only a sub-set of the feature available in the Tab or in the
* Browser Toolbox.
* - In a WebExtensions add-on all the provided contexts (background, popups etc.),
* besides the Content Scripts which run in the content process, hooked to an existent
- * tab, by creating a new WebExtensionActor which inherits from ChromeActor, we can
- * provide a full features Addon Toolbox (which is basically like a BrowserToolbox which
- * filters the visible sources and frames to the one that are related to the target
- * add-on).
+ * tab, by creating a new WebExtensionActor which inherits from
+ * ParentProcessTargetActor, we can provide a full features Addon Toolbox (which is
+ * basically like a BrowserToolbox which filters the visible sources and frames to the
+ * one that are related to the target add-on).
* - When the WebExtensions OOP mode has been introduced, this actor has been refactored
* and moved from the main process to the new child extension process.
*
* @param {DebuggerServerConnection} conn
* The connection to the client.
* @param {nsIMessageSender} chromeGlobal.
* The chromeGlobal where this actor has been injected by the
* DebuggerServer.connectToFrame method.
* @param {string} prefix
* the custom RDP prefix to use.
* @param {string} addonId
* the addonId of the target WebExtension.
*/
-const webExtensionChildPrototype = extend({}, chromePrototype);
+const webExtensionChildPrototype = extend({}, parentProcessTargetPrototype);
webExtensionChildPrototype.initialize = function(conn, chromeGlobal, prefix, addonId) {
- chromePrototype.initialize.call(this, conn);
+ parentProcessTargetPrototype.initialize.call(this, conn);
this._chromeGlobal = chromeGlobal;
this._prefix = prefix;
this.id = addonId;
// Redefine the messageManager getter to return the chromeGlobal
// as the messageManager for this actor (which is the browser XUL
// element used by the parent actor running in the main process to
// connect to the extension process).
@@ -130,17 +133,17 @@ webExtensionChildPrototype.exit = functi
chromeGlobal.sendAsyncMessage("debug:webext_child_exit", {
actor: this.actorID
});
}
this.addon = null;
this.id = null;
- return ChromeActor.prototype.exit.apply(this);
+ return ParentProcessTargetActor.prototype.exit.apply(this);
};
// Private helpers.
webExtensionChildPrototype._createFallbackWindow = function() {
if (this.fallbackWindow) {
// Skip if there is already an existent fallback window.
return;
@@ -183,17 +186,17 @@ webExtensionChildPrototype._searchForExt
if (window.document.nodePrincipal.addonId == this.id) {
return window;
}
}
return undefined;
};
-// Customized ChromeActor/BrowsingContextTargetActor hooks.
+// Customized ParentProcessTargetActor/BrowsingContextTargetActor hooks.
webExtensionChildPrototype._onDocShellDestroy = function(docShell) {
// Stop watching this docshell (the unwatch() method will check if we
// started watching it before).
this._unwatchDocShell(docShell);
// Let the _onDocShellDestroy notify that the docShell has been destroyed.
const webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
@@ -211,49 +214,52 @@ webExtensionChildPrototype._onDocShellDe
webExtensionChildPrototype._onNewExtensionWindow = function(window) {
if (!this.window || this.window === this.fallbackWindow) {
this._changeTopLevelDocument(window);
}
};
webExtensionChildPrototype._attach = function() {
- // NOTE: we need to be sure that `this.window` can return a
- // window before calling the ChromeActor.onAttach, or the BrowsingContextTargetActor
- // will not be subscribed to the child doc shell updates.
+ // NOTE: we need to be sure that `this.window` can return a window before calling the
+ // ParentProcessTargetActor.onAttach, or the BrowsingContextTargetActor will not be
+ // subscribed to the child doc shell updates.
if (!this.window || this.window.document.nodePrincipal.addonId !== this.id) {
// Discovery an existent extension page to attach.
const extensionWindow = this._searchForExtensionWindow();
if (!extensionWindow) {
this._createFallbackWindow();
this._setWindow(this.fallbackWindow);
} else {
this._setWindow(extensionWindow);
}
}
- // Call ChromeActor's _attach to listen for any new/destroyed chrome docshell
- ChromeActor.prototype._attach.apply(this);
+ // Call ParentProcessTargetActor's _attach to listen for any new/destroyed chrome
+ // docshell.
+ ParentProcessTargetActor.prototype._attach.apply(this);
};
webExtensionChildPrototype._detach = function() {
- // Call ChromeActor's _detach to unsubscribe new/destroyed chrome docshell listeners.
- ChromeActor.prototype._detach.apply(this);
+ // Call ParentProcessTargetActor's _detach to unsubscribe new/destroyed chrome docshell
+ // listeners.
+ ParentProcessTargetActor.prototype._detach.apply(this);
// Stop watching for new extension windows.
this._destroyFallbackWindow();
};
/**
* Return the json details related to a docShell.
*/
webExtensionChildPrototype._docShellToWindow = function(docShell) {
- const baseWindowDetails = ChromeActor.prototype._docShellToWindow.call(this, docShell);
+ const baseWindowDetails =
+ ParentProcessTargetActor.prototype._docShellToWindow.call(this, docShell);
const webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
const window = webProgress.DOMWindow;
// Collect the addonID from the document origin attributes and its sameType top level
// frame.
const addonID = window.document.nodePrincipal.addonId;
@@ -268,17 +274,17 @@ webExtensionChildPrototype._docShellToWi
sameTypeRootAddonID,
});
};
/**
* Return an array of the json details related to an array/iterator of docShells.
*/
webExtensionChildPrototype._docShellsToWindows = function(docshells) {
- return ChromeActor.prototype._docShellsToWindows.call(this, docshells)
+ return ParentProcessTargetActor.prototype._docShellsToWindows.call(this, docshells)
.filter(windowDetails => {
// Filter the docShells based on the addon id of the window or
// its sameType top level frame.
return windowDetails.addonID === this.id ||
windowDetails.sameTypeRootAddonID === this.id;
});
};
--- a/devtools/server/performance/memory.js
+++ b/devtools/server/performance/memory.js
@@ -9,18 +9,17 @@ const { reportException } = require("dev
const { expectState } = require("devtools/server/actors/common");
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, "ChromeActor", "devtools/server/actors/chrome",
- true);
+loader.lazyRequireGetter(this, "ParentProcessTargetActor", "devtools/server/actors/targets/parent-process", true);
loader.lazyRequireGetter(this, "ChildProcessActor",
"devtools/server/actors/child-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.
@@ -139,17 +138,17 @@ Memory.prototype = {
* @param {Object|null} boundaries
*
* @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 ChromeActor ||
+ if (this.parent instanceof ParentProcessTargetActor ||
this.parent instanceof ChildProcessActor) {
boundaries = { runtime: true };
} else {
boundaries = { debugger: this.dbg };
}
}
return ChromeUtils.saveHeapSnapshotGetId(boundaries);
}, "saveHeapSnapshot"),
--- a/devtools/server/tests/unit/head_dbg.js
+++ b/devtools/server/tests/unit/head_dbg.js
@@ -115,17 +115,17 @@ function makeFullRuntimeMemoryActorTest(
do_test_pending();
startTestDebuggerServer("test_MemoryActor").then(client => {
DebuggerServer.registerModule("devtools/server/actors/heap-snapshot-file", {
prefix: "heapSnapshotFile",
constructor: "HeapSnapshotFileActor",
type: { global: true }
});
- getChromeActors(client).then(function(form) {
+ getParentProcessActors(client).then(function(form) {
if (!form) {
ok(false, "Could not attach to chrome actors");
return;
}
(async function() {
try {
const rootForm = await listTabs(client);
@@ -419,32 +419,32 @@ function startTestDebuggerServer(title,
function finishClient(client) {
client.close(function() {
DebuggerServer.destroy();
do_test_finished();
});
}
-// Create a server, connect to it and fetch target actors for the parent process;
+// Create a server, connect to it and fetch actors targeting the parent process;
// pass |callback| the debugger client and target actor form with all actor IDs.
-function get_chrome_actors(callback) {
+function get_parent_process_actors(callback) {
DebuggerServer.init();
DebuggerServer.registerAllActors();
DebuggerServer.allowChromeProcess = true;
const client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect()
.then(() => client.getProcess())
.then(response => {
callback(client, response.form);
});
}
-function getChromeActors(client, server = DebuggerServer) {
+function getParentProcessActors(client, server = DebuggerServer) {
server.allowChromeProcess = true;
return client.getProcess().then(response => response.form);
}
/**
* Takes a relative file path and returns the absolute file url for it.
*/
function getFileUrl(name, allowMissing = false) {
--- 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
-// ChromeActor or a ChildProcessActor.
+// ParentProcessTargetActor or a ChildProcessActor.
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/server/tests/unit/test_addon_reload.js
+++ b/devtools/server/tests/unit/test_addon_reload.js
@@ -50,17 +50,17 @@ async function reloadAddon(client, addon
function getSupportFile(path) {
const allowMissing = false;
return do_get_file(path, allowMissing);
}
add_task(async function testReloadExitedAddon() {
const client = await new Promise(resolve => {
- get_chrome_actors(client => resolve(client));
+ get_parent_process_actors(client => resolve(client));
});
// Install our main add-on to trigger reloads on.
const addonFile = getSupportFile("addons/web-extension");
const [installedAddon] = await Promise.all([
AddonManager.installTemporaryAddon(addonFile),
promiseWebExtensionStartup(),
]);
--- a/devtools/server/tests/unit/test_addons_actor.js
+++ b/devtools/server/tests/unit/test_addons_actor.js
@@ -5,17 +5,17 @@
"use strict";
const {AddonsFront} = require("devtools/shared/fronts/addons");
startupAddonsManager();
async function connect() {
const client = await new Promise(resolve => {
- get_chrome_actors(client => resolve(client));
+ get_parent_process_actors(client => resolve(client));
});
const root = await listTabs(client);
const addonsActor = root.addonsActor;
ok(addonsActor, "Got AddonsActor instance");
const addons = AddonsFront(client, {addonsActor});
return [client, addons];
}
--- a/devtools/server/tests/unit/test_promises_actor_attach.js
+++ b/devtools/server/tests/unit/test_promises_actor_attach.js
@@ -7,21 +7,21 @@
* Test that we can attach and detach to the PromisesActor under the correct
* states.
*/
const { PromisesFront } = require("devtools/shared/fronts/promises");
add_task(async function() {
const client = await startTestDebuggerServer("promises-actor-test");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testAttach(client, chromeActors);
+ await attachTab(client, parentProcessActors);
+ await testAttach(client, parentProcessActors);
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-actor-test");
ok(targetTab, "Found our target tab.");
const [ tabResponse ] = await attachTab(client, targetTab);
await testAttach(client, tabResponse);
--- a/devtools/server/tests/unit/test_promises_actor_exist.js
+++ b/devtools/server/tests/unit/test_promises_actor_exist.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-disable no-shadow */
"use strict";
/**
- * Test that the PromisesActor exists in the TabActors and ChromeActors.
+ * Test that the PromisesActor exists in the TabActors and ParentProcessTargetActors.
*/
add_task(async function() {
const client = await startTestDebuggerServer("promises-actor-test");
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-actor-test");
Assert.ok(targetTab, "Found our target tab.");
@@ -24,12 +24,12 @@ add_task(async function() {
Assert.equal(response.type, "tabAttached",
"Expect tabAttached in the response type.");
Assert.ok(typeof response.promisesActor === "string",
"Should have a tab context PromisesActor.");
resolve();
});
});
- const chromeActors = await getChromeActors(client);
- Assert.ok(typeof chromeActors.promisesActor === "string",
+ const parentProcessActors = await getParentProcessActors(client);
+ Assert.ok(typeof parentProcessActors.promisesActor === "string",
"Should have a chrome context PromisesActor.");
});
--- a/devtools/server/tests/unit/test_promises_actor_list_promises.js
+++ b/devtools/server/tests/unit/test_promises_actor_list_promises.js
@@ -8,21 +8,21 @@
"use strict";
const { PromisesFront } = require("devtools/shared/fronts/promises");
const SECRET = "MyLittleSecret";
add_task(async function() {
const client = await startTestDebuggerServer("promises-actor-test");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testListPromises(client, chromeActors, v =>
+ await attachTab(client, parentProcessActors);
+ await testListPromises(client, parentProcessActors, v =>
new Promise(resolve => resolve(v)));
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-actor-test");
ok(targetTab, "Found our target tab.");
await testListPromises(client, targetTab, v => {
const debuggee = DebuggerServer.getTestGlobal("promises-actor-test");
--- a/devtools/server/tests/unit/test_promises_actor_onnewpromise.js
+++ b/devtools/server/tests/unit/test_promises_actor_onnewpromise.js
@@ -9,23 +9,23 @@
"use strict";
const { PromisesFront } = require("devtools/shared/fronts/promises");
var EventEmitter = require("devtools/shared/event-emitter");
add_task(async function() {
const client = await startTestDebuggerServer("promises-actor-test");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise");
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testNewPromisesEvent(client, chromeActors,
+ await attachTab(client, parentProcessActors);
+ await testNewPromisesEvent(client, parentProcessActors,
v => new Promise(resolve => resolve(v)));
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-actor-test");
ok(targetTab, "Found our target tab.");
await testNewPromisesEvent(client, targetTab, v => {
const debuggee = DebuggerServer.getTestGlobal("promises-actor-test");
--- a/devtools/server/tests/unit/test_promises_actor_onpromisesettled.js
+++ b/devtools/server/tests/unit/test_promises_actor_onpromisesettled.js
@@ -11,23 +11,23 @@
ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", this);
const { PromisesFront } = require("devtools/shared/fronts/promises");
var EventEmitter = require("devtools/shared/event-emitter");
add_task(async function() {
const client = await startTestDebuggerServer("promises-actor-test");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise");
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testPromisesSettled(client, chromeActors,
+ await attachTab(client, parentProcessActors);
+ await testPromisesSettled(client, parentProcessActors,
v => new Promise(resolve => resolve(v)),
v => new Promise((resolve, reject) => reject(v)));
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-actor-test");
ok(targetTab, "Found our target tab.");
await testPromisesSettled(client, targetTab, v => {
--- a/devtools/server/tests/unit/test_promises_client_getdependentpromises.js
+++ b/devtools/server/tests/unit/test_promises_client_getdependentpromises.js
@@ -8,22 +8,22 @@
"use strict";
const { PromisesFront } = require("devtools/shared/fronts/promises");
var EventEmitter = require("devtools/shared/event-emitter");
add_task(async function() {
const client = await startTestDebuggerServer("test-promises-dependentpromises");
- const chromeActors = await getChromeActors(client);
- await attachTab(client, chromeActors);
+ const parentProcessActors = await getParentProcessActors(client);
+ await attachTab(client, parentProcessActors);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
- await testGetDependentPromises(client, chromeActors, () => {
+ await testGetDependentPromises(client, parentProcessActors, () => {
const p = new Promise(() => {});
p.name = "p";
const q = p.then();
q.name = "q";
const r = p.catch(() => {});
r.name = "r";
return p;
--- a/devtools/server/tests/unit/test_promises_object_creationtimestamp.js
+++ b/devtools/server/tests/unit/test_promises_object_creationtimestamp.js
@@ -18,23 +18,23 @@ add_task(async function() {
const timerPrecision = Preferences.get("privacy.reduceTimerPrecision");
Preferences.set("privacy.reduceTimerPrecision", false);
registerCleanupFunction(function() {
Preferences.set("privacy.reduceTimerPrecision", timerPrecision);
});
const client = await startTestDebuggerServer("promises-object-test");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testPromiseCreationTimestamp(client, chromeActors, v => {
+ await attachTab(client, parentProcessActors);
+ await testPromiseCreationTimestamp(client, parentProcessActors, v => {
return new Promise(resolve => resolve(v));
});
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "promises-object-test");
ok(targetTab, "Found our target tab.");
await testPromiseCreationTimestamp(client, targetTab, v => {
--- a/devtools/server/tests/unit/test_promises_object_timetosettle-01.js
+++ b/devtools/server/tests/unit/test_promises_object_timetosettle-01.js
@@ -9,23 +9,23 @@
"use strict";
const { PromisesFront } = require("devtools/shared/fronts/promises");
var EventEmitter = require("devtools/shared/event-emitter");
add_task(async function() {
const client = await startTestDebuggerServer("test-promises-timetosettle");
- const chromeActors = await getChromeActors(client);
+ const parentProcessActors = await getParentProcessActors(client);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testGetTimeToSettle(client, chromeActors, () => {
+ await attachTab(client, parentProcessActors);
+ await testGetTimeToSettle(client, parentProcessActors, () => {
const p = new Promise(() => {});
p.name = "p";
const q = p.then();
q.name = "q";
return p;
});
--- a/devtools/server/tests/unit/test_promises_object_timetosettle-02.js
+++ b/devtools/server/tests/unit/test_promises_object_timetosettle-02.js
@@ -10,24 +10,24 @@
const { PromisesFront } = require("devtools/shared/fronts/promises");
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm", {});
var EventEmitter = require("devtools/shared/event-emitter");
add_task(async function() {
const client = await startTestDebuggerServer("test-promises-timetosettle");
- const chromeActors = await getChromeActors(client);
- await attachTab(client, chromeActors);
+ const parentProcessActors = await getParentProcessActors(client);
+ await attachTab(client, parentProcessActors);
ok(Promise.toString().includes("native code"), "Expect native DOM Promise.");
// We have to attach the chrome target actor before playing with the PromiseActor
- await attachTab(client, chromeActors);
- await testGetTimeToSettle(client, chromeActors,
+ await attachTab(client, parentProcessActors);
+ await testGetTimeToSettle(client, parentProcessActors,
v => new Promise(resolve => setTimeout(() => resolve(v), 100)));
const response = await listTabs(client);
const targetTab = findTab(response.tabs, "test-promises-timetosettle");
ok(targetTab, "Found our target tab.");
await attachTab(client, targetTab);
await testGetTimeToSettle(client, targetTab, v => {
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -26,16 +26,17 @@ support-files =
setBreakpoint-on-line-with-multiple-statements.js
setBreakpoint-on-line-with-no-offsets.js
setBreakpoint-on-line-with-no-offsets-in-gcd-script.js
addons/web-extension/manifest.json
addons/web-extension-upgrade/manifest.json
addons/web-extension2/manifest.json
[test_addon_reload.js]
+skip-if = verify # verify mode causes AddonRepository shutdown errors
[test_addons_actor.js]
[test_animation_name.js]
[test_animation_type.js]
[test_actor-registry-actor.js]
[test_nesting-01.js]
[test_nesting-02.js]
[test_nesting-03.js]
[test_forwardingprefix.js]
--- a/devtools/shared/client/debugger-client.js
+++ b/devtools/shared/client/debugger-client.js
@@ -509,17 +509,17 @@ DebuggerClient.prototype = {
this.registerClient(traceClient);
}
onResponse(response, traceClient);
return [response, traceClient];
});
},
/**
- * Fetch the ChromeActor for the main process or ChildProcessActor for a
+ * Fetch the ParentProcessTargetActor for the main process or ChildProcessActor for a
* a given child 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 = {
--- a/devtools/shared/specs/index.js
+++ b/devtools/shared/specs/index.js
@@ -225,16 +225,21 @@ const Types = exports.__TypesForTests =
front: null,
},
{
types: ["frameTarget"],
spec: "devtools/shared/specs/targets/frame",
front: null,
},
{
+ types: ["parentProcessTarget"],
+ spec: "devtools/shared/specs/targets/parent-process",
+ front: null,
+ },
+ {
types: ["workerTarget"],
spec: "devtools/shared/specs/targets/worker",
front: null,
},
{
types: ["timeline"],
spec: "devtools/shared/specs/timeline",
front: "devtools/shared/fronts/timeline",
--- a/devtools/shared/specs/targets/moz.build
+++ b/devtools/shared/specs/targets/moz.build
@@ -3,10 +3,11 @@
# 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',
'frame.js',
+ 'parent-process.js',
'worker.js',
)
new file mode 100644
--- /dev/null
+++ b/devtools/shared/specs/targets/parent-process.js
@@ -0,0 +1,17 @@
+/* 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 parentProcessTargetSpec = generateActorSpec(extend(
+ browsingContextTargetSpecPrototype,
+ {
+ typeName: "parentProcessTarget",
+ }
+));
+
+exports.parentProcessTargetSpec = parentProcessTargetSpec;