test_update_prefs.js (877B)
1 function isParentProcess() { 2 return Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; 3 } 4 5 function run_test() { 6 if (isParentProcess()) { 7 do_load_child_test_harness(); 8 9 var pb = Services.prefs; 10 11 // these prefs are set after the child has been created. 12 pb.setBoolPref("Test.IPC.bool.new", true); 13 pb.setIntPref("Test.IPC.int.new", 23); 14 pb.setCharPref("Test.IPC.char.new", "hey"); 15 16 run_test_in_child("test_observed_prefs.js", testPrefClear); 17 } 18 } 19 20 function testPrefClear() { 21 var pb = Services.prefs; 22 pb.clearUserPref("Test.IPC.bool.new"); 23 24 sendCommand( 25 'var pb = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);\n' + 26 'pb.prefHasUserValue("Test.IPC.bool.new");\n', 27 checkWasCleared 28 ); 29 } 30 31 function checkWasCleared(existsStr) { 32 Assert.equal(existsStr, "false"); 33 do_test_finished(); 34 }