Bug 1420311 - Remove hack from test_stickyprefs.js. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 24 Nov 2017 10:39:23 +0900
changeset 702933 aee3c84f20e5478ca8e0f2d21b95db8fa7b11ce1
parent 702789 0bb0f14672fdda31c19aea1ed829e050d693b9af
child 741604 7a1ad6fb497db229c478624f31f3417e54af3227
push id90636
push userbmo:mh+mozilla@glandium.org
push dateFri, 24 Nov 2017 01:43:13 +0000
reviewersnjn
bugs1420311, 1367813
milestone59.0a1
Bug 1420311 - Remove hack from test_stickyprefs.js. r?njn Before bug 1367813, the code in test_stickyprefs.js, using readUserPrefs, would end up changing the file under which the preferences service would save user prefs, making xpcshell possibly overwrite the test data files at the end of the test run. A hack was put in place to avoid this, that is not required anymore.
modules/libpref/test/unit/test_stickyprefs.js
--- a/modules/libpref/test/unit/test_stickyprefs.js
+++ b/modules/libpref/test/unit/test_stickyprefs.js
@@ -1,24 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/  */
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 const ps = Services.prefs;
 
-// Once we fetch the profile directory the xpcshell test harness will send
-// a profile-before-change notification at shutdown. This causes the prefs
-// service to flush the prefs file - and the prefs file it uses ends up being
-// testPrefSticky*.js in the test dir. This upsets things in confusing ways :)
-// We avoid this by ensuring our "temp" prefs.js is the current prefs file.
-do_get_profile();
-do_register_cleanup(saveAndReload);
-
 // A little helper to reset the service and load some pref files
 function resetAndLoad(filenames) {
   ps.resetPrefs();
   for (let filename of filenames) {
     ps.readUserPrefsFromFile(do_get_file(filename));
   }
 }