summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/shell-prefs.js
blob: f0c2c8a2518de0ac53a599f73739d29cebda72ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// |jit-test| --setpref=site_based_pretenuring=false; --setpref=tests.uint32-pref=123450

let names = getAllPrefNames();
assertEq(names.length > 0, true, "Expected at least one pref!");
assertEq(new Set(names).size, names.length, "Unexpected duplicate pref name");

for (let name of names) {
    let val = getPrefValue(name);
    assertEq(typeof val === "number" || typeof val === "boolean", true);
}

// Check that --setpref worked. Note: this is just an arbitrary pref. If we ever
// remove it, change this test to check a different one.
assertEq(getPrefValue("site_based_pretenuring"), false);
assertEq(getPrefValue("tests.uint32-pref"), 123450);

// Must throw an exception for unknown pref names.
let ex;
try {
    getPrefValue("some.invalid.pref");
} catch (e) {
    ex = e;
}
assertEq(ex.toString(), "Error: invalid pref name");