Bug 914403 - Part 3: Clear selection on remote inspector destuction. r=paul

This commit is contained in:
J. Ryan Stinnett 2013-09-16 19:28:53 -05:00
parent cd41027a77
commit 2d2ffc2e13
3 changed files with 18 additions and 6 deletions

View File

@ -834,6 +834,7 @@ function BasicHighlighter(aTarget, aInspector)
BasicHighlighter.prototype = {
destroy: function() {
this.walker.highlight(null);
this.selection.off("new-node-front", this.highlight);
this.walker = null;
this.selection = null;

View File

@ -447,6 +447,13 @@ InspectorPanel.prototype = {
if (this._destroyPromise) {
return this._destroyPromise;
}
if (this.highlighter) {
this.highlighter.off("locked", this.onLockStateChanged);
this.highlighter.off("unlocked", this.onLockStateChanged);
this.highlighter.destroy();
}
if (this.walker) {
this.walker.off("new-root", this.onNewRoot);
this._destroyPromise = this.walker.release().then(null, console.error);
@ -464,12 +471,6 @@ InspectorPanel.prototype = {
this.browser = null;
}
if (this.highlighter) {
this.highlighter.off("locked", this.onLockStateChanged);
this.highlighter.off("unlocked", this.onLockStateChanged);
this.highlighter.destroy();
}
this.target.off("thread-paused", this.updateDebuggerPausedWarning);
this.target.off("thread-resumed", this.updateDebuggerPausedWarning);
this._toolbox.off("select", this.updateDebuggerPausedWarning);

View File

@ -35,6 +35,12 @@ function test() {
yield verifyH1Selected();
yield deselect();
yield verifyNoNodeSelected();
yield selectH1();
yield verifyH1Selected();
yield destroyInspector();
yield verifyNoNodeSelected();
finishUp();
}).then(null, Cu.reportError);
}
@ -66,6 +72,10 @@ function test() {
return deferred.promise;
}
function destroyInspector() {
return inspector.destroy();
}
function verifyNoNodeSelected() {
ok(doc.querySelectorAll(":-moz-devtools-highlighted").length === 0, "no node selected");
return promise.resolve();