Bug 553417 - Rewrite tests to use pushPrefEnv. r=mats
authorMartijn Wargers <mwargers@mozilla.com>
Fri, 04 Mar 2016 12:23:23 -0500
changeset 286864 9cc5bb93e4e9bf299d69b9619c59ea29f1ac9a7e
parent 286863 e484503a368c8fea8084e4402611da32a47ba73d
child 286865 0c220ff8ce852e1c9a53cdbfb9989e8e4b7bbe69
push id30056
push userryanvm@gmail.com
push dateSun, 06 Mar 2016 00:19:57 +0000
treeherdermozilla-central@fcd55efa0672 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs553417
milestone47.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 553417 - Rewrite tests to use pushPrefEnv. r=mats
dom/events/test/bug299673.js
dom/events/test/test_bug299673-1.html
dom/events/test/test_bug299673-2.html
--- a/dom/events/test/bug299673.js
+++ b/dom/events/test/bug299673.js
@@ -90,20 +90,16 @@ function doTest1(expectedEventLog,focusA
   } catch(e) {
     if (popup)
       popup.close();
     throw e;
   }
 }
 
 function setPrefAndDoTest(expectedEventLog,focusAfterCloseId,prefValue) {
-  var origPrefValue = SpecialPowers.getIntPref("browser.link.open_newwindow");
   var select1 = document.getElementById('Select1');
   select1.blur();
   result = "";
   log({},"Test with browser.link.open_newwindow = "+prefValue);
-  try {
-    SpecialPowers.setIntPref("browser.link.open_newwindow", prefValue);
-    doTest1(expectedEventLog,focusAfterCloseId);
-  } finally {
-    SpecialPowers.setIntPref("browser.link.open_newwindow", origPrefValue);
-  }
+   SpecialPowers.pushPrefEnv({"set": [['browser.link.open_newwindow', prefValue]]}, function() {
+     doTest1(expectedEventLog,focusAfterCloseId);
+   });
 }
--- a/dom/events/test/test_bug299673-1.html
+++ b/dom/events/test/test_bug299673-1.html
@@ -48,14 +48,14 @@ SELECT(Select1): blur \n\
 INPUT(popupText1): blur \n\
 : blur popup-doc\n\
 : focus top-doc\n\
 '
 
   setPrefAndDoTest(eventLogForNewWindow,'Body',2);  // 2 = open new window as window
 }
 
-todo(false, "Please write a test for bug 299673 that actually works");
+todo(false, "Please write a test for bug 299673 that actually works, see bug 553417");
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/events/test/test_bug299673-2.html
+++ b/dom/events/test/test_bug299673-2.html
@@ -36,25 +36,25 @@ https://bugzilla.mozilla.org/show_bug.cg
 function doTest(expectedEventLog) {
   var eventLogForNewTab = '\
  :  Test with browser.link.open_newwindow = 3\n\
 : focus top-doc\n\
 SELECT(Select1): focus \n\
 SELECT(Select1): change \n\
  :  >>> OpenWindow\n\
 : blur top-doc\n\
+: focus popup-doc\n\
 INPUT(popupText1): focus \n\
  :  <<< OpenWindow\n\
 SELECT(Select1): blur \n\
 INPUT(popupText1): blur \n\
 : blur popup-doc\n\
 : focus top-doc\n\
 '
   setPrefAndDoTest(eventLogForNewTab,'Body',3);  // 3 = open new window as tab
-
 }
 
-todo(false, "Please write a test for bug 299673 that actually works");
+todo(false, "Please write a test for bug 299673 that actually works, see bug 553417");
 
 </script>
 </pre>
 </body>
 </html>