Bug 1241557 - Don't try to set prefs directly. r=wchen

This commit is contained in:
Blake Kaplan 2016-01-21 16:14:27 -08:00
parent 85bb824b0d
commit 303f79daed

View File

@ -19,24 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=513439
/** Test for Bug 513439 **/
var prefService = SpecialPowers.Cc["@mozilla.org/preferences-service;1"]
.getService(SpecialPowers.Ci.nsIPrefService);
var layoutCSSBranch = prefService.getBranch("layout.css.");
var oldVal = layoutCSSBranch.getCharPref("devPixelsPerPx");
SimpleTest.waitForExplicitFinish();
try {
var domWindowUtils = SpecialPowers.DOMWindowUtils;
var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
layoutCSSBranch.setCharPref("devPixelsPerPx", "2");
var domWindowUtils = SpecialPowers.DOMWindowUtils;
SpecialPowers.pushPrefEnv({set: [["layout.css.devPixelsPerPx", "2"]]}, () => {
is(domWindowUtils.screenPixelsPerCSSPixel, 2, "devPixelsPerPx wasn't set correctly");
layoutCSSBranch.setCharPref("devPixelsPerPx", "1.5");
is(domWindowUtils.screenPixelsPerCSSPixel, 1.5, "devPixelsPerPx wasn't set correctly");
} finally {
layoutCSSBranch.setCharPref("devPixelsPerPx", oldVal);
}
SpecialPowers.pushPrefEnv({set: [["layout.css.devPixelsPerPx", "1.5"]]}, () => {
is(domWindowUtils.screenPixelsPerCSSPixel, 1.5, "devPixelsPerPx wasn't set correctly");
SimpleTest.finish();
});
});
</script>
</pre>