Bug 1393086 - Parallelize toolbox and child process server initializations.
MozReview-Commit-ID: 7rPMkE5Xg8E
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -411,34 +411,22 @@ Toolbox.prototype = {
domHelper.onceDOMReady(() => {
domReady.resolve();
}, this._URL);
// Optimization: fire up a few other things before waiting on
// the iframe being ready (makes startup faster)
// Load the toolbox-level actor fronts and utilities now
- yield this._target.makeRemote();
-
- // Start tracking network activity on toolbox open for targets such as tabs.
- // (Workers and potentially others don't manage the console client in the target.)
- if (this._target.activeConsole) {
- yield this._target.activeConsole.startListeners([
- "NetworkActivity",
- ]);
- }
-
- // Attach the thread
- this._threadClient = yield attachThread(this);
+ let onRemote = this._target.makeRemote();
+
yield domReady.promise;
this.isReady = true;
- let framesPromise = this._listFrames();
-
Services.prefs.addObserver("devtools.cache.disabled", this._applyCacheSettings);
Services.prefs.addObserver("devtools.serviceWorkers.testing.enabled",
this._applyServiceWorkersTestingSettings);
this.textBoxContextMenuPopup =
this.doc.getElementById("toolbox-textbox-context-popup");
this.textBoxContextMenuPopup.addEventListener("popupshowing",
this._updateTextBoxMenuItems, true);
@@ -458,19 +446,17 @@ Toolbox.prototype = {
window: this.doc.defaultView
});
// Get the DOM element to mount the ToolboxController to.
this._componentMount = this.doc.getElementById("toolbox-toolbar-mount");
this._mountReactComponent();
this._buildDockButtons();
this._buildOptions();
- this._buildTabs();
- this._applyCacheSettings();
- this._applyServiceWorkersTestingSettings();
+
this._addKeysToWindow();
this._addReloadKeys();
this._addHostListeners();
this._registerOverlays();
if (!this._hostOptions || this._hostOptions.zoom === true) {
ZoomKeys.register(this.win);
}
@@ -479,30 +465,51 @@ Toolbox.prototype = {
this.webconsolePanel = this.doc.querySelector("#toolbox-panel-webconsole");
this.webconsolePanel.height = Services.prefs.getIntPref(SPLITCONSOLE_HEIGHT_PREF);
this.webconsolePanel.addEventListener("resize", this._saveSplitConsoleHeight);
let buttonsPromise = this._buildButtons();
this._pingTelemetry();
+ yield onRemote;
+
// The isTargetSupported check needs to happen after the target is
// remoted, otherwise we could have done it in the toolbox constructor
// (bug 1072764).
let toolDef = gDevTools.getToolDefinition(this._defaultToolId);
if (!toolDef || !toolDef.isTargetSupported(this._target)) {
this._defaultToolId = "webconsole";
}
+ this._buildTabs();
+
// Start rendering the toolbox toolbar before selecting the tool, as the tools
// can take a few hundred milliseconds seconds to start up.
this.component.setCanRender();
+ // Start tracking network activity on toolbox open for targets such as tabs.
+ // (Workers and potentially others don't manage the console client in the target.)
+ if (this._target.activeConsole) {
+ yield this._target.activeConsole.startListeners([
+ "NetworkActivity",
+ ]);
+ }
+
+ // Attach the thread
+ this._threadClient = yield attachThread(this);
+
+ let framesPromise = this._listFrames();
+
+ this._applyCacheSettings();
+ this._applyServiceWorkersTestingSettings();
+
yield this.selectTool(this._defaultToolId);
+
// Wait until the original tool is selected so that the split
// console input will receive focus.
let splitConsolePromise = promise.resolve();
if (Services.prefs.getBoolPref(SPLITCONSOLE_ENABLED_PREF)) {
splitConsolePromise = this.openSplitConsole();
}
yield promise.all([