From 083c360416f77ebe03bb11e093e29d181affc5fd Mon Sep 17 00:00:00 2001 From: Dave Camp Date: Thu, 8 Aug 2013 08:44:56 -0700 Subject: [PATCH] Bug 903573 - Get a reference to the style actor in the inspector panel. r=mratcliffe --- browser/devtools/inspector/inspector-panel.js | 21 ++++++++++++------- browser/devtools/inspector/selection.js | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/browser/devtools/inspector/inspector-panel.js b/browser/devtools/inspector/inspector-panel.js index ee446cacdfda..aabec8d52ea1 100644 --- a/browser/devtools/inspector/inspector-panel.js +++ b/browser/devtools/inspector/inspector-panel.js @@ -45,12 +45,8 @@ InspectorPanel.prototype = { */ open: function InspectorPanel_open() { return this.target.makeRemote().then(() => { - return this.target.inspector.getWalker(); - }).then(walker => { - if (this._destroyPromise) { - walker.release().then(null, console.error); - } - this.walker = walker; + return this._getWalker(); + }).then(() => { return this._getDefaultNodeForSelection(); }).then(defaultSelection => { return this._deferredOpen(defaultSelection); @@ -149,6 +145,16 @@ InspectorPanel.prototype = { return deferred.promise; }, + _getWalker: function() { + let inspector = this.target.inspector; + return inspector.getWalker().then(walker => { + this.walker = walker; + return inspector.getPageStyle(); + }).then(pageStyle => { + this.pageStyle = pageStyle; + }); + }, + /** * Return a promise that will resolve to the default node for selection. */ @@ -317,7 +323,7 @@ InspectorPanel.prototype = { try { selfUpdate(selection); } catch(ex) { - console.error(ex); + console.error(ex) } }, Ci.nsIThread.DISPATCH_NORMAL); }, @@ -403,6 +409,7 @@ InspectorPanel.prototype = { if (this.walker) { this._destroyPromise = this.walker.release().then(null, console.error); delete this.walker; + delete this.pageStyle; } else { this._destroyPromise = promise.resolve(null); } diff --git a/browser/devtools/inspector/selection.js b/browser/devtools/inspector/selection.js index 62c4da6da417..929df15deda9 100644 --- a/browser/devtools/inspector/selection.js +++ b/browser/devtools/inspector/selection.js @@ -81,7 +81,7 @@ Selection.prototype = { attributeChange = true; } if (m.type == "childList") { - if (!detached && !this.isConnected()) { + if (!detached && this.isNode() && !this.isConnected()) { parentNode = m.target; detached = true; }