Bug 999604 - fix browser-chrome tests in toolkit/content/ to not replace the original tab; r=ehsan
authorNathan Froyd <froydnj@mozilla.com>
Tue, 22 Apr 2014 11:55:33 -0400
changeset 198470 a09de35d4423b30f7a050a063858f6b726bb17c0
parent 198469 1f37af745467ae382b25602650bba1db5f86111a
child 198471 5d58360288863dbd041980ff5c42535e3f105f23
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs999604
milestone31.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 999604 - fix browser-chrome tests in toolkit/content/ to not replace the original tab; r=ehsan
toolkit/content/tests/browser/browser_autoscroll_disabled.js
toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
toolkit/content/tests/browser/browser_default_image_filename.js
toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
toolkit/content/tests/browser/browser_save_resend_postdata.js
--- a/toolkit/content/tests/browser/browser_autoscroll_disabled.js
+++ b/toolkit/content/tests/browser/browser_autoscroll_disabled.js
@@ -1,13 +1,15 @@
 function test()
 {
   const kPrefName_AutoScroll = "general.autoScroll";
   Services.prefs.setBoolPref(kPrefName_AutoScroll, false);
 
+  gBrowser.selectedTab = gBrowser.addTab();
+
   var doc;
 
   function startLoad(dataUri) {
     gBrowser.selectedBrowser.addEventListener("pageshow", onLoad, false);
     gBrowser.loadURI(dataUri);
   }
 
   function onLoad() {
@@ -21,17 +23,16 @@ function test()
   }
 
   function endTest() {
     // restore the changed prefs
     if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
       Services.prefs.clearUserPref(kPrefName_AutoScroll);
 
     // cleaning-up
-    gBrowser.addTab("about:blank");
     gBrowser.removeCurrentTab();
 
     // waitForFocus() fixes a failure in the next test if the latter runs too soon.
     waitForFocus(finish);
   }
 
   waitForExplicitFinish();
 
--- a/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
+++ b/toolkit/content/tests/browser/browser_bug295977_autoscroll_overflow.js
@@ -1,13 +1,15 @@
 function test()
 {
   const kPrefName_AutoScroll = "general.autoScroll";
   Services.prefs.setBoolPref(kPrefName_AutoScroll, true);
 
+  gBrowser.selectedTab = gBrowser.addTab();
+
   const expectScrollNone = 0;
   const expectScrollVert = 1;
   const expectScrollHori = 2;
   const expectScrollBoth = 3;
 
   var allTests = [
     {dataUri: 'data:text/html,<body><style type="text/css">div { display: inline-block; }</style>\
       <div id="a" style="width: 100px; height: 100px; overflow: hidden;"><div style="width: 200px; height: 200px;"></div></div>\
@@ -120,15 +122,14 @@ function test()
   }
 
   function endTest() {
     // restore the changed prefs
     if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
       Services.prefs.clearUserPref(kPrefName_AutoScroll);
 
     // cleaning-up
-    gBrowser.addTab("about:blank");
     gBrowser.removeCurrentTab();
 
     // waitForFocus() fixes a failure in the next test if the latter runs too soon.
     waitForFocus(finish);
   }
 }
--- a/toolkit/content/tests/browser/browser_default_image_filename.js
+++ b/toolkit/content/tests/browser/browser_default_image_filename.js
@@ -7,20 +7,21 @@ MockFilePicker.init(window);
 /**
  * TestCase for bug 564387
  * <https://bugzilla.mozilla.org/show_bug.cgi?id=564387>
  */
 function test() {
   waitForExplicitFinish();
   var fileName;
 
+  gBrowser.selectedTab = gBrowser.addTab();
+
   gBrowser.loadURI("data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub//ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcppV0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7");
 
   registerCleanupFunction(function () {
-    gBrowser.addTab().linkedBrowser.stop();
     gBrowser.removeCurrentTab();
   });
 
   gBrowser.addEventListener("pageshow", function pageShown(event) {
     if (event.target.location == "about:blank")
       return;
     gBrowser.removeEventListener("pageshow", pageShown);
 
--- a/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
+++ b/toolkit/content/tests/browser/browser_keyevents_during_autoscrolling.js
@@ -1,13 +1,15 @@
 function test()
 {
   const kPrefName_AutoScroll = "general.autoScroll";
   Services.prefs.setBoolPref(kPrefName_AutoScroll, true);
 
+  gBrowser.selectedTab = gBrowser.addTab();
+
   const kNoKeyEvents   = 0;
   const kKeyDownEvent  = 1;
   const kKeyPressEvent = 2;
   const kKeyUpEvent    = 4;
   const kAllKeyEvents  = 7;
 
   var expectedKeyEvents;
   var dispatchedKeyEvents;
@@ -121,14 +123,13 @@ function test()
     root.removeEventListener("keypress", onKey, true);
     root.removeEventListener("keyup", onKey, true);
 
     // restore the changed prefs
     if (Services.prefs.prefHasUserValue(kPrefName_AutoScroll))
       Services.prefs.clearUserPref(kPrefName_AutoScroll);
 
     // cleaning-up
-    gBrowser.addTab().linkedBrowser.stop();
     gBrowser.removeCurrentTab();
 
     finish();
   }
 }
--- a/toolkit/content/tests/browser/browser_save_resend_postdata.js
+++ b/toolkit/content/tests/browser/browser_save_resend_postdata.js
@@ -12,20 +12,21 @@ MockFilePicker.init(window);
  *
  * Test for bug 485196 <https://bugzilla.mozilla.org/show_bug.cgi?id=485196>:
  * Web page generated by POST is retried as GET when Save Frame As used, and the
  * page is no longer in the cache.
  */
 function test() {
   waitForExplicitFinish();
 
+  gBrowser.selectedTab = gBrowser.addTab();
+
   gBrowser.loadURI("http://mochi.test:8888/browser/toolkit/content/tests/browser/data/post_form_outer.sjs");
 
   registerCleanupFunction(function () {
-    gBrowser.addTab();
     gBrowser.removeCurrentTab();
   });
 
   gBrowser.addEventListener("pageshow", function pageShown(event) {
     if (event.target.location == "about:blank")
       return;
     gBrowser.removeEventListener("pageshow", pageShown);