Bug 1241252, part 1 - Use pushPrefEnv in test_bug61098.html. r=mrbkap
authorAndrew McCreight <continuation@gmail.com>
Thu, 21 Jan 2016 09:57:29 -0800
changeset 281080 ddc78894cf28b214d882596524b4e348732017cc
parent 281079 952331e23d98d9d5857ba31dbc6a9e5d088daf4c
child 281081 65d4e80be3e3a35ae99377b68f8a4493a172d46b
push id29930
push usercbook@mozilla.com
push dateFri, 22 Jan 2016 11:05:50 +0000
treeherdermozilla-central@7104d650a97d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1241252, 61098
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1241252, part 1 - Use pushPrefEnv in test_bug61098.html. r=mrbkap
dom/tests/mochitest/bugs/test_bug61098.html
--- a/dom/tests/mochitest/bugs/test_bug61098.html
+++ b/dom/tests/mochitest/bugs/test_bug61098.html
@@ -212,38 +212,27 @@ function registerMockPromptService()
   mockPromptFactoryRegisterer =
     new MockObjectRegisterer("@mozilla.org/prompter;1",
                              MockPromptService);
 
   mockPromptServiceRegisterer.register();
   mockPromptFactoryRegisterer.register();
 };
 
-function enableDialogLoopBlocking()
-{
-  var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"].
-    getService(SpecialPowers.Ci.nsIPrefBranch);
-
-  prefs.setIntPref("dom.successive_dialog_time_limit", 3);
-}
-
-function resetDialogLoopBlocking()
-{
-  var prefs = SpecialPowers.Cc["@mozilla.org/preferences-service;1"].
-    getService(SpecialPowers.Ci.nsIPrefBranch);
-
-  prefs.setIntPref("dom.successive_dialog_time_limit", 0);
-}
-
 var expectedState;
 
 function runtests()
 {
+  SpecialPowers.pushPrefEnv({'set': [["dom.successive_dialog_time_limit", 3]]},
+                            runtestsInner);
+}
+
+function runtestsInner()
+{
   registerMockPromptService();
-  enableDialogLoopBlocking();
 
   // Test that alert() works normally and then gets blocked on the
   // second call.
   w = window.open();
   w.alert("alert message 1");
   is (promptState.method, "alert", "Wrong prompt method called");
   is (promptState.parent, w, "Wrong alert parent");
   is (promptState.msg, "alert message 1", "Wrong alert message");
@@ -333,18 +322,16 @@ function runtests()
   is (promptState.method, "confirm", "Wrong prompt method called");
   is (promptState.parent, w, "Wrong confirm parent");
   is (promptState.msg, "Prevent this page from creating additional dialogs",
       "Wrong confirm message");
   promptState = void(0);
 
   w.close();
 
-  resetDialogLoopBlocking();
-
   mockPromptFactoryRegisterer.unregister();
   mockPromptServiceRegisterer.unregister();
 
   SimpleTest.finish();
 }
 
 </script>
 </body>