mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1497644 - Always call Root actor's getProcess request via RootClient.getProcess r=yulia
I also made its argument mandatory, so that later in root spec we can use a non-nullable number. MozReview-Commit-ID: BUPgI1ww1gC Differential Revision: https://phabricator.services.mozilla.com/D8141 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
3bb071595c
commit
cf0d0480eb
@ -63,7 +63,7 @@ add_task(async function() {
|
||||
const [type] = await gClient.connect();
|
||||
is(type, "browser", "Root actor should identify itself as a browser.");
|
||||
|
||||
const response = await gClient.getProcess();
|
||||
const response = await gClient.mainRoot.getProcess(0);
|
||||
let actor = response.form.actor;
|
||||
gThreadClient = await attachThread(gClient, actor);
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
|
||||
|
@ -29,7 +29,7 @@ function test() {
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
yield connect(client);
|
||||
let chrome = yield client.getProcess();
|
||||
let chrome = yield client.mainRoot.getProcess(0);
|
||||
let [, tabClient] = yield attachTarget(client, chrome.form);
|
||||
yield tabClient.attachThread();
|
||||
|
||||
|
@ -128,7 +128,7 @@ var onConnectionReady = async function([aType, aTraits]) {
|
||||
const a = document.createElement("a");
|
||||
a.onclick = function() {
|
||||
if (gClient.mainRoot.traits.allowChromeProcess) {
|
||||
gClient.getProcess()
|
||||
gClient.mainRoot.getProcess(0)
|
||||
.then(aResponse => {
|
||||
openToolbox(aResponse.form, true);
|
||||
});
|
||||
|
@ -318,7 +318,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
|
||||
const client = new DebuggerClient(transport);
|
||||
|
||||
await client.connect();
|
||||
const response = await client.getProcess(processId);
|
||||
const response = await client.mainRoot.getProcess(processId);
|
||||
const options = {
|
||||
form: response.form,
|
||||
client: client,
|
||||
|
@ -75,7 +75,7 @@ exports.targetFromURL = async function targetFromURL(url) {
|
||||
if (isNaN(id)) {
|
||||
id = 0;
|
||||
}
|
||||
const response = await client.getProcess(id);
|
||||
const response = await client.mainRoot.getProcess(id);
|
||||
form = response.form;
|
||||
chrome = true;
|
||||
} catch (ex) {
|
||||
|
@ -34,7 +34,7 @@ function getParentProcessActors(callback) {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect()
|
||||
.then(() => client.getProcess())
|
||||
.then(() => client.mainRoot.getProcess(0))
|
||||
.then(response => {
|
||||
callback(client, response.form);
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ var connect = async function() {
|
||||
const addonTargetActor = addons.filter(addon => addon.id === addonID).pop();
|
||||
await openToolbox({form: addonTargetActor, chrome: true});
|
||||
} else {
|
||||
const response = await gClient.getProcess();
|
||||
const response = await gClient.mainRoot.getProcess(0);
|
||||
await openToolbox({form: response.form, chrome: true});
|
||||
}
|
||||
};
|
||||
|
@ -2075,7 +2075,7 @@ ScratchpadWindow.prototype = extend(ScratchpadTab.prototype, {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await client.connect();
|
||||
const response = await client.getProcess();
|
||||
const response = await client.mainRoot.getProcess(0);
|
||||
return { form: response.form, client };
|
||||
}
|
||||
});
|
||||
|
@ -136,7 +136,7 @@ HUDService.prototype = {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await client.connect();
|
||||
const response = await client.getProcess();
|
||||
const response = await client.mainRoot.getProcess(0);
|
||||
return { form: response.form, client, chrome: true };
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ var AppManager = exports.AppManager = {
|
||||
if (this.selectedProject.type == "mainProcess") {
|
||||
// Fx >=39 exposes a ParentProcessTargetActor to debug the main process
|
||||
if (this.connection.client.mainRoot.traits.allowChromeProcess) {
|
||||
return this.connection.client.getProcess()
|
||||
return this.connection.client.mainRoot.getProcess(0)
|
||||
.then(aResponse => {
|
||||
return TargetFactory.forRemoteTab({
|
||||
form: aResponse.form,
|
||||
|
@ -85,7 +85,7 @@ function runTests() {
|
||||
// Connect to the first content processe available
|
||||
const content = response.processes.filter(p => (!p.parent))[0];
|
||||
|
||||
client.getProcess(content.id).then(({form: actor}) => {
|
||||
client.mainRoot.getProcess(content.id).then(({form: actor}) => {
|
||||
ok(actor.consoleActor, "Got the console actor");
|
||||
ok(actor.chromeDebugger, "Got the thread actor");
|
||||
|
||||
@ -106,7 +106,7 @@ function runTests() {
|
||||
// Assert that calling client.getProcess against the same process id is
|
||||
// returning the same actor.
|
||||
function getProcessAgain(firstActor, id) {
|
||||
client.getProcess(id).then(response => {
|
||||
client.mainRoot.getProcess(id).then(response => {
|
||||
const actor = response.form;
|
||||
is(actor, firstActor,
|
||||
"Second call to getProcess with the same id returns the same form");
|
||||
|
@ -443,7 +443,7 @@ function get_parent_process_actors(callback) {
|
||||
|
||||
const client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
client.connect()
|
||||
.then(() => client.getProcess())
|
||||
.then(() => client.mainRoot.getProcess(0))
|
||||
.then(response => {
|
||||
callback(client, response.form);
|
||||
});
|
||||
@ -451,7 +451,7 @@ function get_parent_process_actors(callback) {
|
||||
|
||||
function getParentProcessActors(client, server = DebuggerServer) {
|
||||
server.allowChromeProcess = true;
|
||||
return client.getProcess().then(response => response.form);
|
||||
return client.mainRoot.getProcess(0).then(response => response.form);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ add_task(async function() {
|
||||
equal(desc.geckobuildid, Services.appinfo.platformBuildID, "device actor works");
|
||||
|
||||
// Even though we have no tabs, getProcess gives us the chromeDebugger.
|
||||
const response = await client.getProcess();
|
||||
const response = await client.mainRoot.getProcess(0);
|
||||
|
||||
const { chromeDebugger } = response.form;
|
||||
const [, threadClient] = await client.attachThread(chromeDebugger);
|
||||
|
@ -487,25 +487,6 @@ DebuggerClient.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetch the ChromeActor 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 = {
|
||||
to: "root",
|
||||
type: "getProcess"
|
||||
};
|
||||
if (typeof (id) == "number") {
|
||||
packet.id = id;
|
||||
}
|
||||
return this.request(packet);
|
||||
},
|
||||
|
||||
/**
|
||||
* Release an object actor.
|
||||
*
|
||||
|
@ -105,6 +105,16 @@ RootClient.prototype = {
|
||||
*/
|
||||
listProcesses: DebuggerClient.requester({ type: "listProcesses" }),
|
||||
|
||||
/**
|
||||
* Fetch the ParentProcessTargetActor for the main process or ContentProcessTargetActor
|
||||
* 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 is 0.
|
||||
*/
|
||||
getProcess: DebuggerClient.requester({ type: "getProcess", id: arg(0) }),
|
||||
|
||||
/**
|
||||
* Retrieve all service worker registrations as well as workers from the parent and
|
||||
* content processes. Listing service workers involves merging information coming from
|
||||
@ -138,7 +148,7 @@ RootClient.prototype = {
|
||||
if (process.parent) {
|
||||
continue;
|
||||
}
|
||||
const { form } = await this._client.getProcess(process.id);
|
||||
const { form } = await this.getProcess(process.id);
|
||||
const processActor = form.actor;
|
||||
const response = await this._client.request({
|
||||
to: processActor,
|
||||
|
@ -78,7 +78,7 @@ var _attachConsole = async function(
|
||||
}
|
||||
|
||||
if (!attachToTab) {
|
||||
response = await state.dbgClient.getProcess();
|
||||
response = await state.dbgClient.mainRoot.getProcess(0);
|
||||
await state.dbgClient.attachTarget(response.form.actor);
|
||||
const consoleActor = response.form.consoleActor;
|
||||
state.actor = consoleActor;
|
||||
|
Loading…
Reference in New Issue
Block a user