mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1112936 - Enable settings API tests on e10s; r=gwagner r=bent r=gerard-majax
--HG-- extra : rebase_source : c5532dc6968c317e72399040a3024b6a22df0df8
This commit is contained in:
parent
b18f2dda2d
commit
b957e4dab3
17
dom/settings/tests/file_loadserver.js
Normal file
17
dom/settings/tests/file_loadserver.js
Normal file
@ -0,0 +1,17 @@
|
||||
let Ci = Components.interfaces;
|
||||
let Cc = Components.classes;
|
||||
let Cu = Components.utils;
|
||||
|
||||
// Stolen from SpecialPowers, since at this point we don't know we're in a test.
|
||||
let isMainProcess = function() {
|
||||
try {
|
||||
return Cc["@mozilla.org/xre/app-info;1"].
|
||||
getService(Ci.nsIXULRuntime).
|
||||
processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
} catch (e) { }
|
||||
return true;
|
||||
};
|
||||
|
||||
if (isMainProcess()) {
|
||||
Components.utils.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
[DEFAULT]
|
||||
skip-if = (toolkit == 'gonk' && debug) || e10s #debug-only failure, bug 932878
|
||||
skip-if = (toolkit == 'gonk' && debug) #debug-only failure, bug 932878
|
||||
support-files =
|
||||
file_loadserver.js
|
||||
|
||||
[test_settings_basics.html]
|
||||
[test_settings_permissions.html]
|
||||
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
|
||||
|
||||
"use strict";
|
||||
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||
SpecialPowers.addPermission("settings-api-write", true, document);
|
||||
SpecialPowers.addPermission("settings-read", true, document);
|
||||
@ -99,12 +97,10 @@ function check(o1, o2) {
|
||||
var req, req2, req3, req4, req5, req6;
|
||||
var index = 0;
|
||||
|
||||
var mozSettings = navigator.mozSettings;
|
||||
|
||||
var steps = [
|
||||
function () {
|
||||
ok(true, "Deleting database");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -113,14 +109,14 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Setting wifi");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifi);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
}
|
||||
req.onerror = onFailure;
|
||||
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req2 = lock2.get("net3g.apn");
|
||||
req2.onsuccess = function () {
|
||||
is(Object.keys(req2.result).length, 1, "length 1");
|
||||
@ -132,7 +128,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Change wifi1");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifi2);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -150,7 +146,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Set Combination");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req3 = lock.set(combination);
|
||||
req3.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -164,7 +160,7 @@ var steps = [
|
||||
req3.onerror = onFailure;
|
||||
},
|
||||
function() {
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req4 = lock.get("net3g.apn2");
|
||||
req4.onsuccess = function() {
|
||||
ok(true, "Done");
|
||||
@ -175,7 +171,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Get unknown key");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("abc.def");
|
||||
req.onsuccess = function() {
|
||||
is(req.result["abc.def"], undefined, "no result");
|
||||
@ -186,7 +182,7 @@ var steps = [
|
||||
function() {
|
||||
ok(true, "adding onsettingchange");
|
||||
navigator.mozSettings.onsettingchange = onsettingschangeWithNext;
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.get("screen.brightness");
|
||||
req2.onsuccess = function() {
|
||||
ok(true, "end adding onsettingchange");
|
||||
@ -196,7 +192,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Test onsettingchange");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done, observer has to call next");
|
||||
@ -205,7 +201,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "delete onsettingschange");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
navigator.mozSettings.onsettingchange = null;
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
@ -216,7 +212,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Waiting for all set callbacks");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function() {
|
||||
ok(true, "Done");
|
||||
@ -230,7 +226,7 @@ var steps = [
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.get("screen.brightness");
|
||||
req2.onsuccess = function() {
|
||||
ok(true, "set observeSetting done!");
|
||||
@ -240,7 +236,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test observers");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -249,7 +245,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -260,7 +256,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -269,7 +265,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
@ -282,7 +278,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
ok(true, "get done");
|
||||
@ -292,7 +288,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Nested test");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
req3 = lock.set({"screen.brightness": req.result["screen.brightness"] + 1})
|
||||
@ -313,7 +309,7 @@ var steps = [
|
||||
}
|
||||
req2.onerror = onFailure;
|
||||
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req5 = lock2.get("screen.brightness");
|
||||
req5.onsuccess = function () {
|
||||
is(req5.result["screen.brightness"], 1.7, "same Value");
|
||||
@ -323,7 +319,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Deleting database");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -331,7 +327,7 @@ var steps = [
|
||||
};
|
||||
},
|
||||
function () {
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.set(wifi);
|
||||
req2.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -339,7 +335,7 @@ var steps = [
|
||||
req2.onerror = onFailure;
|
||||
|
||||
ok(true, "Get all settings");
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req3 = lock2.get("*");
|
||||
req3.onsuccess = function () {
|
||||
is(Object.keys(req3.result).length, 1, "length 1");
|
||||
@ -360,7 +356,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Change wifi1");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifi2);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -379,8 +375,8 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test locking");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifiEnabled);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Test Locking Done");
|
||||
@ -396,7 +392,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test locking result");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("wifi.enabled");
|
||||
req.onsuccess = function() {
|
||||
check(req.result, wifiDisabled);
|
||||
@ -409,7 +405,7 @@ var steps = [
|
||||
ok(true, "Test locking heavy");
|
||||
for (var i=0; i<30; i++) {
|
||||
// only new locks!
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
var obj = {};
|
||||
obj["wifi.enabled" + i] = true;
|
||||
req = lock.set( obj );
|
||||
@ -419,7 +415,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
};
|
||||
{
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req2 = lock2.get("*");
|
||||
req2.onsuccess = function () {
|
||||
is(Object.keys(req2.result).length, 32, "length 12");
|
||||
@ -428,7 +424,7 @@ var steps = [
|
||||
};
|
||||
req2.onerror = onFailure;
|
||||
}
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
var obj = {};
|
||||
obj["wifi.enabled" + 30] = true;
|
||||
req3 = lock2.set( obj );
|
||||
@ -437,7 +433,7 @@ var steps = [
|
||||
};
|
||||
req3.onerror = onFailure;
|
||||
|
||||
var lock3 = mozSettings.createLock();
|
||||
var lock3 = navigator.mozSettings.createLock();
|
||||
// with one lock
|
||||
for (var i = 0; i < 30; i++) {
|
||||
req4 = lock3.get("wifi.enabled" + i);
|
||||
@ -451,7 +447,7 @@ var steps = [
|
||||
}
|
||||
|
||||
ok(true, "start next2!");
|
||||
var lock4 = mozSettings.createLock();
|
||||
var lock4 = navigator.mozSettings.createLock();
|
||||
for (var i=0; i<30; i++) {
|
||||
var obj = {};
|
||||
obj["wifi.enabled" + i] = false;
|
||||
@ -461,7 +457,7 @@ var steps = [
|
||||
};
|
||||
req4.onerror = onFailure;
|
||||
}
|
||||
var lock5 = mozSettings.createLock();
|
||||
var lock5 = navigator.mozSettings.createLock();
|
||||
for (var i=0; i<30; i++) {
|
||||
req5 = lock5.get("wifi.enabled" + i);
|
||||
var testObj = {};
|
||||
@ -473,7 +469,7 @@ var steps = [
|
||||
req5.onerror = onFailure;
|
||||
}
|
||||
|
||||
var lock6 = mozSettings.createLock();
|
||||
var lock6 = navigator.mozSettings.createLock();
|
||||
req6 = lock6.clear();
|
||||
req6.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -483,8 +479,8 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "reverse Test locking");
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
|
||||
req = lock.set(wifiEnabled);
|
||||
req.onsuccess = function () {
|
||||
@ -501,7 +497,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test locking result");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
|
||||
req = lock.get("wifi.enabled");
|
||||
req.onsuccess = function() {
|
||||
@ -510,14 +506,14 @@ var steps = [
|
||||
}
|
||||
req.onerror = onFailure;
|
||||
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req2 = lock2.clear();
|
||||
req2.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
};
|
||||
req2.onerror = onFailure;
|
||||
|
||||
var lock3 = mozSettings.createLock();
|
||||
var lock3 = navigator.mozSettings.createLock();
|
||||
req3 = lock3.set(wifi);
|
||||
req3.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -528,7 +524,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get all settings");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("*");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 1, "length 1");
|
||||
@ -540,7 +536,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get net3g.apn");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("net3g.apn");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 1, "length 1");
|
||||
@ -552,7 +548,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Change wifi2");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifi2);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -562,7 +558,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get net3g.apn");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("net3g.apn");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 1, "length 1");
|
||||
@ -574,7 +570,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Add wifi.enabled");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifiEnabled);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -584,7 +580,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get Wifi Enabled");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("wifi.enabled");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 1, "length 1");
|
||||
@ -596,7 +592,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get all");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("*");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 2, "length 2");
|
||||
@ -609,7 +605,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Add wifiNetworks");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifiNetworks0);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -625,7 +621,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get Wifi Networks");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("wifi.networks[0]");
|
||||
req.onsuccess = function () {
|
||||
is(Object.keys(req.result).length, 1, "length 1");
|
||||
@ -637,12 +633,12 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB, multiple locks");
|
||||
var lock4 = mozSettings.createLock();
|
||||
var lock3 = mozSettings.createLock();
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock = mozSettings.createLock();
|
||||
var lock6 = mozSettings.createLock();
|
||||
var lock7 = mozSettings.createLock();
|
||||
var lock4 = navigator.mozSettings.createLock();
|
||||
var lock3 = navigator.mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
var lock6 = navigator.mozSettings.createLock();
|
||||
var lock7 = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -652,7 +648,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Add wifiNetworks");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifiNetworks0);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -662,7 +658,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test set after lock closed");
|
||||
var lockx = mozSettings.createLock();
|
||||
var lockx = navigator.mozSettings.createLock();
|
||||
var cb = function() {
|
||||
var reqx = null;
|
||||
try {
|
||||
@ -678,7 +674,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -688,7 +684,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Set with multiple arguments");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(combination);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Set Done");
|
||||
@ -698,7 +694,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "request argument from multiple set");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
check(req.result["screen.brightness"], 0.7, "get done");
|
||||
@ -708,7 +704,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Test closed attribute on a valid lock");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
is(lock.closed, false, "closed attribute is false on creation");
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
@ -719,7 +715,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Test closed attribute on invalid lock");
|
||||
var lockx = mozSettings.createLock();
|
||||
var lockx = navigator.mozSettings.createLock();
|
||||
var cb = function() {
|
||||
var reqx = null;
|
||||
try {
|
||||
@ -735,7 +731,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -745,7 +741,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Set object value");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set({"setting-obj": {foo: {bar: 23}}});
|
||||
req.onsuccess = function() {
|
||||
req2 = lock.get("setting-obj");
|
||||
@ -761,7 +757,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -771,7 +767,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Call success callback when transaction commits");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
lock.onsettingstransactionsuccess = function () {
|
||||
next();
|
||||
};
|
||||
@ -789,7 +785,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=821630
|
||||
|
||||
"use strict";
|
||||
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
SpecialPowers.addPermission("settings-read", true, document);
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||
@ -45,7 +43,6 @@ function onFailure() {
|
||||
}
|
||||
}
|
||||
|
||||
let mozSettings = window.navigator.mozSettings;
|
||||
let req;
|
||||
|
||||
let storedBlob = new Blob(['12345'], {"type": "text/plain"});
|
||||
@ -61,7 +58,7 @@ function checkBlob(blob) {
|
||||
|
||||
let steps = [
|
||||
function() {
|
||||
let lock = mozSettings.createLock();
|
||||
let lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = next;
|
||||
req.onerror = onFailure("Deleting database");
|
||||
@ -69,19 +66,19 @@ let steps = [
|
||||
function() {
|
||||
function obs(e) {
|
||||
checkBlob(e.settingValue);
|
||||
mozSettings.removeObserver("test1", obs);
|
||||
navigator.mozSettings.removeObserver("test1", obs);
|
||||
next();
|
||||
}
|
||||
mozSettings.addObserver("test1", obs);
|
||||
navigator.mozSettings.addObserver("test1", obs);
|
||||
next();
|
||||
},
|
||||
function() {
|
||||
// next is called by the observer above
|
||||
let req = mozSettings.createLock().set({"test1": storedBlob});
|
||||
let req = navigator.mozSettings.createLock().set({"test1": storedBlob});
|
||||
req.onerror = onFailure("Saving blob");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test1");
|
||||
let req = navigator.mozSettings.createLock().get("test1");
|
||||
req.onsuccess = function(event) {
|
||||
checkBlob(event.target.result["test1"]);
|
||||
next();
|
||||
@ -89,12 +86,12 @@ let steps = [
|
||||
req.onerror = onFailure("Getting blob");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().set({"test2": [1, 2, storedBlob, 4]});
|
||||
let req = navigator.mozSettings.createLock().set({"test2": [1, 2, storedBlob, 4]});
|
||||
req.onsuccess = next;
|
||||
req.onerror = onFailure("Saving array");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test2");
|
||||
let req = navigator.mozSettings.createLock().get("test2");
|
||||
req.onsuccess = function(event) {
|
||||
let val = event.target.result["test2"];
|
||||
ok(Array.isArray(val), "Result is an array");
|
||||
@ -105,12 +102,12 @@ let steps = [
|
||||
req.onerror = onFailure("Getting array");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [storedBlob]}}});
|
||||
let req = navigator.mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [storedBlob]}}});
|
||||
req.onsuccess = next();
|
||||
req.onerror = onFailure("Saving object");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test3");
|
||||
let req = navigator.mozSettings.createLock().get("test3");
|
||||
req.onsuccess = function(event) {
|
||||
let val = event.target.result["test3"];
|
||||
ok(typeof(val) == "object", "Result is an object");
|
||||
@ -125,7 +122,7 @@ let steps = [
|
||||
req.onerror = onFailure("Getting object");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().clear();
|
||||
let req = navigator.mozSettings.createLock().clear();
|
||||
req.onsuccess = function() {
|
||||
next();
|
||||
};
|
||||
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=806374
|
||||
|
||||
"use strict";
|
||||
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
SpecialPowers.addPermission("settings-read", true, document);
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||
@ -45,7 +43,6 @@ function onFailure() {
|
||||
}
|
||||
}
|
||||
|
||||
let mozSettings = window.navigator.mozSettings;
|
||||
let req;
|
||||
|
||||
// A simple data URI that will be converted to a blob.
|
||||
@ -62,7 +59,7 @@ function checkBlob(blob) {
|
||||
|
||||
let steps = [
|
||||
function() {
|
||||
let lock = mozSettings.createLock();
|
||||
let lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = next;
|
||||
req.onerror = onFailure("Deleting database");
|
||||
@ -70,19 +67,19 @@ let steps = [
|
||||
function() {
|
||||
function obs(e) {
|
||||
checkBlob(e.settingValue);
|
||||
mozSettings.removeObserver("test1", obs);
|
||||
navigator.mozSettings.removeObserver("test1", obs);
|
||||
next();
|
||||
}
|
||||
mozSettings.addObserver("test1", obs);
|
||||
navigator.mozSettings.addObserver("test1", obs);
|
||||
next();
|
||||
},
|
||||
function() {
|
||||
// next is called by the observer above
|
||||
let req = mozSettings.createLock().set({"test1": dataURI});
|
||||
let req = navigator.mozSettings.createLock().set({"test1": dataURI});
|
||||
req.onerror = onFailure("Saving blob");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test1");
|
||||
let req = navigator.mozSettings.createLock().get("test1");
|
||||
req.onsuccess = function(event) {
|
||||
checkBlob(event.target.result["test1"]);
|
||||
next();
|
||||
@ -90,12 +87,12 @@ let steps = [
|
||||
req.onerror = onFailure("Getting blob");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().set({"test2": [1, 2, dataURI, 4]});
|
||||
let req = navigator.mozSettings.createLock().set({"test2": [1, 2, dataURI, 4]});
|
||||
req.onsuccess = next;
|
||||
req.onerror = onFailure("Saving array");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test2");
|
||||
let req = navigator.mozSettings.createLock().get("test2");
|
||||
req.onsuccess = function(event) {
|
||||
let val = event.target.result["test2"];
|
||||
ok(Array.isArray(val), "Result is an array");
|
||||
@ -106,12 +103,12 @@ let steps = [
|
||||
req.onerror = onFailure("Getting array");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [dataURI]}}});
|
||||
let req = navigator.mozSettings.createLock().set({"test3": {foo: "bar", baz: {number: 1, arr: [dataURI]}}});
|
||||
req.onsuccess = next();
|
||||
req.onerror = onFailure("Saving object");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().get("test3");
|
||||
let req = navigator.mozSettings.createLock().get("test3");
|
||||
req.onsuccess = function(event) {
|
||||
let val = event.target.result["test3"];
|
||||
ok(typeof(val) == "object", "Result is an object");
|
||||
@ -126,7 +123,7 @@ let steps = [
|
||||
req.onerror = onFailure("Getting object");
|
||||
},
|
||||
function() {
|
||||
let req = mozSettings.createLock().clear();
|
||||
let req = navigator.mozSettings.createLock().clear();
|
||||
req.onsuccess = function() {
|
||||
next();
|
||||
};
|
||||
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=678695
|
||||
|
||||
"use strict";
|
||||
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
SpecialPowers.addPermission("settings-write", true, document);
|
||||
SpecialPowers.addPermission("settings-read", true, document);
|
||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||
@ -83,12 +81,10 @@ function onComplexSettingschangeWithNext(event) {
|
||||
var req, req2;
|
||||
var index = 0;
|
||||
|
||||
var mozSettings = window.navigator.mozSettings;
|
||||
|
||||
var steps = [
|
||||
function () {
|
||||
ok(true, "Deleting database");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -97,7 +93,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.set(screenBright);
|
||||
req2.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
@ -108,7 +104,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "testing");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.set(screenBright);
|
||||
req2.onsuccess = function() {
|
||||
ok(true, "end adding onsettingchange");
|
||||
@ -117,7 +113,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test observers");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
ok(true, "get done");
|
||||
@ -131,7 +127,7 @@ var steps = [
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observerOnlyCalledOnce);
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.get("screen.brightness");
|
||||
req2.onsuccess = function() {
|
||||
ok(true, "set observeSetting done!");
|
||||
@ -141,7 +137,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test observers");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set1 done");
|
||||
@ -150,7 +146,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test observers");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
navigator.mozSettings.removeObserver("screen.brightness", observerOnlyCalledOnce);
|
||||
req.onsuccess = function () {
|
||||
@ -160,7 +156,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set2 done");
|
||||
@ -173,7 +169,7 @@ var steps = [
|
||||
|
||||
function() {
|
||||
ok(true, "delete onsettingschange");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
navigator.mozSettings.onsettingchange = null;
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
@ -184,7 +180,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Waiting for all set callbacks");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function() {
|
||||
ok(true, "Done");
|
||||
@ -198,7 +194,7 @@ var steps = [
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer1);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observer2);
|
||||
navigator.mozSettings.addObserver("screen.brightness", observerWithNext);
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req2 = lock.get("screen.brightness");
|
||||
req2.onsuccess = function() {
|
||||
ok(true, "set observeSetting done!");
|
||||
@ -208,7 +204,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test observers");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set1 done");
|
||||
@ -217,7 +213,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set2 done");
|
||||
@ -228,7 +224,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "test Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set3 done");
|
||||
@ -237,7 +233,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
navigator.mozSettings.removeObserver("screen.brightness", observerWithNext);
|
||||
req = lock.set(screenBright);
|
||||
req.onsuccess = function () {
|
||||
@ -250,7 +246,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "removing Event Listener");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("screen.brightness");
|
||||
req.onsuccess = function () {
|
||||
ok(true, "get5 done");
|
||||
@ -260,7 +256,7 @@ var steps = [
|
||||
},
|
||||
function() {
|
||||
ok(true, "Clear DB");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -270,7 +266,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Deleting database");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.clear();
|
||||
req.onsuccess = function () {
|
||||
ok(true, "Deleted the database");
|
||||
@ -279,7 +275,7 @@ var steps = [
|
||||
req.onerror = onFailure;
|
||||
},
|
||||
function () {
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
navigator.mozSettings.onsettingchange = onComplexSettingschangeWithNext;
|
||||
req2 = navigator.mozSettings.createLock().set({'test.key': cset});
|
||||
req2.onsuccess = function () {
|
||||
|
@ -21,10 +21,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id={678695}
|
||||
|
||||
"use strict";
|
||||
|
||||
if (SpecialPowers.isMainProcess()) {
|
||||
SpecialPowers.Cu.import("resource://gre/modules/SettingsRequestManager.jsm");
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("file_loadserver.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
SpecialPowers.removePermission("settings-read", document);
|
||||
SpecialPowers.removePermission("settings-write", document);
|
||||
SpecialPowers.addPermission("settings-api-read", true, document);
|
||||
@ -80,21 +78,19 @@ function check(o1, o2) {
|
||||
var req, req2, req3, req4, req5, req6;
|
||||
var index = 0;
|
||||
|
||||
var mozSettings = navigator.mozSettings;
|
||||
|
||||
var steps = [
|
||||
// Can't delete database here since that requires permissions we don't want
|
||||
// to give the page.
|
||||
function () {
|
||||
ok(true, "Setting wallpaper");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wallpaper);
|
||||
req.onsuccess = function () {
|
||||
ok(true, "set done");
|
||||
}
|
||||
req.onerror = onFailure;
|
||||
|
||||
var lock2 = mozSettings.createLock();
|
||||
var lock2 = navigator.mozSettings.createLock();
|
||||
req2 = lock2.get("wallpaper.image");
|
||||
req2.onsuccess = function () {
|
||||
is(Object.keys(req2.result).length, 1, "length 1");
|
||||
@ -106,7 +102,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Get Wifi");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.get("wifi.enabled");
|
||||
req.onerror = function () {
|
||||
ok(true, "get failed (expected)");
|
||||
@ -116,7 +112,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Set Wifi");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(wifi);
|
||||
req.onerror = function () {
|
||||
ok(true, "set failed (expected)");
|
||||
@ -126,7 +122,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Set combination (1 valid 1 not valid)");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(combination);
|
||||
req.onerror = function () {
|
||||
ok(true, "set failed (expected)");
|
||||
@ -136,7 +132,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "All requests on a failed lock should fail");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
lock.onsettingstransactionfailure = function (evt) {
|
||||
ok(evt.error == "Lock failed a permissions check, all requests now failing.", "transaction failure on permissions error message correct.");
|
||||
ok(true, "transaction failed (expected) ");
|
||||
@ -157,7 +153,7 @@ var steps = [
|
||||
},
|
||||
function () {
|
||||
ok(true, "Set combination (1 valid 1 not valid)");
|
||||
var lock = mozSettings.createLock();
|
||||
var lock = navigator.mozSettings.createLock();
|
||||
req = lock.set(combination);
|
||||
req.onerror = function () {
|
||||
ok(true, "set failed (expected)");
|
||||
|
Loading…
Reference in New Issue
Block a user