Bug 1297758 - Fix race in inspector initialization to prevent this._splitter is undefined exception. r=bgrins
MozReview-Commit-ID: HkHLnCaNiFK
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -442,18 +442,16 @@ Inspector.prototype = {
/**
* Build Splitter located between the main and side area of
* the Inspector panel.
*/
setupSplitter: function () {
let SplitBox = this.React.createFactory(this.browserRequire(
"devtools/client/shared/components/splitter/split-box"));
- this.panelWin.addEventListener("resize", this.onPanelWindowResize, true);
-
let splitter = SplitBox({
className: "inspector-sidebar-splitter",
initialWidth: INITIAL_SIDEBAR_SIZE,
initialHeight: INITIAL_SIDEBAR_SIZE,
minSize: MIN_SIDEBAR_SIZE,
splitterSize: 1,
endPanelControl: true,
startPanel: this.InspectorTabPanel({
@@ -463,16 +461,18 @@ Inspector.prototype = {
id: "inspector-sidebar-container"
}),
vert: this.useLandscapeMode(),
});
this._splitter = this.ReactDOM.render(splitter,
this.panelDoc.getElementById("inspector-splitter-box"));
+ this.panelWin.addEventListener("resize", this.onPanelWindowResize, true);
+
// Persist splitter state in preferences.
this.sidebar.on("show", this.onSidebarShown);
this.sidebar.on("hide", this.onSidebarHidden);
this.sidebar.on("destroy", this.onSidebarHidden);
},
/**
* Splitter clean up.