Bug 898074 - Don't send multiple responses to deleteSession, r=dhylands

This commit is contained in:
Jonathan Griffin 2013-08-01 18:20:22 -07:00
parent ba2ac554e1
commit 76bb4a4f89

View File

@ -180,7 +180,7 @@ MarionetteServerConnection.prototype = {
onClosed: function MSC_onClosed(aStatus) {
this.server._connectionClosed(this);
this.deleteSession();
this.sessionTearDown();
},
/**
@ -1928,7 +1928,8 @@ MarionetteServerConnection.prototype = {
// if there is only 1 window left, delete the session
if (numOpenWindows === 1){
this.deleteSession();
this.sessionTearDown();
this.sendOk(command_id);
return;
}
@ -1953,8 +1954,7 @@ MarionetteServerConnection.prototype = {
* all other listeners. The main content listener persists after disconnect (it's the homescreen),
* and can safely be reused.
*/
deleteSession: function MDA_deleteSession() {
let command_id = this.command_id = this.getCommandId();
sessionTearDown: function MDA_sessionTearDown() {
if (this.curBrowser != null) {
if (appName == "B2G") {
this.globalMessageManager.broadcastAsyncMessage(
@ -1978,7 +1978,6 @@ MarionetteServerConnection.prototype = {
winEnum.getNext().messageManager.removeDelayedFrameScript(FRAME_SCRIPT);
}
}
this.sendOk(command_id);
this.removeMessageManagerListeners(this.globalMessageManager);
this.switchToGlobalMessageManager();
// reset frame to the top-most frame
@ -1994,6 +1993,16 @@ MarionetteServerConnection.prototype = {
}
},
/**
* Processes the 'deleteSession' request from the client by tearing down
* the session and responding 'ok'.
*/
deleteSession: function MDA_sessionTearDown() {
let command_id = this.command_id = this.getCommandId();
this.sessionTearDown();
this.sendOk(command_id);
},
/**
* Returns the current status of the Application Cache
*/