Bug 1465637 - Rename tab-scoped actors to target-scoped actors. r=ochameau

The term "tab actor" was used ambiguously to mean either the "target actor
representing a tab" or "a child actor of the tab target actor" (such as the
console actor).  Here we rename the second case to "target-scoped actor".

Differential Revision: https://phabricator.services.mozilla.com/D1760

--HG--
rename : devtools/client/debugger/test/mochitest/browser_dbg_tabactor-01.js => devtools/client/debugger/test/mochitest/browser_dbg_target-scoped-actor-01.js
rename : devtools/client/debugger/test/mochitest/browser_dbg_tabactor-02.js => devtools/client/debugger/test/mochitest/browser_dbg_target-scoped-actor-02.js
This commit is contained in:
J. Ryan Stinnett 2018-06-26 13:27:57 +00:00
parent 7158cbfa29
commit ca90a5ef7b
52 changed files with 439 additions and 530 deletions

View File

@ -399,9 +399,9 @@ skip-if = (e10s && debug) || (os == 'linux' && bits == 32 && debug) # bug 132891
[browser_dbg_step-out.js]
uses-unsafe-cpows = true
skip-if = e10s && debug
[browser_dbg_tabactor-01.js]
[browser_dbg_target-scoped-actor-01.js]
skip-if = e10s # TODO
[browser_dbg_tabactor-02.js]
[browser_dbg_target-scoped-actor-02.js]
skip-if = e10s # TODO
[browser_dbg_terminate-on-tab-close.js]
uses-unsafe-cpows = true

View File

