From 8d8c2f503e77ee9b9177acfd33772421c564b30e Mon Sep 17 00:00:00 2001 From: Chuck Lee Date: Mon, 18 Aug 2014 15:10:24 +0800 Subject: [PATCH] Bug 1051660 - 0001. Fix minor bugs in API implementation. r=hchang --- dom/wifi/WifiWorker.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index 5934a7fa30f1..4681796d3ea9 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -2898,24 +2898,28 @@ WifiWorker.prototype = { // No change. if (enabled === WifiManager.enabled) { this._sendMessage(message, true, true, msg); + return; } // Can't enable wifi while hotspot mode is enabled. if (enabled && (this.tetheringSettings[SETTINGS_WIFI_TETHERING_ENABLED] || WifiManager.isWifiTetheringEnabled(WifiManager.tetheringState))) { self._sendMessage(message, false, "Can't enable Wifi while hotspot mode is enabled", msg); - } - - // Reply error to pending requests. - if (!enabled) { - this._clearPendingRequest(); + return; } WifiManager.setWifiEnabled(enabled, function(ok) { if (ok === 0 || ok === "no change") { self._sendMessage(message, true, true, msg); + + // Reply error to pending requests. + if (!enabled) { + self._clearPendingRequest(); + } else { + WifiManager.start(); + } } else { - self._sendMessage(message, false, "Set power saving mode failed", msg); + self._sendMessage(message, false, "Set wifi enabled failed", msg); } }); },