Bug 802823 - Early cleanup of message listeners in ActivityProxy.js [r=gwagner]

This commit is contained in:
Fabrice Desré 2012-10-18 15:30:57 -07:00
parent 035e8b8432
commit dd2ebe02d8

View File

@ -80,12 +80,17 @@ ActivityProxy.prototype = {
Services.DOMRequest.fireError(this.activity, msg.error);
break;
}
// We can only get one FireSuccess / FireError message, so cleanup as soon as possible.
this.cleanup();
},
cleanup: function actProxy_cleanup() {
debug("cleanup");
cpmm.removeMessageListener("Activity:FireSuccess", this);
cpmm.removeMessageListener("Activity:FireError", this);
if (!this.cleanedUp) {
cpmm.removeMessageListener("Activity:FireSuccess", this);
cpmm.removeMessageListener("Activity:FireError", this);
}
this.cleanedUp = true;
},
classID: Components.ID("{ba9bd5cb-76a0-4ecf-a7b3-d2f7c43c5949}"),