Bug 820458 - Try harder to avoid notifying for the same request twice. r=vchang

This commit is contained in:
Blake Kaplan 2013-01-08 09:58:26 +01:00
parent c067646b00
commit 12c19a8961

View File

@ -2427,7 +2427,11 @@ WifiWorker.prototype = {
return;
}
let sent = false;
let callback = (function (networks) {
if (sent)
return;
sent = true;
this._sendMessage(message, networks !== null, networks, msg);
}).bind(this);
this.waitForScan(callback);
@ -2438,10 +2442,12 @@ WifiWorker.prototype = {
return;
// Avoid sending multiple responses.
this.wantScanResults.splice(this.wantScanResults.indexOf(callback), 1);
if (sent)
return;
// Otherwise, let the client know that it failed, it's responsible for
// trying again in a few seconds.
sent = true;
this._sendMessage(message, false, "ScanFailed", msg);
}).bind(this));
},