From c5998ade9287565c72f3d1010c8fe292f1803f3e Mon Sep 17 00:00:00 2001 From: Mihai Sucan Date: Wed, 5 Feb 2014 14:22:37 +0200 Subject: [PATCH] Bug 966970 - Fix for intermittent browser_webconsole_bug_632275_getters_document_width.js | Test timed out; r=pbrosset --- browser/devtools/framework/toolbox.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/browser/devtools/framework/toolbox.js b/browser/devtools/framework/toolbox.js index daa5c095a25..ad3e5809d4e 100644 --- a/browser/devtools/framework/toolbox.js +++ b/browser/devtools/framework/toolbox.js @@ -1060,17 +1060,25 @@ Toolbox.prototype = { let deferred = promise.defer(); if (this._inspector) { - this._selection.destroy(); - this._selection = null; - this._walker.release().then( + // Selection is not always available. + if (this._selection) { + this._selection.destroy(); + this._selection = null; + } + + let walker = this._walker ? this._walker.release() : promise.resolve(null); + walker.then( () => { this._inspector.destroy(); - this._highlighter.destroy(); + if (this._highlighter) { + this._highlighter.destroy(); + } }, (e) => { console.error("Walker.release() failed: " + e); this._inspector.destroy(); - return this._highlighter.destroy(); + + return this._highlighter ? this._highlighter.destroy() : promise.resolve(null); } ).then(() => { this._inspector = null;