Bug 1056342 - Performance tab fails with app after second toolbox open, r=paul

This commit is contained in:
Victor Porof committed 2014-10-03 21:40:42 +01:00
1 parent fc9eb794ed
commit 1867351e2d
2 files changed
+24 -3

No files matched your search

+7 -3
View File
@@ -35,12 +35,12 @@ ProfilerPanel.prototype = {
* A promise that is resolved when the Profiler completes opening.
*/
open: Task.async(function*() {
let connection = getProfilerConnection(this._toolbox);
yield connection.open();
this._connection = getProfilerConnection(this._toolbox);
yield this._connection.open();
this.panelWin.gToolbox = this._toolbox;
this.panelWin.gTarget = this.target;
this.panelWin.gFront = new ProfilerFront(connection);
this.panelWin.gFront = new ProfilerFront(this._connection);
yield this.panelWin.startupProfiler();
this.isReady = true;
@@ -59,6 +59,10 @@ ProfilerPanel.prototype = {
}
yield this.panelWin.shutdownProfiler();
// Destroy the connection to ensure packet handlers are removed from client.
this._connection.destroy();
this.emit("destroyed");
this._destroyed = true;
})
+17
View File
@@ -112,6 +112,14 @@ ProfilerConnection.prototype = {
Services.obs.notifyObservers(null, "profiler-connection-opened", null);
}),
/**
* Destroys this connection.
*/
destroy: function() {
this._disconnectMiscActors();
this._connected = false;
},
/**
* Initializes a connection to miscellaneous actors which are going to be
* used in tandem with the profiler actor.
@@ -124,6 +132,7 @@ ProfilerConnection.prototype = {
this._framerate = new FramerateFront(this._target.client, this._target.form);
} else {
this._framerate = {
destroy: () => {},
startRecording: () => {},
stopRecording: () => {},
cancelRecording: () => {},
@@ -133,6 +142,14 @@ ProfilerConnection.prototype = {
}
},
/**
* Closes the connections to miscellaneous actors.
* @see ProfilerConnection.prototype._connectMiscActors
*/
_disconnectMiscActors: function() {
this._framerate.destroy();
},
/**
* Sends the request over the remote debugging protocol to the
* specified actor.