зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1586359 Part 2 - Attach webconsole client to new content processes when using ODB, r=nchevobbe.
Depends on D48245 Differential Revision: https://phabricator.services.mozilla.com/D48246 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a89d3df4e8
Коммит
6c0fd8c472
|
@ -62,6 +62,9 @@ class WebConsoleUI {
|
|||
this._onChangeSplitConsoleState = this._onChangeSplitConsoleState.bind(
|
||||
this
|
||||
);
|
||||
this._listProcessesAndCreateProxies = this._listProcessesAndCreateProxies.bind(
|
||||
this
|
||||
);
|
||||
|
||||
EventEmitter.decorate(this);
|
||||
}
|
||||
|
@ -169,6 +172,14 @@ class WebConsoleUI {
|
|||
toolbox.off("select", this._onChangeSplitConsoleState);
|
||||
}
|
||||
|
||||
const target = this.hud.currentTarget;
|
||||
if (target) {
|
||||
target.client.mainRoot.off(
|
||||
"processListChanged",
|
||||
this._listProcessesAndCreateProxies
|
||||
);
|
||||
}
|
||||
|
||||
for (const proxy of this.getAllProxies()) {
|
||||
proxy.disconnect();
|
||||
}
|
||||
|
@ -319,11 +330,31 @@ class WebConsoleUI {
|
|||
needContentProcessMessagesListener
|
||||
);
|
||||
|
||||
const onConnect = this.proxy.connect();
|
||||
|
||||
if (fissionSupport && target.isParentProcess && !target.isAddon) {
|
||||
this.additionalProxies = [];
|
||||
|
||||
await this._listProcessesAndCreateProxies();
|
||||
target.client.mainRoot.on(
|
||||
"processListChanged",
|
||||
this._listProcessesAndCreateProxies
|
||||
);
|
||||
}
|
||||
|
||||
await onConnect;
|
||||
}
|
||||
|
||||
async _listProcessesAndCreateProxies() {
|
||||
const target = this.hud.currentTarget;
|
||||
const { mainRoot } = target.client;
|
||||
const { processes } = await mainRoot.listProcesses();
|
||||
|
||||
this.additionalProxies = [];
|
||||
if (!this.additionalProxies) {
|
||||
return;
|
||||
}
|
||||
|
||||
const newProxies = [];
|
||||
for (const processDescriptor of processes) {
|
||||
const targetFront = await processDescriptor.getTarget();
|
||||
|
||||
|
@ -341,13 +372,17 @@ class WebConsoleUI {
|
|||
continue;
|
||||
}
|
||||
|
||||
this.additionalProxies.push(
|
||||
new WebConsoleConnectionProxy(this, targetFront)
|
||||
);
|
||||
}
|
||||
if (this.additionalProxies.some(proxy => proxy.target == targetFront)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return Promise.all(this.getAllProxies(false).map(proxy => proxy.connect()));
|
||||
const proxy = new WebConsoleConnectionProxy(this, targetFront);
|
||||
|
||||
newProxies.push(proxy);
|
||||
this.additionalProxies.push(proxy);
|
||||
}
|
||||
|
||||
await Promise.all(newProxies.map(proxy => proxy.connect()));
|
||||
}
|
||||
|
||||
_initUI() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче