Bug 821484 - ASSERTION: mDone shouldn't have been set to true already!: '!mDone', file dom/base/DOMRequest.cpp, line 113. r=sicking

This commit is contained in:
Gregor Wagner 2012-12-13 16:46:13 -08:00
Родитель 25c6a67c56
Коммит 53230f5ec7
2 изменённых файлов: 50 добавлений и 6 удалений

Просмотреть файл

@ -54,7 +54,10 @@ SettingsLock.prototype = {
req.onerror = function() { Services.DOMRequest.fireError(request, 0) };
break;
case "set":
for (let key in info.settings) {
let keys = Object.getOwnPropertyNames(info.settings);
for (let i = 0; i < keys.length; i++) {
let key = keys[i];
let last = i === keys.length - 1;
debug("key: " + key + ", val: " + JSON.stringify(info.settings[key]) + ", type: " + typeof(info.settings[key]));
let checkKeyRequest = store.get(key);
@ -72,15 +75,19 @@ SettingsLock.prototype = {
req = store.put({settingName: key, settingValue: obj});
}
req.onsuccess = function() {
lock._open = true;
Services.DOMRequest.fireSuccess(request, 0);
req.onsuccess = function() {
if (last && !request.error) {
lock._open = true;
Services.DOMRequest.fireSuccess(request, 0);
lock._open = false;
}
cpmm.sendAsyncMessage("Settings:Changed", { key: key, value: info.settings[key] });
lock._open = false;
};
req.onerror = function() {
Services.DOMRequest.fireError(request, 0)
if (!request.error) {
Services.DOMRequest.fireError(request, req.error.name)
}
};
}
break;

Просмотреть файл

@ -43,6 +43,13 @@ var screenBright = {"screen.brightness": 0.7};
var wifiNetworks0 = { "wifi.networks[0]": { ssid: "myfreenetwork", mac: "01:23:45:67:89:ab", passwd: "secret"}};
var wifiNetworks1 = { "wifi.networks[1]": { ssid: "myfreenetwork2", mac: "01:23:45:67:89:ab", passwd: "secret2"}};
var combination = {
"wifi.enabled": false,
"screen.brightness": 0.7,
"wifi.networks[0]": { ssid: "myfreenetwork", mac: "01:23:45:67:89:ab", passwd: "secret" },
"test.test": true
}
function equals(o1, o2) {
var k1 = Object.keys(o1).sort();
var k2 = Object.keys(o2).sort();
@ -611,6 +618,36 @@ var steps = [
};
req.onerror = onFailure;
},
function() {
ok(true, "Set with multiple arguments");
var lock = mozSettings.createLock();
req = lock.set(combination);
req.onsuccess = function () {
ok(true, "Set Done");
next();
};
req.onerror = onFailure;
},
function() {
ok(true, "request argument from multiple set");
var lock = mozSettings.createLock();
req = lock.get("screen.brightness");
req.onsuccess = function () {
check(req.result["screen.brightness"], 0.7, "get done");
next();
}
req.onerror = onFailure;
},
function() {
ok(true, "Clear DB");
var lock = mozSettings.createLock();
req = lock.clear();
req.onsuccess = function () {
ok(true, "Deleted the database");
next();
};
req.onerror = onFailure;
},
function () {
ok(true, "all done!\n");
SimpleTest.finish();