diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index 22e3495270f..95c27d1ecde 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index d501460480c..25eff14f918 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 626f09d6a29..b767f1db85d 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index 22e3495270f..95c27d1ecde 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 5cecba344d9..154e9daae46 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -4,6 +4,6 @@
"branch": "",
"revision": ""
},
- "revision": "3981aa44b3b0c977fbb34d0203594474b48b5b74",
+ "revision": "2900811db1282799596e70db1152348f6700ad37",
"repo_path": "/integration/gaia-central"
}
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index 7394a3d0371..81a47b3dd69 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 84dc71eb699..de95b3b28ea 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/inari/sources.xml b/b2g/config/inari/sources.xml
index bfedb59fc2b..fe1f3565a79 100644
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/leo/sources.xml b/b2g/config/leo/sources.xml
index 47a647bd9cf..ab277fd52e2 100644
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/mako/sources.xml b/b2g/config/mako/sources.xml
index 1fb3d7c38ec..78a63903b2b 100644
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index a90d9b743a1..8ba3e169d59 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp
index 6a581a22a29..c9dac94c4c1 100644
--- a/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp
@@ -910,6 +910,9 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
#if ANDROID_VERSION > 17
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
+ // always update playstatus first
+ sBtAvrcpInterface->get_play_status_rsp((btrc_play_status_t)aPlayStatus,
+ aDuration, aPosition);
// when play status changed, send both play status and position
if (mPlayStatus != aPlayStatus &&
mPlayStatusChangedNotifyType == BTRC_NOTIFICATION_TYPE_INTERIM) {
@@ -931,8 +934,6 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
¶m);
}
- sBtAvrcpInterface->get_play_status_rsp((btrc_play_status_t)aPlayStatus,
- aDuration, aPosition);
mDuration = aDuration;
mPosition = aPosition;
mPlayStatus = aPlayStatus;
@@ -958,7 +959,7 @@ BluetoothA2dpManager::UpdateRegisterNotification(int aEventId, int aParam)
switch (aEventId) {
case BTRC_EVT_PLAY_STATUS_CHANGED:
- mPlayPosChangedNotifyType = BTRC_NOTIFICATION_TYPE_INTERIM;
+ mPlayStatusChangedNotifyType = BTRC_NOTIFICATION_TYPE_INTERIM;
param.play_status = (btrc_play_status_t)mPlayStatus;
break;
case BTRC_EVT_TRACK_CHANGE:
diff --git a/dom/mobileconnection/tests/marionette/manifest.ini b/dom/mobileconnection/tests/marionette/manifest.ini
index 07ad02777d6..6b36dc2f7ea 100644
--- a/dom/mobileconnection/tests/marionette/manifest.ini
+++ b/dom/mobileconnection/tests/marionette/manifest.ini
@@ -9,8 +9,6 @@ disabled = Bug 808783
[test_mobile_voice_location.js]
[test_mobile_operator_names.js]
[test_mobile_preferred_network_type.js]
-[test_mobile_preferred_network_type_by_setting.js]
-disabled = Bug 808783
[test_mobile_data_connection.js]
[test_mobile_data_location.js]
[test_mobile_data_state.js]
diff --git a/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_by_setting.js b/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_by_setting.js
deleted file mode 100644
index 43f4a17d2c6..00000000000
--- a/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_by_setting.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-
-const KEY = "ril.radio.preferredNetworkType";
-
-SpecialPowers.addPermission("mobileconnection", true, document);
-SpecialPowers.addPermission("settings-read", true, document);
-SpecialPowers.addPermission("settings-write", true, document);
-
-let settings = window.navigator.mozSettings;
-
-function test_revert_previous_setting_on_invalid_value() {
- log("Testing reverting to previous setting on invalid value received");
-
- let getLock = settings.createLock();
- let getReq = getLock.get(KEY);
- getReq.addEventListener("success", function onGetSuccess() {
- let originalValue = getReq.result[KEY] || "wcdma/gsm";
-
- let setDone = false;
- settings.addObserver(KEY, function observer(setting) {
- // Mark if the invalid value has been set in db and wait.
- if (setting.settingValue == obj[KEY]) {
- setDone = true;
- return;
- }
-
- // Skip any change before marking but keep it as original value.
- if (!setDone) {
- originalValue = setting.settingValue;
- return;
- }
-
- settings.removeObserver(KEY, observer);
- is(setting.settingValue, originalValue, "Settings reverted");
- window.setTimeout(cleanUp, 0);
- });
-
- let obj = {};
- obj[KEY] = "AnInvalidValue";
- let setLock = settings.createLock();
- setLock.set(obj);
- setLock.addEventListener("error", function onSetError() {
- ok(false, "cannot set '" + KEY + "'");
- });
- });
- getReq.addEventListener("error", function onGetError() {
- ok(false, "cannot get default value of '" + KEY + "'");
- });
-}
-
-function cleanUp() {
- SpecialPowers.removePermission("mobileconnection", document);
- SpecialPowers.removePermission("settings-write", document);
- SpecialPowers.removePermission("settings-read", document);
-
- finish();
-}
-
-waitFor(test_revert_previous_setting_on_invalid_value, function() {
- return navigator.mozMobileConnections[0].voice.connected;
-});
-
diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js
index c349beea108..e1d69f66d95 100644
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -1877,9 +1877,6 @@ function RadioInterface(aClientId, aWorkerMessenger) {
let lock = gSettingsService.createLock();
- // Read preferred network type from the setting DB.
- lock.get("ril.radio.preferredNetworkType", this);
-
// Read the "time.clock.automatic-update.enabled" setting to see if
// we need to adjust the system clock time by NITZ or SNTP.
lock.get(kSettingsClockAutoUpdateEnabled, this);
@@ -2508,16 +2505,10 @@ RadioInterface.prototype = {
connHandler.updateRILNetworkInterface();
},
- _preferredNetworkType: null,
getPreferredNetworkType: function(target, message) {
this.workerMessenger.send("getPreferredNetworkType", message, (function(response) {
if (response.success) {
- this._preferredNetworkType = response.networkType;
- response.type = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType];
- if (DEBUG) {
- this.debug("_preferredNetworkType is now " +
- RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]);
- }
+ response.type = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[response.networkType];
}
target.sendAsyncMessage("RIL:GetPreferredNetworkType", {
@@ -2529,7 +2520,6 @@ RadioInterface.prototype = {
},
setPreferredNetworkType: function(target, message) {
- if (DEBUG) this.debug("setPreferredNetworkType: " + JSON.stringify(message));
let networkType = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO.indexOf(message.type);
if (networkType < 0) {
message.errorMsg = RIL.GECKO_ERROR_INVALID_PARAMETER;
@@ -2542,14 +2532,6 @@ RadioInterface.prototype = {
message.networkType = networkType;
this.workerMessenger.send("setPreferredNetworkType", message, (function(response) {
- if (response.success) {
- this._preferredNetworkType = response.networkType;
- if (DEBUG) {
- this.debug("_preferredNetworkType is now " +
- RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]);
- }
- }
-
target.sendAsyncMessage("RIL:SetPreferredNetworkType", {
clientId: this.clientId,
data: response
@@ -2558,43 +2540,6 @@ RadioInterface.prototype = {
}).bind(this));
},
- // TODO: Bug 946589 - B2G RIL: follow-up to bug 944225 - remove
- // 'ril.radio.preferredNetworkType' setting handler
- setPreferredNetworkTypeBySetting: function(value) {
- let networkType = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO.indexOf(value);
- if (networkType < 0) {
- networkType = (this._preferredNetworkType != null)
- ? RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]
- : RIL.GECKO_PREFERRED_NETWORK_TYPE_DEFAULT;
- gSettingsService.createLock().set("ril.radio.preferredNetworkType",
- networkType, null);
- return;
- }
-
- if (networkType == this._preferredNetworkType) {
- return;
- }
-
- this.workerMessenger.send("setPreferredNetworkType",
- { networkType: networkType },
- (function(response) {
- if ((this._preferredNetworkType != null) && !response.success) {
- gSettingsService.createLock().set("ril.radio.preferredNetworkType",
- this._preferredNetworkType,
- null);
- return false;
- }
-
- this._preferredNetworkType = response.networkType;
- if (DEBUG) {
- this.debug("_preferredNetworkType is now " +
- RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[this._preferredNetworkType]);
- }
-
- return false;
- }).bind(this));
- },
-
setCellBroadcastSearchList: function(newSearchListStr) {
if (newSearchListStr == this._cellBroadcastSearchListStr) {
return;
@@ -3277,12 +3222,6 @@ RadioInterface.prototype = {
// nsISettingsServiceCallback
handle: function(aName, aResult) {
switch(aName) {
- // TODO: Bug 946589 - B2G RIL: follow-up to bug 944225 - remove
- // 'ril.radio.preferredNetworkType' setting handler
- case "ril.radio.preferredNetworkType":
- if (DEBUG) this.debug("'ril.radio.preferredNetworkType' is now " + aResult);
- this.setPreferredNetworkTypeBySetting(aResult);
- break;
case kSettingsClockAutoUpdateEnabled:
this._clockAutoUpdateEnabled = aResult;
if (!this._clockAutoUpdateEnabled) {
diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js
index f0d070ed2ce..67bb4ff6ea6 100644
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -415,7 +415,6 @@ this.GECKO_PREFERRED_NETWORK_TYPE_LTE_CDMA_EVDO = "lte/cdma/evdo";
this.GECKO_PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM = "lte/wcdma/gsm";
this.GECKO_PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM_CDMA_EVDO = "lte/wcdma/gsm/cdma/evdo";
this.GECKO_PREFERRED_NETWORK_TYPE_LTE_ONLY = "lte";
-this.GECKO_PREFERRED_NETWORK_TYPE_DEFAULT = GECKO_PREFERRED_NETWORK_TYPE_WCDMA_GSM;
this.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO = [
GECKO_PREFERRED_NETWORK_TYPE_WCDMA_GSM,
GECKO_PREFERRED_NETWORK_TYPE_GSM_ONLY,
diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js
index cbe07ee855e..3041a9eac3b 100644
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -6136,13 +6136,8 @@ RilObject.prototype[REQUEST_GET_PREFERRED_NETWORK_TYPE] = function REQUEST_GET_P
return;
}
- let Buf = this.context.Buf;
- let networkType = RIL_PREFERRED_NETWORK_TYPE_TO_GECKO.indexOf(GECKO_PREFERRED_NETWORK_TYPE_DEFAULT);
- let responseLen = Buf.readInt32(); // Number of INT32 responsed.
- if (responseLen) {
- this.preferredNetworkType = networkType = Buf.readInt32();
- }
- options.networkType = networkType;
+ let results = this.context.Buf.readInt32List();
+ options.networkType = this.preferredNetworkType = results[0];
options.success = true;
this.sendChromeMessage(options);
@@ -14462,6 +14457,10 @@ ICCContactHelperObject.prototype = {
(Array.isArray(contact.anr) && contact.anr[0]))) {
// Case 1.
this.addContactFieldType2(pbr, contact, field, onsuccess, onerror);
+ } else {
+ if (onsuccess) {
+ onsuccess();
+ }
}
return;
}
diff --git a/dom/system/gonk/tests/test_ril_worker_icc.js b/dom/system/gonk/tests/test_ril_worker_icc.js
index bcf5135e114..80cb358013c 100644
--- a/dom/system/gonk/tests/test_ril_worker_icc.js
+++ b/dom/system/gonk/tests/test_ril_worker_icc.js
@@ -1684,7 +1684,7 @@ add_test(function test_update_icc_contact() {
let contactHelper = context.ICCContactHelper;
let ril = context.RIL;
- function do_test(aSimType, aContactType, aContact, aPin2, aFileType, aEnhancedPhoneBook) {
+ function do_test(aSimType, aContactType, aContact, aPin2, aFileType, aHaveIapIndex, aEnhancedPhoneBook) {
ril.appType = aSimType;
ril._isCdma = (aSimType === CARD_APPTYPE_RUIM);
ril.iccInfoPrivate.cst = (aEnhancedPhoneBook) ? [0x0, 0x0C, 0x0, 0x0, 0x0]
@@ -1729,7 +1729,14 @@ add_test(function test_update_icc_contact() {
recordHelper.readIAP = function(fileId, recordNumber, onsuccess, onerror) {
do_check_eq(fileId, IAP_FILE_ID);
do_check_eq(recordNumber, ADN_RECORD_ID);
- onsuccess([EMAIL_RECORD_ID, ANR0_RECORD_ID]);
+ onsuccess((aHaveIapIndex) ? [EMAIL_RECORD_ID, ANR0_RECORD_ID]
+ : [0xff, 0xff]);
+ };
+
+ recordHelper.updateIAP = function(fileId, recordNumber, iap, onsuccess, onerror) {
+ do_check_eq(fileId, IAP_FILE_ID);
+ do_check_eq(recordNumber, ADN_RECORD_ID);
+ onsuccess();
};
recordHelper.updateEmail = function(pbr, recordNumber, email, adnRecordId, onsuccess, onerror) {
@@ -1756,16 +1763,28 @@ add_test(function test_update_icc_contact() {
onsuccess();
};
+ recordHelper.findFreeRecordId = function(fileId, onsuccess, onerror) {
+ let recordId = 0;
+ if (fileId === EMAIL_FILE_ID) {
+ recordId = EMAIL_RECORD_ID;
+ } else if (fileId === ANR0_FILE_ID) {
+ recordId = ANR0_RECORD_ID;
+ }
+ onsuccess(recordId);
+ };
+
+ let isSuccess = false;
let onsuccess = function onsuccess() {
do_print("updateICCContact success");
+ isSuccess = true;
};
let onerror = function onerror(errorMsg) {
do_print("updateICCContact failed: " + errorMsg);
- do_check_true(false);
};
contactHelper.updateICCContact(aSimType, aContactType, aContact, aPin2, onsuccess, onerror);
+ do_check_true(isSuccess);
}
let contacts = [
@@ -1783,6 +1802,22 @@ add_test(function test_update_icc_contact() {
recordId: ADN_RECORD_ID,
alphaId: "test2",
number: "123456",
+ },
+ // a contact with email but no anr.
+ {
+ pbrIndex: 0,
+ recordId: ADN_RECORD_ID,
+ alphaId: "test3",
+ number: "123456",
+ email: "test@mail.com"
+ },
+ // a contact with anr but no email.
+ {
+ pbrIndex: 0,
+ recordId: ADN_RECORD_ID,
+ alphaId: "test4",
+ number: "123456",
+ anr: ["+654321"]
}];
for (let i = 0; i < contacts.length; i++) {
@@ -1797,7 +1832,8 @@ add_test(function test_update_icc_contact() {
// USIM
do_print("Test update USIM adn contacts");
do_test(CARD_APPTYPE_USIM, "adn", contact, null, ICC_USIM_TYPE1_TAG);
- do_test(CARD_APPTYPE_USIM, "adn", contact, null, ICC_USIM_TYPE2_TAG);
+ do_test(CARD_APPTYPE_USIM, "adn", contact, null, ICC_USIM_TYPE2_TAG, true);
+ do_test(CARD_APPTYPE_USIM, "adn", contact, null, ICC_USIM_TYPE2_TAG, false);
do_print("Test update USIM fdn contacts");
do_test(CARD_APPTYPE_USIM, "fdn", contact, "1234");
@@ -1811,8 +1847,9 @@ add_test(function test_update_icc_contact() {
// RUIM with enhanced phone book
do_print("Test update RUIM adn contacts with enhanced phone book");
- do_test(CARD_APPTYPE_RUIM, "adn", contact, null, ICC_USIM_TYPE1_TAG, true);
- do_test(CARD_APPTYPE_RUIM, "adn", contact, null, ICC_USIM_TYPE2_TAG, true);
+ do_test(CARD_APPTYPE_RUIM, "adn", contact, null, ICC_USIM_TYPE1_TAG, null, true);
+ do_test(CARD_APPTYPE_RUIM, "adn", contact, null, ICC_USIM_TYPE2_TAG, true, true);
+ do_test(CARD_APPTYPE_RUIM, "adn", contact, null, ICC_USIM_TYPE2_TAG, false, true);
do_print("Test update RUIM fdn contacts with enhanced phone book");
do_test(CARD_APPTYPE_RUIM, "fdn", contact, "1234", null, true);
diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js
index 806b4c6b5ed..4be4c24dc57 100644
--- a/dom/wifi/DOMWifiManager.js
+++ b/dom/wifi/DOMWifiManager.js
@@ -135,84 +135,75 @@ DOMWifiManager.prototype = {
return;
let request;
+ if (msg.rid) {
+ request = this.takeRequest(msg.rid);
+ if (!request) {
+ return;
+ }
+ }
+
switch (aMessage.name) {
case "WifiManager:getNetworks:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:getNetworks:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, "Unable to scan for networks");
break;
case "WifiManager:getKnownNetworks:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:getKnownNetworks:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, "Unable to get known networks");
break;
case "WifiManager:associate:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, true);
break;
case "WifiManager:associate:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, "Unable to add the network");
break;
case "WifiManager:forget:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, true);
break;
case "WifiManager:forget:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:wps:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:wps:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:setPowerSavingMode:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:setPowerSavingMode:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:setHttpProxy:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:setHttpProxy:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:setStaticIpMode:Return:OK":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
break;
case "WifiManager:setStaticIpMode:Return:NO":
- request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data);
break;
diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js
index e2acbef0742..acdbf3b3ad8 100644
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -2304,8 +2304,10 @@ WifiWorker.prototype = {
// Convert between netId-based and ssid-based indexing.
for (let net in networks) {
let network = networks[net];
+ delete networks[net];
+
if (!network.ssid) {
- delete networks[net]; // TODO support these?
+ WifiManager.removeNetwork(network.netId, function() {});
continue;
}
@@ -2313,8 +2315,11 @@ WifiWorker.prototype = {
this._highestPriority = network.priority;
let networkKey = getNetworkKey(network);
+ // Accept latest config of same network(same SSID and same security).
+ if (networks[networkKey]) {
+ WifiManager.removeNetwork(networks[networkKey].netId, function() {});
+ }
networks[networkKey] = network;
- delete networks[net];
}
this.configuredNetworks = networks;
@@ -2402,6 +2407,25 @@ WifiWorker.prototype = {
_sendMessage: function(message, success, data, msg) {
msg.manager.sendAsyncMessage(message + (success ? ":OK" : ":NO"),
{ data: data, rid: msg.rid, mid: msg.mid });
+ this._splicePendingRequest(msg);
+ },
+
+ _domRequest: [],
+
+ _splicePendingRequest: function(msg) {
+ for (let i = 0; i < this._domRequest.length; i++) {
+ if (this._domRequest[i].msg === msg) {
+ this._domRequest.splice(i, 1);
+ return;
+ }
+ }
+ },
+
+ _clearPendingRequest: function() {
+ if (this._domRequest.length === 0) return;
+ this._domRequest.forEach(function(req) {
+ this._sendMessage(req.name + ":Return", false, "Wifi is disabled", req.msg);
+ });
},
receiveMessage: function MessageManager_receiveMessage(aMessage) {
@@ -2433,6 +2457,11 @@ WifiWorker.prototype = {
return;
}
+ // We are interested in DOMRequests only.
+ if (aMessage.name != "WifiManager:getState") {
+ this._domRequest.push({name: aMessage.name, msg:msg});
+ }
+
switch (aMessage.name) {
case "WifiManager:getNetworks":
this.getNetworks(msg);
@@ -2612,6 +2641,11 @@ WifiWorker.prototype = {
},
setWifiEnabled: function(enabled, callback) {
+ // Reply error to pending requests.
+ if (!enabled) {
+ this._clearPendingRequest();
+ }
+
WifiManager.setWifiEnabled(enabled, callback);
},