tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug506224.js (799B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/licenses/publicdomain/  */
      3 
      4 function run_test() {
      5  const PREF_NAME = "testPref";
      6 
      7  var prefs = Services.prefs.getDefaultBranch(null);
      8  var userprefs = Services.prefs.getBranch(null);
      9 
     10  prefs.setCharPref(PREF_NAME, "test0");
     11  prefs.lockPref(PREF_NAME);
     12  Assert.equal("test0", userprefs.getCharPref(PREF_NAME));
     13  Assert.equal(false, userprefs.prefHasUserValue(PREF_NAME));
     14 
     15  var file = do_get_profile();
     16  file.append("prefs.js");
     17  Services.prefs.savePrefFile(file);
     18 
     19  prefs.unlockPref(PREF_NAME);
     20  prefs.setCharPref(PREF_NAME, "test1");
     21  Services.prefs.readUserPrefsFromFile(file);
     22 
     23  Assert.equal("test1", userprefs.getCharPref(PREF_NAME));
     24  Assert.equal(false, userprefs.prefHasUserValue(PREF_NAME));
     25 }