Bug 786283 - Report to the caller when a scan request fails. r=vchang
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 28 Aug 2012 12:55:41 -0300
changeset 105676 cd7ccc95cefa7e87ee9bbc663eb591257d934650
parent 105675 6dc18ee00539e27365961641e197000c97a3582e
child 105677 a0240c1043eefc60f08dc3e4dd2e8a0043b0d75e
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersvchang
bugs786283
milestone18.0a1
Bug 786283 - Report to the caller when a scan request fails. r=vchang
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -1949,17 +1949,26 @@ WifiWorker.prototype = {
     if (!WifiManager.enabled) {
       this._sendMessage(message, false, "Wifi is disabled", msg);
       return;
     }
 
     this.waitForScan((function (networks) {
       this._sendMessage(message, networks !== null, networks, msg);
     }).bind(this));
-    WifiManager.scan(true, function() {});
+
+    WifiManager.scan(true, function(ok) {
+      // If the scan command succeeded, we're done.
+      if (ok)
+        return;
+
+      // Otherwise, let the client know that it failed, it's responsible for
+      // trying again in a few seconds.
+      this._sendMessage(message, false, "ScanFailed", msg);
+    });
   },
 
   _notifyAfterStateChange: function(success, newState) {
     // First, notify all of the requests that were trying to make this change.
     let state = this._stateRequests[0].enabled;
 
     // If the new state is not the same as state, then we weren't processing
     // the first request (we were racing somehow) so don't notify.