mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 820458 - Try harder to avoid notifying for the same request twice. r=vchang
This commit is contained in:
parent
c067646b00
commit
12c19a8961
@ -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));
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user