@ -25,7 +25,7 @@ function test() {
addTab(TAB_URL)
.then((aTab) => {
gTab = aTab;
return attachTabActorForUrl(gClient, TAB_URL);
return attachTargetActorForUrl(gClient, TAB_URL);
})
.then(testEarlyDebuggerStatement)
.then(testDebuggerStatement)

View File

@ -25,7 +25,7 @@ function test() {
gClient.listTabs().then(aResponse => {
let globalActor = aResponse.testGlobalActor1;
ok(globalActor, "Found the test tab actor.");
ok(globalActor, "Found the test global actor.");
ok(globalActor.includes("test_one"),
"testGlobalActor1's actorPrefix should be used.");
@ -49,7 +49,7 @@ function test() {
}
is(count, 2,
"Only two actor exists in all pools. One tab actor and one global.");
"Only two actor exists in all pools. One target-scoped actor and one global.");
gClient.close().then(finish);
});

View File

@ -39,8 +39,8 @@ function testFirstTab() {
return addTab(TAB1_URL).then(aTab => {
gTab1 = aTab;
return getTabActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(aGrip, "Should find a tab actor for the first tab.");
return getTargetActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(aGrip, "Should find a target actor for the first tab.");
gTab1Actor = aGrip.actor;
});
});
@ -50,10 +50,10 @@ function testSecondTab() {
return addTab(TAB2_URL).then(aTab => {
gTab2 = aTab;
return getTabActorForUrl(gClient, TAB1_URL).then(aFirstGrip => {
return getTabActorForUrl(gClient, TAB2_URL).then(aSecondGrip => {
return getTargetActorForUrl(gClient, TAB1_URL).then(aFirstGrip => {
return getTargetActorForUrl(gClient, TAB2_URL).then(aSecondGrip => {
is(aFirstGrip.actor, gTab1Actor, "First tab's actor shouldn't have changed.");
ok(aSecondGrip, "Should find a tab actor for the second tab.");
ok(aSecondGrip, "Should find a target actor for the second tab.");
gTab2Actor = aSecondGrip.actor;
});
});
@ -62,8 +62,8 @@ function testSecondTab() {
function testRemoveTab() {
return removeTab(gTab1).then(() => {
return getTabActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(!aGrip, "Shouldn't find a tab actor for the first tab anymore.");
return getTargetActorForUrl(gClient, TAB1_URL).then(aGrip => {
ok(!aGrip, "Shouldn't find a target actor for the first tab anymore.");
});
});
}
@ -73,7 +73,7 @@ function testAttachRemovedTab() {
let deferred = promise.defer();
gClient.addListener("paused", (aEvent, aPacket) => {
ok(false, "Attaching to an exited tab actor shouldn't generate a pause.");
ok(false, "Attaching to an exited target actor shouldn't generate a pause.");
deferred.reject();
});

View File

@ -1,8 +1,8 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/ */
"use strict";
/**
* Make sure the root actor's live tab list implementation works as specified.
*/
@ -51,9 +51,9 @@ function test() {
}
function checkSingleTab() {
return gTabList.getList().then(aTabActors => {
is(aTabActors.length, 1, "initial tab list: contains initial tab");
gFirstActor = aTabActors[0];
return gTabList.getList().then(targetActors => {
is(targetActors.length, 1, "initial tab list: contains initial tab");
gFirstActor = targetActors[0];
is(gFirstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'");
is(gFirstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'");
});
@ -68,13 +68,13 @@ function addTabA() {
function testTabA() {
is(onListChangedCount, 1, "onListChanged handler call count");
return gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 2, "gTabA opened: two tabs in list");
ok(tabActors.has(gFirstActor), "gTabA opened: initial tab present");
return gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 2, "gTabA opened: two tabs in list");
ok(targetActors.has(gFirstActor), "gTabA opened: initial tab present");
info("actors: " + [...tabActors].map(a => a.url));
gActorA = [...tabActors].filter(a => a !== gFirstActor)[0];
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabA opened: new tab URL");
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabA opened: new tab title");
});
@ -89,9 +89,9 @@ function addTabB() {
function testTabB() {
is(onListChangedCount, 2, "onListChanged handler call count");
return gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 3, "gTabB opened: three tabs in list");
return gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 3, "gTabB opened: three tabs in list");
});
}
@ -112,13 +112,13 @@ function removeTabA() {
function testTabClosed() {
is(onListChangedCount, 3, "onListChanged handler call count");
gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 2, "gTabA closed: two tabs in list");
ok(tabActors.has(gFirstActor), "gTabA closed: initial tab present");
gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 2, "gTabA closed: two tabs in list");
ok(targetActors.has(gFirstActor), "gTabA closed: initial tab present");
info("actors: " + [...tabActors].map(a => a.url));
gActorA = [...tabActors].filter(a => a !== gFirstActor)[0];
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabA closed: new tab URL");
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabA closed: new tab title");
});
@ -133,9 +133,9 @@ function addTabC() {
function testTabC() {
is(onListChangedCount, 4, "onListChanged handler call count");
gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 3, "gTabC opened: three tabs in list");
gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 3, "gTabC opened: three tabs in list");
});
}
@ -156,13 +156,13 @@ function removeTabC() {
function testNewWindow() {
is(onListChangedCount, 5, "onListChanged handler call count");
return gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 3, "gTabC closed: three tabs in list");
ok(tabActors.has(gFirstActor), "gTabC closed: initial tab present");
return gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 3, "gTabC closed: three tabs in list");
ok(targetActors.has(gFirstActor), "gTabC closed: initial tab present");
info("actors: " + [...tabActors].map(a => a.url));
gActorA = [...tabActors].filter(a => a !== gFirstActor)[0];
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gTabC closed: new tab URL");
is(gActorA.title, "JS Debugger BrowserTabList test page", "gTabC closed: new tab title");
});
@ -185,13 +185,13 @@ function removeNewWindow() {
function testWindowClosed() {
is(onListChangedCount, 6, "onListChanged handler call count");
return gTabList.getList().then(aTabActors => {
let tabActors = new Set(aTabActors);
is(tabActors.size, 2, "gNewWindow closed: two tabs in list");
ok(tabActors.has(gFirstActor), "gNewWindow closed: initial tab present");
return gTabList.getList().then(targetActors => {
targetActors = new Set(targetActors);
is(targetActors.size, 2, "gNewWindow closed: two tabs in list");
ok(targetActors.has(gFirstActor), "gNewWindow closed: initial tab present");
info("actors: " + [...tabActors].map(a => a.url));
gActorA = [...tabActors].filter(a => a !== gFirstActor)[0];
info("actors: " + [...targetActors].map(a => a.url));
gActorA = [...targetActors].filter(a => a !== gFirstActor)[0];
ok(gActorA.url.match(/^data:text\/html;/), "gNewWindow closed: new tab URL");
is(gActorA.title, "JS Debugger BrowserTabList test page", "gNewWindow closed: new tab title");
});

View File

@ -46,9 +46,9 @@ function testFirstTab(aTab) {
ok(!!gNewTab, "Second tab created.");
gClient.listTabs().then(aResponse => {
let tabActor = aResponse.tabs.filter(aGrip => aGrip.url == TAB1_URL).pop();
ok(tabActor,
"Should find a tab actor for the first tab.");
let targetActor = aResponse.tabs.filter(aGrip => aGrip.url == TAB1_URL).pop();
ok(targetActor,
"Should find a target actor for the first tab.");
is(aResponse.selected, 1,
"The first tab is selected.");

View File

@ -23,7 +23,7 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB1_URL)
.then(() => attachTabActorForUrl(gClient, TAB1_URL))
.then(() => attachTargetActorForUrl(gClient, TAB1_URL))
.then(testNavigate)
.then(testDetach)
.then(finish)

View File

@ -4,7 +4,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Check extension-added tab actor lifetimes.
* Check target-scoped actor lifetimes.
*/
const ACTORS_URL = CHROME_URL + "testactors.js";
@ -25,8 +25,8 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachTabActorForUrl(gClient, TAB_URL))
.then(testTabActor)
.then(() => attachTargetActorForUrl(gClient, TAB_URL))
.then(testTargetScopedActor)
.then(closeTab)
.then(() => gClient.close())
.then(finish)
@ -36,15 +36,15 @@ function test() {
});
}
function testTabActor([aGrip, aResponse]) {
function testTargetScopedActor([aGrip, aResponse]) {
let deferred = promise.defer();
ok(aGrip.testTabActor1,
"Found the test tab actor.");
ok(aGrip.testTabActor1.includes("test_one"),
"testTabActor1's actorPrefix should be used.");
ok(aGrip.testTargetScopedActor1,
"Found the test target-scoped actor.");
ok(aGrip.testTargetScopedActor1.includes("test_one"),
"testTargetScopedActor1's actorPrefix should be used.");
gClient.request({ to: aGrip.testTabActor1, type: "ping" }, aResponse => {
gClient.request({ to: aGrip.testTargetScopedActor1, type: "ping" }, aResponse => {
is(aResponse.pong, "pong",
"Actor should respond to requests.");

View File

@ -4,7 +4,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Check extension-added tab actor lifetimes.
* Check target-scoped actor lifetimes.
*/
const ACTORS_URL = CHROME_URL + "testactors.js";
@ -25,8 +25,8 @@ function test() {
"Root actor should identify itself as a browser.");
addTab(TAB_URL)
.then(() => attachTabActorForUrl(gClient, TAB_URL))
.then(testTabActor)
.then(() => attachTargetActorForUrl(gClient, TAB_URL))
.then(testTargetScopedActor)
.then(closeTab)
.then(() => gClient.close())
.then(finish)
@ -36,15 +36,15 @@ function test() {
});
}
function testTabActor([aGrip, aResponse]) {
function testTargetScopedActor([aGrip, aResponse]) {
let deferred = promise.defer();
ok(aGrip.testTabActor1,
"Found the test tab actor.");
ok(aGrip.testTabActor1.includes("test_one"),
"testTabActor1's actorPrefix should be used.");
ok(aGrip.testTargetScopedActor1,
"Found the test target-scoped actor.");
ok(aGrip.testTargetScopedActor1.includes("test_one"),
"testTargetScopedActor1's actorPrefix should be used.");
gClient.request({ to: aGrip.testTabActor1, type: "ping" }, aResponse => {
gClient.request({ to: aGrip.testTargetScopedActor1, type: "ping" }, aResponse => {
is(aResponse.pong, "pong",
"Actor should respond to requests.");
@ -60,11 +60,11 @@ function closeTab(aTestActor) {
try {
gClient.request({ to: aTestActor, type: "ping" }, aResponse => {
ok(false, "testTabActor1 didn't go away with the tab.");
ok(false, "testTargetScopedActor1 didn't go away with the tab.");
deferred.reject(aResponse);
});
} catch (e) {
is(e.message, "'ping' request packet has no destination.", "testTabActor1 went away.");
is(e.message, "'ping' request packet has no destination.", "testTargetScopedActor1 went away.");
deferred.resolve();
}

View File

@ -159,12 +159,12 @@ function removeAddon(aAddon) {
return deferred.promise;
}
function getTabActorForUrl(aClient, aUrl) {
function getTargetActorForUrl(aClient, aUrl) {
let deferred = promise.defer();
aClient.listTabs().then(aResponse => {
let tabActor = aResponse.tabs.filter(aGrip => aGrip.url == aUrl).pop();
deferred.resolve(tabActor);
let targetActor = aResponse.tabs.filter(aGrip => aGrip.url == aUrl).pop();
deferred.resolve(targetActor);
});
return deferred.promise;
@ -183,14 +183,14 @@ function getAddonActorForId(aClient, aAddonId) {
return deferred.promise;
}
async function attachTabActorForUrl(aClient, aUrl) {
let grip = await getTabActorForUrl(aClient, aUrl);
async function attachTargetActorForUrl(aClient, aUrl) {
let grip = await getTargetActorForUrl(aClient, aUrl);
let [ response ] = await aClient.attachTab(grip.actor);
return [grip, response];
}
async function attachThreadActorForUrl(aClient, aUrl) {
let [grip, response] = await attachTabActorForUrl(aClient, aUrl);
let [grip, response] = await attachTargetActorForUrl(aClient, aUrl);
let [response2, threadClient] = await aClient.attachThread(response.threadActor);
await threadClient.resume();
return threadClient;

View File

@ -25,13 +25,13 @@ TestActor1.prototype.requestTypes = {
"ping": TestActor1.prototype.onPing
};
DebuggerServer.removeTabActor("testTabActor1");
DebuggerServer.removeTargetScopedActor("testTargetScopedActor1");
DebuggerServer.removeGlobalActor("testGlobalActor1");
DebuggerServer.addTabActor({
DebuggerServer.addTargetScopedActor({
constructorName: "TestActor1",
constructorFun: TestActor1,
}, "testTabActor1");
}, "testTargetScopedActor1");
DebuggerServer.addGlobalActor({
constructorName: "TestActor1",
constructorFun: TestActor1,

View File

@ -105,7 +105,7 @@ var onConnectionReady = async function([aType, aTraits]) {
const response = await gClient.listTabs();
parent = document.getElementById("tabActors");
parent = document.getElementById("tabTargetActors");
// Add Global Process debugging...
const globals = Cu.cloneInto(response, {});
@ -158,7 +158,7 @@ var onConnectionReady = async function([aType, aTraits]) {
};
/**
* Build one button for an add-on actor.
* Build one button for an add-on.
*/
function buildAddonLink(addon, parent) {
const a = document.createElement("a");
@ -175,7 +175,7 @@ function buildAddonLink(addon, parent) {
}
/**
* Build one button for a tab actor.
* Build one button for a tab.
*/
function buildTabLink(tab, parent, selected) {
const a = document.createElement("a");

View File

@ -40,7 +40,7 @@
</section>
<section id="actors-list">
<p>&availableTabs;</p>
<ul class="actors" id="tabActors"></ul>
<ul class="actors" id="tabTargetActors"></ul>
<p>&availableAddons;</p>
<ul class="actors" id="addonTargetActors"></ul>
<p>&availableProcesses;</p>

View File

@ -80,7 +80,7 @@ exports.targetFromURL = async function targetFromURL(url) {
chrome = true;
if (id != 0) {
// 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
// set of target-scoped actors we would get from a browser tab. Instead, they only
// support debugger and console.
isBrowsingContext = false;
}

View File

@ -37,7 +37,7 @@ add_task(async function() {
const toolbox = await onToolboxReady;
const onToolboxDestroyed = gDevTools.once("toolbox-destroyed");
const onTabActorDetached = once(toolbox.target.client, "tabDetached");
const onTabDetached = once(toolbox.target.client, "tabDetached");
info("Removing the iframes");
toolboxIframe.remove();
@ -54,7 +54,7 @@ add_task(async function() {
// of toolbox cleanup. If we do not wait for it and starts removing debugged
// document, the actor is still considered as being attached and continues
// processing events.
await onTabActorDetached;
await onTabDetached;
iframe.remove();
});

View File

@ -15,7 +15,7 @@ const TAB_URL_2 = "data:text/html;charset=utf-8,bar";
var gClient;
var gTab1, gTab2;
var gTabActor1, gTabActor2;
var gTargetActor1, gTargetActor2;
function test() {
waitForExplicitFinish();
@ -39,14 +39,14 @@ function openTabs() {
}
function connect() {
// Connect to debugger server to fetch the two tab actors
// Connect to debugger server to fetch the two target actors for each tab
gClient = new DebuggerClient(DebuggerServer.connectPipe());
gClient.connect()
.then(() => gClient.listTabs())
.then(response => {
// Fetch the tab actors for each tab
gTabActor1 = response.tabs.filter(a => a.url === TAB_URL_1)[0];
gTabActor2 = response.tabs.filter(a => a.url === TAB_URL_2)[0];
// Fetch the target actors for each tab
gTargetActor1 = response.tabs.filter(a => a.url === TAB_URL_1)[0];
gTargetActor2 = response.tabs.filter(a => a.url === TAB_URL_2)[0];
checkGetTab();
});
@ -55,8 +55,8 @@ function connect() {
function checkGetTab() {
gClient.getTab({tab: gTab1})
.then(response => {
is(JSON.stringify(gTabActor1), JSON.stringify(response.tab),
"getTab returns the same tab grip for first tab");
is(JSON.stringify(gTargetActor1), JSON.stringify(response.tab),
"getTab returns the same target form for first tab");
})
.then(() => {
const filter = {};
@ -73,13 +73,13 @@ function checkGetTab() {
return gClient.getTab(filter);
})
.then(response => {
is(JSON.stringify(gTabActor1), JSON.stringify(response.tab),
"getTab returns the same tab grip when filtering by tabId/outerWindowID");
is(JSON.stringify(gTargetActor1), JSON.stringify(response.tab),
"getTab returns the same target form when filtering by tabId/outerWindowID");
})
.then(() => gClient.getTab({tab: gTab2}))
.then(response => {
is(JSON.stringify(gTabActor2), JSON.stringify(response.tab),
"getTab returns the same tab grip for second tab");
is(JSON.stringify(gTargetActor2), JSON.stringify(response.tab),
"getTab returns the same target form for second tab");
})
.then(checkGetTabFailures);
}
@ -101,13 +101,12 @@ function checkGetTabFailures() {
is(response.message, "Unable to find tab with outerWindowID '-999'");
}
)
.then(checkSelectedTabActor);
.then(checkSelectedTargetActor);
}
function checkSelectedTabActor() {
// Send a naive request to the second tab actor
// to check if it works
gClient.request({ to: gTabActor2.consoleActor, type: "startListeners", listeners: [] }, aResponse => {
function checkSelectedTargetActor() {
// Send a naive request to the second target actor to check if it works
gClient.request({ to: gTargetActor2.consoleActor, type: "startListeners", listeners: [] }, aResponse => {
ok("startedListeners" in aResponse, "Actor from the selected tab should respond to the request.");
closeSecondTab();
@ -118,15 +117,14 @@ function closeSecondTab() {
// Close the second tab, currently selected
const container = gBrowser.tabContainer;
container.addEventListener("TabClose", function() {
checkFirstTabActor();
checkFirstTargetActor();
}, {once: true});
gBrowser.removeTab(gTab2);
}
function checkFirstTabActor() {
// then send a request to the first tab actor
// to check if it still works
gClient.request({ to: gTabActor1.consoleActor, type: "startListeners", listeners: [] }, aResponse => {
function checkFirstTargetActor() {
// then send a request to the first target actor to check if it still works
gClient.request({ to: gTargetActor1.consoleActor, type: "startListeners", listeners: [] }, aResponse => {
ok("startedListeners" in aResponse, "Actor from the first tab should still respond.");
cleanup();

View File

@ -13,7 +13,6 @@ Services.scriptloader.loadSubScript(
var {getInplaceEditorForSpan: inplaceEditor} = require("devtools/client/shared/inplace-editor");
var clipboard = require("devtools/shared/platform/clipboard");
var {ActorRegistryFront} = require("devtools/shared/fronts/actor-registry");
// If a test times out we want to see the complete log and not just the last few
// lines.
@ -411,62 +410,6 @@ var getAttributesFromEditor = async function(selector, inspector) {
return [...nodeList].map(node => node.getAttribute("data-attr"));
};
/**
* Registers new backend tab actor.
*
* @param {DebuggerClient} client RDP client object (toolbox.target.client)
* @param {Object} options Configuration object with the following options:
*
* - moduleUrl {String}: URL of the module that contains actor implementation.
* - prefix {String}: prefix of the actor.
* - actorClass {ActorClassWithSpec}: Constructor object for the actor.
* - frontClass {FrontClassWithSpec}: Constructor object for the front part
* of the registered actor.
*
* @returns {Promise} A promise that is resolved when the actor is registered.
* The resolved value has two properties:
*
* - registrar {ActorActor}: A handle to the registered actor that allows
* unregistration.
* - form {Object}: The JSON actor form provided by the server.
*/
function registerTabActor(client, options) {
const moduleUrl = options.moduleUrl;
return client.listTabs().then(response => {
const config = {
prefix: options.prefix,
constructor: options.actorClass,
type: { tab: true },
};
// Register the custom actor on the backend.
const registry = ActorRegistryFront(client, response);
return registry.registerActor(moduleUrl, config).then(registrar => {
return client.getTab().then(tabResponse => ({
registrar: registrar,
form: tabResponse.tab
}));
});
});
}
/**
* A helper for unregistering an existing backend actor.
*
* @param {ActorActor} registrar A handle to the registered actor
* that has been received after registration.
* @param {Front} Corresponding front object.
*
* @returns A promise that is resolved when the unregistration
* has finished.
*/
function unregisterActor(registrar, front) {
return front.detach().then(() => {
return registrar.unregister();
});
}
/**
* Simulate dragging a MarkupContainer by calling its mousedown and mousemove
* handlers.

View File

@ -21,7 +21,7 @@
// Then ask to register our test-actor to retrieve its front
const options = {
type: { tab: true },
type: { target: true },
constructor: "TestActor",
prefix: "testActor"
};

View File

@ -167,11 +167,11 @@ HUD_SERVICE.prototype =
}
async function connect() {
// Ensure that the root actor and the tab actors have been registered on the
// DebuggerServer, so that the Browser Console can retrieve the console actors.
// Ensure that the root actor and the target-scoped actors have been registered on
// the DebuggerServer, so that the Browser Console can retrieve the console actors.
// (See Bug 1416105 for rationale).
DebuggerServer.init();
DebuggerServer.registerActors({ root: true, tab: true });
DebuggerServer.registerActors({ root: true, target: true });
DebuggerServer.allowChromeProcess = true;

View File

@ -28,11 +28,11 @@ RootActor: First one, automatically instantiated when we start connecting.
FrameTargetActor (for a frame, such as a tab)
WorkerTargetActor (for various kind of workers)
|
\-- Tab-scoped actors:
\-- Target-scoped actors:
Actors exposing one particular feature set. They are children of a
given target actor and the data they return is filtered to reflect
the target.
These actors are registered with `tab: true` in
These actors are registered with `target: true` in
devtools/server/main.js.
Examples include:
WebConsoleActor
@ -119,7 +119,7 @@ RootActor (root.js)
Those are the actors exposed by the root actors which are meant to track the
lifetime of a given target: tab, process, add-on, or worker. It also allows to
fetch the tab-scoped actors connected to this target, which are actors like
fetch the target-scoped actors connected to this target, which are actors like
console, inspector, thread (for debugger), style inspector, etc.
Some target actors inherit from BrowsingContextTargetActor (defined in
@ -133,10 +133,10 @@ to manage breakpoints in the debugger. Actors inheriting from
BrowsingContextTargetActor expose `attach`/`detach` requests, that allows to
start/stop the ThreadActor.
Tab-scoped actors are accessed via the target actor's RDP form which contains
the `actorID` for each tab-scoped actor.
Target-scoped actors are accessed via the target actor's RDP form which contains
the `actorID` for each target-scoped actor.
The tab-scoped actors expect to find the following properties on the target
The target-scoped actors expect to find the following properties on the target
actor:
- threadActor:
ThreadActor instance for the given target,
@ -168,7 +168,7 @@ expose many other attributes and events:
See BrowsingContextTargetActor documentation for more details.
## Tab-scoped actors
## Target-scoped actors
Each of these actors focuses on providing one particular feature set. They are
children of a given target actor.
@ -180,8 +180,8 @@ about the markup and styles for only that frame.
These actors may extend this hierarchy by having their own children, like
LongStringActor, WalkerActor, etc.
To improve performance, tab-scoped actors are created lazily. The target actor
lists the actor ID for each one, but the actor modules aren't actually loaded
and instantiated at that point. Once the first request for a given tab-scoped
actor is received by the server, that specific actor is instantiated just in
time to service the request.
To improve performance, target-scoped actors are created lazily. The target
actor lists the actor ID for each one, but the actor modules aren't actually
loaded and instantiated at that point. Once the first request for a given
target-scoped actor is received by the server, that specific actor is
instantiated just in time to service the request.

View File

@ -1,22 +1,22 @@
# How to register an actor
## Tab actors vs. global actors
## Target-scoped actors vs. global actors
Tab actors are the most common types of actors. That's the type of actors you will most probably be adding.
Target-scoped actors are the most common types of actors. That's the type of actors you will most probably be adding.
Tab actors target a document, this could be a tab in Firefox or a remote document in Firefox for Android.
Target-scoped actors target a document, this could be a tab in Firefox or a remote document in Firefox for Android.
Global actors however are for the rest, for things not related to any particular document but instead for things global to the whole Firefox/Chrome/Safari instance the toolbox is connected to (e.g. the preference actor).
## The DebuggerServer.registerModule function
To register a tab actor:
To register a target-scoped actor:
```
DebuggerServer.registerModule("devtools/server/actors/webconsole", {
prefix: "console",
constructor: "WebConsoleActor",
type: { tab: true }
type: { target: true }
});
```
@ -30,9 +30,7 @@ DebuggerServer.registerModule("devtools/server/actors/addon/addons", {
});
```
If you are adding a new built-in devtools actor, you should be registering it using `DebuggerServer.registerModule` in `_addBrowserActors` or `addTabActors` in `/devtools/server/main.js`.
If you are adding a new actor from an add-on, you should call `DebuggerServer.registerModule` directly from your add-on code.
If you are adding a new built-in actor, you should be registering it using `DebuggerServer.registerModule` in `_addBrowserActors` or `_addTargetScopedActors` in `/devtools/server/main.js`.
## A note about lazy registration

View File

@ -115,14 +115,14 @@ exports.ObservedActorFactory = ObservedActorFactory;
* |pool|.
*
* The root actor and the target actor use this to instantiate actors that other
* parts of the browser have specified with DebuggerServer.addTabActor and
* parts of the browser have specified with DebuggerServer.addTargetScopedActor and
* DebuggerServer.addGlobalActor.
*
* @param factories
* An object whose own property names are the names of properties to add to
* some reply packet (say, a target actor grip or the "listTabs" response
* form), and whose own property values are actor constructor functions, as
* documented for addTabActor and addGlobalActor.
* documented for addTargetScopedActor and addGlobalActor.
*
* @param this
* The RootActor or BrowsingContextTargetActor with which the new actors

View File

@ -13,8 +13,8 @@ loader.lazyRequireGetter(this, "StackFrameCache",
/**
* An actor that returns memory usage data for its parent actor's window.
* A tab-scoped instance of this actor will measure the memory footprint of its
* parent tab. A global-scoped instance however, will measure the memory
* A target-scoped instance of this actor will measure the memory footprint of
* the target, such as a tab. A global-scoped instance however, will measure the memory
* footprint of the chrome window referenced by the root actor.
*
* This actor wraps the Memory module at devtools/server/performance/memory.js

View File

@ -28,9 +28,9 @@ loader.lazyRequireGetter(this, "ChromeWindowTargetActor",
* root actor won't implement the corresponding requests or notifications.
* Supported properties:
*
* - tabList: a live list (see below) of tab actors. If present, the
* new root actor supports the 'listTabs' request, providing the live
* list's elements as its tab actors, and sending 'tabListChanged'
* - tabList: a live list (see below) of target actors for tabs. If present,
* the new root actor supports the 'listTabs' request, providing the live
* list's elements as its target actors, and sending 'tabListChanged'
* notifications when the live list's contents change. One actor in
* this list must have a true '.selected' property.
*
@ -219,7 +219,7 @@ RootActor.prototype = {
}
this._extraActors = null;
this.conn = null;
this._tabActorPool = null;
this._tabTargetActorPool = null;
this._globalActorPool = null;
this._chromeWindowActorPool = null;
this._parameters = null;
@ -273,27 +273,27 @@ RootActor.prototype = {
// listener in order to be notified if the list of tabs changes again in the future.
tabList.onListChanged = this._onTabListChanged;
// Walk the tab list, accumulating the array of tab actors for the reply, and moving
// all the actors to a new ActorPool. We'll replace the old tab actor pool with the
// one we build here, thus retiring any actors that didn't get listed again, and
// preparing any new actors to receive packets.
// Walk the tab list, accumulating the array of target actors for the reply, and
// moving all the actors to a new ActorPool. We'll replace the old tab target actor
// pool with the one we build here, thus retiring any actors that didn't get listed
// again, and preparing any new actors to receive packets.
const newActorPool = new ActorPool(this.conn);
const tabActorList = [];
const targetActorList = [];
let selected;
const options = request.options || {};
const tabActors = await tabList.getList(options);
for (const tabActor of tabActors) {
if (tabActor.exited) {
// Tab actor may have exited while we were gathering the list.
const targetActors = await tabList.getList(options);
for (const targetActor of targetActors) {
if (targetActor.exited) {
// Target actor may have exited while we were gathering the list.
continue;
}
if (tabActor.selected) {
selected = tabActorList.length;
if (targetActor.selected) {
selected = targetActorList.length;
}
tabActor.parentID = this.actorID;
newActorPool.addActor(tabActor);
tabActorList.push(tabActor);
targetActor.parentID = this.actorID;
newActorPool.addActor(targetActor);
targetActorList.push(targetActor);
}
// Start with the root reply, which includes the global actors for the whole browser.
@ -301,16 +301,16 @@ RootActor.prototype = {
// Drop the old actorID -> actor map. Actors that still mattered were added to the
// new map; others will go away.
if (this._tabActorPool) {
this.conn.removeActorPool(this._tabActorPool);
if (this._tabTargetActorPool) {
this.conn.removeActorPool(this._tabTargetActorPool);
}
this._tabActorPool = newActorPool;
this.conn.addActorPool(this._tabActorPool);
this._tabTargetActorPool = newActorPool;
this.conn.addActorPool(this._tabTargetActorPool);
// We'll extend the reply here to also mention all the tabs.
Object.assign(reply, {
selected: selected || 0,
tabs: tabActorList.map(actor => actor.form()),
tabs: targetActorList.map(actor => actor.form()),
});
return reply;
@ -322,14 +322,14 @@ RootActor.prototype = {
return { error: "noTabs",
message: "This root actor has no browser tabs." };
}
if (!this._tabActorPool) {
this._tabActorPool = new ActorPool(this.conn);
this.conn.addActorPool(this._tabActorPool);
if (!this._tabTargetActorPool) {
this._tabTargetActorPool = new ActorPool(this.conn);
this.conn.addActorPool(this._tabTargetActorPool);
}
let tabActor;
let targetActor;
try {
tabActor = await tabList.getTab(options);
targetActor = await tabList.getTab(options);
} catch (error) {
if (error.error) {
// Pipe expected errors as-is to the client
@ -341,10 +341,10 @@ RootActor.prototype = {
};
}
tabActor.parentID = this.actorID;
this._tabActorPool.addActor(tabActor);
targetActor.parentID = this.actorID;
this._tabTargetActorPool.addActor(targetActor);
return { tab: tabActor.form() };
return { tab: targetActor.form() };
},
onGetWindow: function({ outerWindowID }) {
@ -565,7 +565,7 @@ RootActor.prototype = {
/**
* Remove the extra actor (added by DebuggerServer.addGlobalActor or
* DebuggerServer.addTabActor) name |name|.
* DebuggerServer.addTargetScopedActor) name |name|.
*/
removeActorByName: function(name) {
if (name in this._extraActors) {
@ -573,10 +573,10 @@ RootActor.prototype = {
if (this._globalActorPool.has(actor)) {
this._globalActorPool.removeActor(actor);
}
if (this._tabActorPool) {
// Iterate over BrowsingContextTargetActor instances to also remove tab actors
// created during listTabs for each document.
this._tabActorPool.forEach(tab => {
if (this._tabTargetActorPool) {
// Iterate over BrowsingContextTargetActor instances to also remove target-scoped
// actors created during listTabs for each document.
this._tabTargetActorPool.forEach(tab => {
tab.removeActorByName(name);
});
}

View File

@ -107,10 +107,9 @@ const browsingContextTargetPrototype = {
* objects are presented to the user". In Gecko, this means a browsing context
* is a `docShell`.
*
* TODO: Bug 1465637: Rename "tab" actors to something else.
* The main goal of this class is to expose the tab actors being registered via
* `DebuggerServer.registerModule` and manage their lifetimes. In addition,
* this class also tracks the lifetime of the targeted browsing context.
* The main goal of this class is to expose the target-scoped actors being registered
* via `DebuggerServer.registerModule` and manage their lifetimes. In addition, this
* class also tracks the lifetime of the targeted browsing context.
*
* ### Main requests:
*
@ -122,7 +121,7 @@ const browsingContextTargetPrototype = {
* Instantiates a ThreadActor that can be later attached to in order to
* debug JS sources in the document.
* `switchToFrame`:
* Change the targeted document of the whole actor, and its child tab actors
* Change the targeted document of the whole actor, and its child target-scoped actors
* to an iframe or back to its original document.
*
* Most properties (like `chromeEventHandler` or `docShells`) are meant to be
@ -219,7 +218,6 @@ const browsingContextTargetPrototype = {
initialize: function(connection) {
Actor.prototype.initialize.call(this, connection);
this._tabActorPool = null;
// A map of actor names to actor instances provided by extensions.
this._extraActors = {};
this._exited = false;
@ -291,15 +289,8 @@ const browsingContextTargetPrototype = {
return this.conn._getOrCreateActor(form.consoleActor);
},
_tabPool: null,
get tabActorPool() {
return this._tabPool;
},
_targetScopedActorPool: null,
_contextPool: null,
get contextActorPool() {
return this._contextPool;
},
/**
* A constant prefix that will be used to form the actor ID by the server.
@ -491,16 +482,15 @@ const browsingContextTargetPrototype = {
// Always use the same ActorPool, so existing actor instances
// (created in createExtraActors) are not lost.
if (!this._tabActorPool) {
this._tabActorPool = new ActorPool(this.conn);
this.conn.addActorPool(this._tabActorPool);
if (!this._targetScopedActorPool) {
this._targetScopedActorPool = new ActorPool(this.conn);
this.conn.addActorPool(this._targetScopedActorPool);
}
// Walk over tab actor factories and make sure they are all
// instantiated and added into the ActorPool. Note that some
// factories can be added dynamically by extensions.
this._createExtraActors(DebuggerServer.tabActorFactories,
this._tabActorPool);
// Walk over target-scoped actor factories and make sure they are all
// instantiated and added into the ActorPool.
this._createExtraActors(DebuggerServer.targetScopedActorFactories,
this._targetScopedActorPool);
this._appendExtraActors(response);
return response;
@ -576,7 +566,7 @@ const browsingContextTargetPrototype = {
return false;
},
/* Support for DebuggerServer.addTabActor. */
/* Support for DebuggerServer.addTargetScopedActor. */
_createExtraActors: createExtraActors,
_appendExtraActors: appendExtraActors,
@ -588,12 +578,7 @@ const browsingContextTargetPrototype = {
return;
}
// Create a pool for tab-lifetime actors.
assert(!this._tabPool, "Shouldn't have a tab pool if we weren't attached.");
this._tabPool = new ActorPool(this.conn);
this.conn.addActorPool(this._tabPool);
// ... and a pool for context-lifetime actors.
// Create a pool for context-lifetime actors.
this._pushContext();
// on xpcshell, there is no document
@ -928,16 +913,11 @@ const browsingContextTargetPrototype = {
this._popContext();
// Shut down actors that belong to this tab's pool.
for (const sheetActor of this._styleSheetActors.values()) {
this._tabPool.removeActor(sheetActor);
}
// Shut down actors that belong to this target's pool.
this._styleSheetActors.clear();
this.conn.removeActorPool(this._tabPool);
this._tabPool = null;
if (this._tabActorPool) {
this.conn.removeActorPool(this._tabActorPool);
this._tabActorPool = null;
if (this._targetScopedActorPool) {
this.conn.removeActorPool(this._targetScopedActorPool);
this._targetScopedActorPool = null;
}
// Make sure that no more workerListChanged notifications are sent.
@ -1477,7 +1457,7 @@ const browsingContextTargetPrototype = {
const actor = new StyleSheetActor(styleSheet, this);
this._styleSheetActors.set(styleSheet, actor);
this._tabPool.addActor(actor);
this._targetScopedActorPool.addActor(actor);
this.emit("stylesheet-added", actor);
return actor;
@ -1486,8 +1466,8 @@ const browsingContextTargetPrototype = {
removeActorByName(name) {
if (name in this._extraActors) {
const actor = this._extraActors[name];
if (this._tabActorPool.has(actor)) {
this._tabActorPool.removeActor(actor);
if (this._targetScopedActorPool.has(actor)) {
this._targetScopedActorPool.removeActor(actor);
}
delete this._extraActors[name];
}

View File

@ -41,7 +41,7 @@ const chromeWindowTargetPrototype = extend({}, browsingContextTargetPrototype);
* this at the moment, it's named to match.
*
* Most of the implementation is inherited from BrowsingContextTargetActor.
* ChromeWindowTargetActor exposes all tab actors via its form() request, like
* ChromeWindowTargetActor exposes all target-scoped actors via its form() request, like
* BrowsingContextTargetActor.
*
* You can request a specific window's actor via RootActor.getWindow().

View File

@ -38,17 +38,8 @@ 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.
* RootActor.getProcess request. ParentProcessTargetActor exposes all target-scoped actors
* via its form() request, like BrowsingContextTargetActor.
*
* @param connection DebuggerServerConnection
* The connection to the client.

View File

@ -47,7 +47,7 @@ const webExtensionTargetPrototype = extend({}, parentProcessTargetPrototype);
* process if the extension is running in non-oop mode, or the child extension process
* if the extension is running in oop-mode).
*
* A WebExtensionTargetActor contains all tab actors, like a regular
* A WebExtensionTargetActor contains all target-scoped actors, like a regular
* ParentProcessTargetActor or BrowsingContextTargetActor.
*
* History lecture:

View File

@ -1,5 +1,3 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ft=javascript ts=2 et sw=2 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/. */
@ -47,8 +45,8 @@ exports.registerActorInCurrentProcess = function(sourceText, fileName, options)
}, prefix);
}
if (type.tab && !DebuggerServer.tabActorFactories.hasOwnProperty(prefix)) {
DebuggerServer.addTabActor({
if (type.target && !DebuggerServer.targetScopedActorFactories.hasOwnProperty(prefix)) {
DebuggerServer.addTargetScopedActor({
constructorName: constructor,
constructorFun: sandbox[constructor]
}, prefix);
@ -67,8 +65,8 @@ exports.unregisterActor = function(options) {
};
exports.unregisterActorInCurrentProcess = function(options) {
if (options.tab) {
DebuggerServer.removeTabActor(options);
if (options.target) {
DebuggerServer.removeTargetScopedActor(options);
}
if (options.global) {

View File

@ -63,7 +63,7 @@ exports.sendShutdownEvent = sendShutdownEvent;
* Construct a root actor appropriate for use in a server running in a
* browser. The returned root actor:
* - respects the factories registered with DebuggerServer.addGlobalActor,
* - uses a BrowserTabList to supply tab actors,
* - uses a BrowserTabList to supply target actors for tabs,
* - sends all navigator:browser window documents a Debugger:Shutdown event
* when it exits.
*
@ -94,7 +94,7 @@ function createRootActor(connection) {
* list" interface.)
*
* @param connection DebuggerServerConnection
* The connection in which this list's tab actors may participate.
* The connection in which this list's target actors may participate.
*
* Some notes:
*
@ -121,14 +121,14 @@ function createRootActor(connection) {
* been closed.
*
* This means that TabOpen and TabClose events alone are not sufficient to
* maintain an accurate list of live tabs and mark tab actors as closed
* maintain an accurate list of live tabs and mark target actors as closed
* promptly. Our nsIWindowMediatorListener onCloseWindow handler must find and
* exit all actors for tabs that were in the closing window.
*
* Since this is a bit hairy, we don't make each individual attached tab actor
* responsible for noticing when it has been closed; we watch for that, and
* promise to call each actor's 'exit' method when it's closed, regardless of
* how we learn the news.
* Since this is a bit hairy, we don't make each individual attached target
* actor responsible for noticing when it has been closed; we watch for that,
* and promise to call each actor's 'exit' method when it's closed, regardless
* of how we learn the news.
*
* - nsIWindowMediator locks
*
@ -172,12 +172,12 @@ function BrowserTabList(connection) {
* window objects.
*
* This map's keys are "browser" XUL elements; it maps each browser element
* to the tab actor we've created for its content window, if we've created
* to the target actor we've created for its content window, if we've created
* one. This map serves several roles:
*
* - During iteration, we use it to find actors we've created previously.
*
* - On a TabClose event, we use it to find the tab's actor and exit it.
* - On a TabClose event, we use it to find the tab's target actor and exit it.
*
* - When the onCloseWindow handler is called, we iterate over it to find all
* tabs belonging to the closing XUL window, and exit them.

View File

@ -70,7 +70,7 @@ var gRegisteredModules = Object.create(null);
* destroyed.
*/
function ModuleAPI() {
let activeTabActors = new Set();
let activeTargetScopedActors = new Set();
let activeGlobalActors = new Set();
return {
@ -90,24 +90,24 @@ function ModuleAPI() {
activeGlobalActors.delete(factory);
},
// See DebuggerServer.addTabActor for a description.
addTabActor(factory, name) {
DebuggerServer.addTabActor(factory, name);
activeTabActors.add(factory);
// See DebuggerServer.addTargetScopedActor for a description.
addTargetScopedActor(factory, name) {
DebuggerServer.addTargetScopedActor(factory, name);
activeTargetScopedActors.add(factory);
},
// See DebuggerServer.removeTabActor for a description.
removeTabActor(factory) {
DebuggerServer.removeTabActor(factory);
activeTabActors.delete(factory);
// See DebuggerServer.removeTargetScopedActor for a description.
removeTargetScopedActor(factory) {
DebuggerServer.removeTargetScopedActor(factory);
activeTargetScopedActors.delete(factory);
},
// Destroy the module API object, unregistering any
// factories registered by the module.
destroy() {
for (const factory of activeTabActors) {
DebuggerServer.removeTabActor(factory);
for (const factory of activeTargetScopedActors) {
DebuggerServer.removeTargetScopedActor(factory);
}
activeTabActors = null;
activeTargetScopedActors = null;
for (const factory of activeGlobalActors) {
DebuggerServer.removeGlobalActor(factory);
}
@ -124,10 +124,10 @@ var DebuggerServer = {
_initialized: false,
// Flag to check if the content process server startup script was already loaded.
_contentProcessServerStartupScriptLoaded: false,
// Map of global actor names to actor constructors provided by extensions.
// Map of global actor names to actor constructors.
globalActorFactories: {},
// Map of tab actor names to actor constructors provided by extensions.
tabActorFactories: {},
// Map of target-scoped actor names to actor constructors.
targetScopedActorFactories: {},
LONG_STRING_LENGTH: 10000,
LONG_STRING_INITIAL_LENGTH: 1000,
@ -199,7 +199,7 @@ var DebuggerServer = {
this.closeAllListeners();
this.globalActorFactories = {};
this.tabActorFactories = {};
this.targetScopedActorFactories = {};
this._initialized = false;
dumpn("Debugger server is shut down.");
@ -229,11 +229,11 @@ var DebuggerServer = {
* @param browser boolean
* Registers all the parent process actors useful for debugging the
* runtime itself, like preferences and addons actors.
* @param tab boolean
* Registers all the tab actors like console, script, ... all useful
* @param target boolean
* Registers all the target-scoped actors like console, script, etc.
* for debugging a target context.
*/
registerActors({ root, browser, tab }) {
registerActors({ root, browser, target }) {
if (browser) {
this._addBrowserActors();
}
@ -242,8 +242,8 @@ var DebuggerServer = {
this.registerModule("devtools/server/actors/webbrowser");
}
if (tab) {
this._addTabActors();
if (target) {
this._addTargetScopedActors();
}
},
@ -251,7 +251,7 @@ var DebuggerServer = {
* Register all possible actors for this DebuggerServer.
*/
registerAllActors() {
this.registerActors({ root: true, browser: true, tab: true });
this.registerActors({ root: true, browser: true, target: true });
},
/**
@ -297,9 +297,9 @@ var DebuggerServer = {
* - "global"
* registers a global actor instance, if true.
* A global actor has the root actor as its parent.
* - "tab"
* registers a tab actor instance, if true.
* A new actor will be created for each tab and each app.
* - "target"
* registers a target-scoped actor instance, if true.
* A new actor will be created for each target, such as a tab.
*/
registerModule(id, options) {
if (id in gRegisteredModules) {
@ -317,9 +317,9 @@ var DebuggerServer = {
throw new Error(`Lazy actor definition for '${id}' requires a string ` +
`'constructor' option.`);
}
if (!("global" in type) && !("tab" in type)) {
if (!("global" in type) && !("target" in type)) {
throw new Error(`Lazy actor definition for '${id}' requires a dictionary ` +
`'type' option whose attributes can be 'global' or 'tab'.`);
`'type' option whose attributes can be 'global' or 'target'.`);
}
const name = prefix + "Actor";
const mod = {
@ -328,11 +328,11 @@ var DebuggerServer = {
constructorName: constructor,
type: type,
globalActor: type.global,
tabActor: type.tab
targetScopedActor: type.target
};
gRegisteredModules[id] = mod;
if (mod.tabActor) {
this.addTabActor(mod, name);
if (mod.targetScopedActor) {
this.addTargetScopedActor(mod, name);
}
if (mod.globalActor) {
this.addGlobalActor(mod, name);
@ -366,8 +366,8 @@ var DebuggerServer = {
}
// Lazy actors
if (mod.tabActor) {
this.removeTabActor(mod);
if (mod.targetScopedActor) {
this.removeTargetScopedActor(mod);
}
if (mod.globalActor) {
this.removeGlobalActor(mod);
@ -426,116 +426,116 @@ var DebuggerServer = {
},
/**
* Install tab actors.
* Install target-scoped actors.
*/
_addTabActors() {
_addTargetScopedActors() {
this.registerModule("devtools/server/actors/webconsole", {
prefix: "console",
constructor: "WebConsoleActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/inspector/inspector", {
prefix: "inspector",
constructor: "InspectorActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/call-watcher", {
prefix: "callWatcher",
constructor: "CallWatcherActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/canvas", {
prefix: "canvas",
constructor: "CanvasActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/webgl", {
prefix: "webgl",
constructor: "WebGLActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/webaudio", {
prefix: "webaudio",
constructor: "WebAudioActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/stylesheets", {
prefix: "styleSheets",
constructor: "StyleSheetsActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/storage", {
prefix: "storage",
constructor: "StorageActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/gcli", {
prefix: "gcli",
constructor: "GcliActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/memory", {
prefix: "memory",
constructor: "MemoryActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/framerate", {
prefix: "framerate",
constructor: "FramerateActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/reflow", {
prefix: "reflow",
constructor: "ReflowActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/css-properties", {
prefix: "cssProperties",
constructor: "CssPropertiesActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/csscoverage", {
prefix: "cssUsage",
constructor: "CSSUsageActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/timeline", {
prefix: "timeline",
constructor: "TimelineActor",
type: { tab: true }
type: { target: true }
});
if ("nsIProfiler" in Ci &&
!Services.prefs.getBoolPref("devtools.performance.new-panel-enabled", false)) {
this.registerModule("devtools/server/actors/performance", {
prefix: "performance",
constructor: "PerformanceActor",
type: { tab: true }
type: { target: true }
});
}
this.registerModule("devtools/server/actors/animation", {
prefix: "animations",
constructor: "AnimationsActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/promises", {
prefix: "promises",
constructor: "PromisesActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/emulation", {
prefix: "emulation",
constructor: "EmulationActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/addon/webextension-inspected-window", {
prefix: "webExtensionInspectedWindow",
constructor: "WebExtensionInspectedWindowActor",
type: { tab: true }
type: { target: true }
});
this.registerModule("devtools/server/actors/accessibility", {
prefix: "accessibility",
constructor: "AccessibilityActor",
type: { tab: true }
type: { target: true }
});
},
@ -737,7 +737,7 @@ var DebuggerServer = {
childTransport = null;
connection.cancelForwarding(prefix);
// ... and notify the child process to clean the tab actors.
// ... and notify the child process to clean the target-scoped actors.
try {
mm.sendAsyncMessage("debug:content-process-destroy");
} catch (e) {
@ -1013,8 +1013,8 @@ var DebuggerServer = {
// between e10s parent and child processes
const parentModules = [];
const onSetupInParent = function(msg) {
// We may have multiple connectToFrame instance running for the same tab
// and need to filter the messages.
// We may have multiple connectToFrame instance running for the same frame and
// need to filter the messages.
if (msg.json.prefix != connPrefix) {
return false;
}
@ -1112,7 +1112,7 @@ var DebuggerServer = {
childTransport = null;
connection.cancelForwarding(prefix);
// ... and notify the child process to clean the tab actors.
// ... and notify the child process to clean the target-scoped actors.
try {
// Bug 1169643: Ignore any exception as the child process
// may already be destroyed by now.
@ -1219,11 +1219,11 @@ var DebuggerServer = {
},
/**
* Registers handlers for new tab-scoped request types defined dynamically.
* This is used for example by add-ons to augment the functionality of the tab
* actor. Note that the name or actorPrefix of the request type is not allowed
* to clash with existing protocol packet properties, like 'title', 'url' or
* 'actor', since that would break the protocol.
* Registers handlers for new target-scoped request types defined dynamically.
*
* Note that the name or actorPrefix of the request type is not allowed to clash with
* existing protocol packet properties, like 'title', 'url' or 'actor', since that would
* break the protocol.
*
* @param actor object
* - constructorName: (required)
@ -1236,39 +1236,40 @@ var DebuggerServer = {
* @param name string
* The name of the new request type.
*/
addTabActor(actor, name) {
addTargetScopedActor(actor, name) {
if (!name) {
throw Error("addTabActor requires the `name` argument");
throw Error("addTargetScopedActor requires the `name` argument");
}
if (["title", "url", "actor"].includes(name)) {
throw Error(name + " is not allowed");
}
if (DebuggerServer.tabActorFactories.hasOwnProperty(name)) {
if (DebuggerServer.targetScopedActorFactories.hasOwnProperty(name)) {
throw Error(name + " already exists");
}
DebuggerServer.tabActorFactories[name] = new RegisteredActorFactory(actor, name);
DebuggerServer.targetScopedActorFactories[name] =
new RegisteredActorFactory(actor, name);
},
/**
* Unregisters the handler for the specified tab-scoped request type.
* This may be used for example by add-ons when shutting down or upgrading.
* When unregistering an existing tab actor remove related tab factory
* as well as all existing instances of the actor.
* Unregisters the handler for the specified target-scoped request type.
*
* When unregistering an existing target-scoped actor, we remove the actor factory as
* well as all existing instances of the actor.
*
* @param actor object, string
* In case of object:
* The `actor` object being given to related addTabActor call.
* The `actor` object being given to related addTargetScopedActor call.
* In case of string:
* The `name` string being given to related addTabActor call.
* The `name` string being given to related addTargetScopedActor call.
*/
removeTabActor(actorOrName) {
removeTargetScopedActor(actorOrName) {
let name;
if (typeof actorOrName == "string") {
name = actorOrName;
} else {
const actor = actorOrName;
for (const factoryName in DebuggerServer.tabActorFactories) {
const handler = DebuggerServer.tabActorFactories[factoryName];
for (const factoryName in DebuggerServer.targetScopedActorFactories) {
const handler = DebuggerServer.targetScopedActorFactories[factoryName];
if ((handler.name && handler.name == actor.name) ||
(handler.id && handler.id == actor.id)) {
name = factoryName;
@ -1279,7 +1280,7 @@ var DebuggerServer = {
if (!name) {
return;
}
delete DebuggerServer.tabActorFactories[name];
delete DebuggerServer.targetScopedActorFactories[name];
for (const connID of Object.getOwnPropertyNames(this._connections)) {
// DebuggerServerConnection in child process don't have rootActor
if (this._connections[connID].rootActor) {
@ -1289,12 +1290,11 @@ var DebuggerServer = {
},
/**
* Registers handlers for new browser-scoped request types defined
* dynamically. This is used for example by add-ons to augment the
* functionality of the root actor. Note that the name or actorPrefix of the
* request type is not allowed to clash with existing protocol packet
* properties, like 'from', 'tabs' or 'selected', since that would break the
* protocol.
* Registers handlers for new browser-scoped request types defined dynamically.
*
* Note that the name or actorPrefix of the request type is not allowed to clash with
* existing protocol packet properties, like 'from', 'tabs' or 'selected', since that
* would break the protocol.
*
* @param actor object
* - constructorName: (required)
@ -1322,9 +1322,9 @@ var DebuggerServer = {
/**
* Unregisters the handler for the specified browser-scoped request type.
* This may be used for example by add-ons when shutting down or upgrading.
* When unregistering an existing global actor remove related global factory
* as well as all existing instances of the actor.
*
* When unregistering an existing global actor, we remove the actor factory as well as
* all existing instances of the actor.
*
* @param actor object, string
* In case of object:

View File

@ -19,7 +19,7 @@ loader.lazyRequireGetter(this, "ContentProcessTargetActor", "devtools/server/act
/**
* 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
* Using a target-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.
*

View File

@ -39,7 +39,7 @@ function setupServer(mm) {
// For browser content toolbox, we do need a regular root actor and all tab
// actors, but don't need all the "browser actors" that are only useful when
// debugging the parent process via the browser toolbox.
DebuggerServer.registerActors({ root: true, tab: true });
DebuggerServer.registerActors({ root: true, target: true });
// Clean up things when the client disconnects
mm.addMessageListener("debug:content-process-destroy", function onDestroy() {

View File

@ -24,10 +24,10 @@ try {
const { DebuggerServer, ActorPool } = require("devtools/server/main");
DebuggerServer.init();
// We want a special server without any root actor and only tab actors.
// We want a special server without any root actor and only target-scoped actors.
// We are going to spawn a FrameTargetActor instance in the next few lines,
// it is going to act like a root actor without being one.
DebuggerServer.registerActors({ tab: true });
DebuggerServer.registerActors({ target: true });
const connections = new Map();

View File

@ -17,7 +17,7 @@ function test() {
const options = {
prefix: "helloActor",
constructor: "HelloActor",
type: { tab: true }
type: { target: true }
};
const registry = ActorRegistryFront(gClient, response);

View File

@ -67,7 +67,7 @@ function runTests() {
TestActor.prototype.requestTypes = {
"hello": TestActor.prototype.hello
};
DebuggerServer.addTabActor({
DebuggerServer.addTargetScopedActor({
constructorName: "TestActor",
constructorFun: TestActor,
}, "testActor");
@ -109,7 +109,7 @@ function runTests() {
}
function secondClient(firstActor) {
// Then fake a second one, that should spawn a new set of tab actors
// Then fake a second one, that should spawn a new set of target-scoped actors
const transport = DebuggerServer.connectPipe();
const conn = transport._serverConnection;
const client = new DebuggerClient(transport);

View File

@ -411,7 +411,7 @@ function initTestDebuggerServer(server = DebuggerServer) {
function startTestDebuggerServer(title, server = DebuggerServer) {
initTestDebuggerServer(server);
addTestGlobal(title);
DebuggerServer.registerActors({ tab: true });
DebuggerServer.registerActors({ target: true });
const transport = DebuggerServer.connectPipe();
const client = new DebuggerClient(transport);

View File

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PostInitTabActor(connection) {}
PostInitTabActor.prototype = {
actorPostfix: "postInitTab",
onPing(request) {
return { message: "pong" };
},
};
PostInitTabActor.prototype.requestTypes = {
"ping": PostInitTabActor.prototype.onPing,
};
DebuggerServer.addTabActor({
constructorName: "PostInitTabActor",
constructorFun: PostInitTabActor,
}, "postInitTabActor");

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PostInitTargetScopedActor(connection) {}
PostInitTargetScopedActor.prototype = {
actorPostfix: "postInitTab",
onPing(request) {
return { message: "pong" };
},
};
PostInitTargetScopedActor.prototype.requestTypes = {
"ping": PostInitTargetScopedActor.prototype.onPing,
};
DebuggerServer.addTargetScopedActor({
constructorName: "PostInitTargetScopedActor",
constructorFun: PostInitTargetScopedActor,
}, "postInitTargetScopedActor");

View File

@ -1,25 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PreInitTabActor(connection) {}
PreInitTabActor.prototype = {
actorPrefix: "preInitTab",
onPing(request) {
return { message: "pong" };
},
};
PreInitTabActor.prototype.requestTypes = {
"ping": PreInitTabActor.prototype.onPing,
};
DebuggerServer.addTabActor({
constructorName: "PreInitTabActor",
constructorFun: PreInitTabActor,
}, "preInitTabActor");

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Uses the same scope as test_add_actors.js
/* import-globals-from head_dbg.js */
function PreInitTargetScopedActor(connection) {}
PreInitTargetScopedActor.prototype = {
actorPrefix: "preInitTab",
onPing(request) {
return { message: "pong" };
},
};
PreInitTargetScopedActor.prototype.requestTypes = {
"ping": PreInitTargetScopedActor.prototype.onPing,
};
DebuggerServer.addTargetScopedActor({
constructorName: "PreInitTargetScopedActor",
constructorFun: PreInitTargetScopedActor,
}, "preInitTargetScopedActor");

View File

@ -17,12 +17,12 @@ function getActorInstance(connID, actorID) {
*/
add_task(async function() {
DebuggerServer.addActors("resource://test/pre_init_global_actors.js");
DebuggerServer.addActors("resource://test/pre_init_tab_actors.js");
DebuggerServer.addActors("resource://test/pre_init_target_scoped_actors.js");
const client = await startTestDebuggerServer("example tab");
DebuggerServer.addActors("resource://test/post_init_global_actors.js");
DebuggerServer.addActors("resource://test/post_init_tab_actors.js");
DebuggerServer.addActors("resource://test/post_init_target_scoped_actors.js");
let actors = await client.listTabs();
Assert.equal(actors.tabs.length, 1);
@ -34,7 +34,7 @@ add_task(async function() {
Assert.equal(reply.message, "pong");
reply = await client.request({
to: actors.tabs[0].preInitTabActor,
to: actors.tabs[0].preInitTargetScopedActor,
type: "ping",
});
Assert.equal(reply.message, "pong");
@ -46,7 +46,7 @@ add_task(async function() {
Assert.equal(reply.message, "pong");
reply = await client.request({
to: actors.tabs[0].postInitTabActor,
to: actors.tabs[0].postInitTargetScopedActor,
type: "ping",
});
Assert.equal(reply.message, "pong");

View File

@ -5,7 +5,8 @@
"use strict";
/**
* Test that the PromisesActor exists in the TabActors and ParentProcessTargetActors.
* Test that the PromisesActor exists in the BrowsingContextTargetActors and
* ParentProcessTargetActors.
*/
add_task(async function() {

View File

@ -29,10 +29,10 @@ function test_lazy_api() {
DebuggerServer.registerModule("xpcshell-test/registertestactors-lazy", {
prefix: "lazy",
constructor: "LazyActor",
type: { global: true, tab: true }
type: { global: true, target: true }
});
// The actor is immediatly registered, but not loaded
Assert.ok(DebuggerServer.tabActorFactories.hasOwnProperty("lazyActor"));
Assert.ok(DebuggerServer.targetScopedActorFactories.hasOwnProperty("lazyActor"));
Assert.ok(DebuggerServer.globalActorFactories.hasOwnProperty("lazyActor"));
Assert.ok(!isActorLoaded);
Assert.ok(!isActorInstantiated);
@ -76,7 +76,7 @@ function cleanup() {
DebuggerServer.destroy();
// Check that all actors are unregistered on server destruction
Assert.ok(!DebuggerServer.tabActorFactories.hasOwnProperty("lazyActor"));
Assert.ok(!DebuggerServer.targetScopedActorFactories.hasOwnProperty("lazyActor"));
Assert.ok(!DebuggerServer.globalActorFactories.hasOwnProperty("lazyActor"));
run_next_test();

View File

@ -37,28 +37,28 @@ function TestTabList(connection) {
// An array of actors for each global added with
// DebuggerServer.addTestGlobal.
this._tabActors = [];
this._targetActors = [];
// A pool mapping those actors' names to the actors.
this._tabActorPool = new ActorPool(connection);
this._targetActorPool = new ActorPool(connection);
for (const global of gTestGlobals) {
const actor = new TestTabActor(connection, global);
const actor = new TestTargetActor(connection, global);
actor.selected = false;
this._tabActors.push(actor);
this._tabActorPool.addActor(actor);
this._targetActors.push(actor);
this._targetActorPool.addActor(actor);
}
if (this._tabActors.length > 0) {
this._tabActors[0].selected = true;
if (this._targetActors.length > 0) {
this._targetActors[0].selected = true;
}
connection.addActorPool(this._tabActorPool);
connection.addActorPool(this._targetActorPool);
}
TestTabList.prototype = {
constructor: TestTabList,
getList: function() {
return Promise.resolve([...this._tabActors]);
return Promise.resolve([...this._targetActors]);
}
};
@ -72,7 +72,7 @@ function createRootActor(connection) {
return root;
}
function TestTabActor(connection, global) {
function TestTargetActor(connection, global) {
this.conn = connection;
this._global = global;
this._global.wrappedJSObject = global;
@ -89,9 +89,9 @@ function TestTabActor(connection, global) {
});
}
TestTabActor.prototype = {
constructor: TestTabActor,
actorPrefix: "TestTabActor",
TestTargetActor.prototype = {
constructor: TestTargetActor,
actorPrefix: "TestTargetActor",
get window() {
return this._global;
@ -111,12 +111,12 @@ TestTabActor.prototype = {
form: function() {
const response = { actor: this.actorID, title: this._global.__name };
// Walk over tab actors added by extensions and add them to a new ActorPool.
// Walk over target-scoped actors and add them to a new ActorPool.
const actorPool = new ActorPool(this.conn);
this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
this._createExtraActors(DebuggerServer.targetScopedActorFactories, actorPool);
if (!actorPool.isEmpty()) {
this._tabActorPool = actorPool;
this.conn.addActorPool(this._tabActorPool);
this._targetActorPool = actorPool;
this.conn.addActorPool(this._targetActorPool);
}
this._appendExtraActors(response);
@ -149,21 +149,21 @@ TestTabActor.prototype = {
removeActorByName: function(name) {
const actor = this._extraActors[name];
if (this._tabActorPool) {
this._tabActorPool.removeActor(actor);
if (this._targetActorPool) {
this._targetActorPool.removeActor(actor);
}
delete this._extraActors[name];
},
/* Support for DebuggerServer.addTabActor. */
/* Support for DebuggerServer.addTargetScopedActor. */
_createExtraActors: createExtraActors,
_appendExtraActors: appendExtraActors
};
TestTabActor.prototype.requestTypes = {
"attach": TestTabActor.prototype.onAttach,
"detach": TestTabActor.prototype.onDetach,
"reload": TestTabActor.prototype.onReload
TestTargetActor.prototype.requestTypes = {
"attach": TestTargetActor.prototype.onAttach,
"detach": TestTargetActor.prototype.onDetach,
"reload": TestTargetActor.prototype.onReload
};
exports.register = function(handle) {

View File

@ -9,9 +9,9 @@ support-files =
source-map-data/sourcemapped.coffee
source-map-data/sourcemapped.map
post_init_global_actors.js
post_init_tab_actors.js
post_init_target_scoped_actors.js
pre_init_global_actors.js
pre_init_tab_actors.js
pre_init_target_scoped_actors.js
registertestactors-lazy.js
sourcemapped.js
testactors.js

View File

@ -11,9 +11,9 @@ const {arg, DebuggerClient} = require("devtools/shared/client/debugger-client");
loader.lazyRequireGetter(this, "ThreadClient", "devtools/shared/client/thread-client");
/**
* Creates a tab client for the remote debugging protocol server. This client
* is a front to the tab actor created in the server side, hiding the protocol
* details in a traditional JavaScript API.
* Creates a tab client for the remote debugging protocol server. This client is a front
* to the target actor for a tab created in the server side, hiding the protocol details
* in a traditional JavaScript API.
*
* @param client DebuggerClient
* The debugger client parent.
@ -65,7 +65,7 @@ TabClient.prototype = {
},
/**
* Detach the client from the tab actor.
* Detach the client from the target actor.
*/
detach: DebuggerClient.requester({
type: "detach"
@ -123,10 +123,10 @@ TabClient.prototype = {
}),
/**
* Reconfigure the tab actor.
* Reconfigure the target actor.
*
* @param object options
* A dictionary object of the new options to use in the tab actor.
* A dictionary object of the new options to use in the target actor.
*/
reconfigure: DebuggerClient.requester({
type: "reconfigure",

View File

@ -25,8 +25,8 @@ const noop = () => {};
* protocol details in a traditional JavaScript API.
*
* @param client DebuggerClient|TabClient
* The parent of the thread (tab for tab-scoped debuggers, DebuggerClient
* for chrome debuggers).
* The parent of the thread (tab for target-scoped debuggers,
* DebuggerClient for chrome debuggers).
* @param actor string
* The actor ID for this thread.
*/

View File

@ -27,28 +27,28 @@ function TestTabList(connection) {
// An array of actors for each global added with
// DebuggerServer.addTestGlobal.
this._tabActors = [];
this._targetActors = [];
// A pool mapping those actors' names to the actors.
this._tabActorPool = new ActorPool(connection);
this._targetActorPool = new ActorPool(connection);
for (const global of gTestGlobals) {
const actor = new TestTabActor(connection, global);
const actor = new TestTargetActor(connection, global);
actor.selected = false;
this._tabActors.push(actor);
this._tabActorPool.addActor(actor);
this._targetActors.push(actor);
this._targetActorPool.addActor(actor);
}
if (this._tabActors.length > 0) {
this._tabActors[0].selected = true;
if (this._targetActors.length > 0) {
this._targetActors[0].selected = true;
}
connection.addActorPool(this._tabActorPool);
connection.addActorPool(this._targetActorPool);
}
TestTabList.prototype = {
constructor: TestTabList,
getList: function() {
return promise.resolve([...this._tabActors]);
return promise.resolve([...this._targetActors]);
}
};
@ -61,7 +61,7 @@ function createRootActor(connection) {
return root;
}
function TestTabActor(connection, global) {
function TestTargetActor(connection, global) {
this.conn = connection;
this._global = global;
this._threadActor = new ThreadActor(this, this._global);
@ -70,9 +70,9 @@ function TestTabActor(connection, global) {
this._extraActors = {};
}
TestTabActor.prototype = {
constructor: TestTabActor,
actorPrefix: "TestTabActor",
TestTargetActor.prototype = {
constructor: TestTargetActor,
actorPrefix: "TestTargetActor",
get window() {
return { wrappedJSObject: this._global };
@ -85,12 +85,12 @@ TestTabActor.prototype = {
form: function() {
const response = { actor: this.actorID, title: this._global.__name };
// Walk over tab actors added by extensions and add them to a new ActorPool.
// Walk over target-scoped actors and add them to a new ActorPool.
const actorPool = new ActorPool(this.conn);
this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
this._createExtraActors(DebuggerServer.targetScopedActorFactories, actorPool);
if (!actorPool.isEmpty()) {
this._tabActorPool = actorPool;
this.conn.addActorPool(this._tabActorPool);
this._targetActorPool = actorPool;
this.conn.addActorPool(this._targetActorPool);
}
this._appendExtraActors(response);
@ -114,14 +114,14 @@ TestTabActor.prototype = {
return { type: "detached" };
},
/* Support for DebuggerServer.addTabActor. */
/* Support for DebuggerServer.addTargetScopedActor. */
_createExtraActors: createExtraActors,
_appendExtraActors: appendExtraActors
};
TestTabActor.prototype.requestTypes = {
"attach": TestTabActor.prototype.onAttach,
"detach": TestTabActor.prototype.onDetach
TestTargetActor.prototype.requestTypes = {
"attach": TestTargetActor.prototype.onAttach,
"detach": TestTargetActor.prototype.onDetach
};
exports.register = function(handle) {

View File

@ -94,7 +94,7 @@ function initTestDebuggerServer() {
DebuggerServer.registerModule("devtools/server/actors/thread", {
prefix: "script",
constructor: "ScriptActor",
type: { global: true, tab: true }
type: { global: true, target: true }
});
DebuggerServer.registerModule("xpcshell-test/testactors");
// Allow incoming connections.

View File

@ -26,28 +26,28 @@ function TestTabList(connection) {
// An array of actors for each global added with
// DebuggerServer.addTestGlobal.
this._tabActors = [];
this._targetActors = [];
// A pool mapping those actors' names to the actors.
this._tabActorPool = new ActorPool(connection);
this._targetActorPool = new ActorPool(connection);
for (const global of gTestGlobals) {
const actor = new TestTabActor(connection, global);
const actor = new TestTargetActor(connection, global);
actor.selected = false;
this._tabActors.push(actor);
this._tabActorPool.addActor(actor);
this._targetActors.push(actor);
this._targetActorPool.addActor(actor);
}
if (this._tabActors.length > 0) {
this._tabActors[0].selected = true;
if (this._targetActors.length > 0) {
this._targetActors[0].selected = true;
}
connection.addActorPool(this._tabActorPool);
connection.addActorPool(this._targetActorPool);
}
TestTabList.prototype = {
constructor: TestTabList,
getList: function() {
return promise.resolve([...this._tabActors]);
return promise.resolve([...this._targetActors]);
}
};
@ -60,7 +60,7 @@ function createRootActor(connection) {
return root;
}
function TestTabActor(connection, global) {
function TestTargetActor(connection, global) {
this.conn = connection;
this._global = global;
this._threadActor = new ThreadActor(this, this._global);
@ -69,9 +69,9 @@ function TestTabActor(connection, global) {
this._extraActors = {};
}
TestTabActor.prototype = {
constructor: TestTabActor,
actorPrefix: "TestTabActor",
TestTargetActor.prototype = {
constructor: TestTargetActor,
actorPrefix: "TestTargetActor",
get window() {
return { wrappedJSObject: this._global };
@ -84,12 +84,12 @@ TestTabActor.prototype = {
form: function() {
const response = { actor: this.actorID, title: this._global.__name };
// Walk over tab actors added by extensions and add them to a new ActorPool.
// Walk over target-scoped actors and add them to a new ActorPool.
const actorPool = new ActorPool(this.conn);
this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
this._createExtraActors(DebuggerServer.targetScopedActorFactories, actorPool);
if (!actorPool.isEmpty()) {
this._tabActorPool = actorPool;
this.conn.addActorPool(this._tabActorPool);
this._targetActorPool = actorPool;
this.conn.addActorPool(this._targetActorPool);
}
this._appendExtraActors(response);
@ -113,14 +113,14 @@ TestTabActor.prototype = {
return { type: "detached" };
},
/* Support for DebuggerServer.addTabActor. */
/* Support for DebuggerServer.addTargetScopedActor. */
_createExtraActors: createExtraActors,
_appendExtraActors: appendExtraActors
};
TestTabActor.prototype.requestTypes = {
"attach": TestTabActor.prototype.onAttach,
"detach": TestTabActor.prototype.onDetach
TestTargetActor.prototype.requestTypes = {
"attach": TestTargetActor.prototype.onAttach,
"detach": TestTargetActor.prototype.onDetach
};
exports.register = function(handle) {

View File

@ -38,7 +38,7 @@ module.exports = async function() {
DebuggerServer.registerModule("chrome://damp/content/tests/server/actor.js", {
prefix: "dampTest",
constructor: "DampTestActor",
type: { tab: true }
type: { target: true }
});
}`
) + ")()", true);