mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 01:01:52 +00:00
Bug 827237 - Wifi: ap list in settings is empty. r=bent
This commit is contained in:
parent
01bdf679a7
commit
3d7a8df9eb
@ -111,6 +111,11 @@ SettingsLock.prototype = {
|
||||
}
|
||||
};
|
||||
}
|
||||
checkKeyRequest.onerror = function(event) {
|
||||
if (!request.error) {
|
||||
Services.DOMRequest.fireError(request, checkKeyRequest.error.name)
|
||||
}
|
||||
};
|
||||
}
|
||||
break;
|
||||
case "get":
|
||||
|
@ -55,22 +55,36 @@ SettingsServiceLock.prototype = {
|
||||
let message = info.message;
|
||||
if(typeof(value) == 'object')
|
||||
debug("object name:" + name + ", val: " + JSON.stringify(value));
|
||||
req = store.put({ settingName: name, settingValue: value });
|
||||
let checkKeyRequest = store.get(name);
|
||||
|
||||
req.onsuccess = function() {
|
||||
debug("set on success");
|
||||
lock._open = true;
|
||||
if (callback)
|
||||
callback.handle(name, value);
|
||||
Services.obs.notifyObservers(lock, "mozsettings-changed", JSON.stringify({
|
||||
key: name,
|
||||
value: value,
|
||||
message: message
|
||||
}));
|
||||
lock._open = false;
|
||||
};
|
||||
checkKeyRequest.onsuccess = function (event) {
|
||||
let defaultValue;
|
||||
if (event.target.result) {
|
||||
defaultValue = event.target.result.defaultValue;
|
||||
} else {
|
||||
defaultValue = null;
|
||||
if (DEBUG) debug("MOZSETTINGS-SET-WARNING: " + key + " is not in the database.\n");
|
||||
}
|
||||
|
||||
req.onerror = function(event) { callback ? callback.handleError(event.target.errorMessage) : null; };
|
||||
req = store.put({ settingName: name, defaultValue: defaultValue, userValue: value });
|
||||
|
||||
req.onsuccess = function() {
|
||||
if (DEBUG) debug("set on success");
|
||||
lock._open = true;
|
||||
if (callback)
|
||||
callback.handle(name, value);
|
||||
Services.obs.notifyObservers(lock, "mozsettings-changed", JSON.stringify({
|
||||
key: name,
|
||||
value: value,
|
||||
message: message
|
||||
}));
|
||||
lock._open = false;
|
||||
};
|
||||
|
||||
req.onerror = function(event) { callback ? callback.handleError(event.target.errorMessage) : null; };
|
||||
}
|
||||
|
||||
checkKeyRequest.onerror = function(event) { callback ? callback.handleError(event.target.errorMessage) : null; };
|
||||
break;
|
||||
case "get":
|
||||
req = store.mozGetAll(name);
|
||||
@ -83,7 +97,11 @@ SettingsServiceLock.prototype = {
|
||||
if (event.target.result.length > 1) {
|
||||
debug("Warning: overloaded setting:" + name);
|
||||
}
|
||||
callback.handle(name, event.target.result[0].settingValue);
|
||||
let result = event.target.result[0];
|
||||
let value = result.userValue !== undefined
|
||||
? result.userValue
|
||||
: result.defaultValue;
|
||||
callback.handle(name, value);
|
||||
} else
|
||||
callback.handle(name, null);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user