Bug 917051 - SimplePush: Clean up unregister related code. r=dougt

--HG--
extra : rebase_source : 461b394aeb28538d1ce8ec875c864bbf4f2c52a7
This commit is contained in:
Nikhil Marathe 2013-09-16 23:47:47 -07:00
parent 6a78a75368
commit a384ea2033

View File

@ -824,28 +824,6 @@ this.PushService = {
}
},
/**
* Protocol handler invoked by server message.
*/
_handleUnregisterReply: function(reply) {
debug("handleUnregisterReply()");
if (typeof reply.channelID !== "string" ||
typeof this._pendingRequests[reply.channelID] !== "object")
return;
let tmp = this._pendingRequests[reply.channelID];
delete this._pendingRequests[reply.channelID];
if (Object.keys(this._pendingRequests).length == 0 &&
this._requestTimeoutTimer)
this._requestTimeoutTimer.cancel();
if (reply.status == 200) {
tmp.deferred.resolve(reply);
} else {
tmp.deferred.reject(reply);
}
},
/**
* Protocol handler invoked by server message.
*/
@ -1157,7 +1135,7 @@ this.PushService = {
},
function(error) {
// Unable to save.
this._sendRequest("unregister", {channelID: record.channelID});
this._send("unregister", {channelID: record.channelID});
message["error"] = error;
deferred.reject(message);
}
@ -1372,7 +1350,7 @@ this.PushService = {
// A whitelist of protocol handlers. Add to these if new messages are added
// in the protocol.
let handlers = ["Hello", "Register", "Unregister", "Notification"];
let handlers = ["Hello", "Register", "Notification"];
// Build up the handler name to call from messageType.
// e.g. messageType == "register" -> _handleRegisterReply.