Bug 1041527 - Ensure that about:home isn't the initial tab when opening new windows in tabview tests. r=ehsan, a=test-only
authorTim Taubert <ttaubert@mozilla.com>
Mon, 21 Jul 2014 17:06:57 +0200
changeset 208361 c340fefc0fe8
parent 208360 ec3e586813b5
child 208362 0b44c271f755
push id3840
push userryanvm@gmail.com
push date2014-08-21 14:17 +0000
treeherdermozilla-beta@c340fefc0fe8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, test-only
bugs1041527
milestone32.0
Bug 1041527 - Ensure that about:home isn't the initial tab when opening new windows in tabview tests. r=ehsan, a=test-only
browser/components/tabview/test/browser_tabview_bug598600.js
browser/components/tabview/test/browser_tabview_bug651311.js
browser/components/tabview/test/head.js
--- a/browser/components/tabview/test/browser_tabview_bug598600.js
+++ b/browser/components/tabview/test/browser_tabview_bug598600.js
@@ -4,17 +4,17 @@
 let newWin;
 function test() {
   let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
 
   requestLongerTimeout(2);
   waitForExplicitFinish();
 
   // open a new window and setup the window state.
-  newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
+  newWin = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", "about:blank");
   whenWindowLoaded(newWin, function () {
     let newState = {
       windows: [{
         tabs: [{
           entries: [{ "url": "about:blank" }],
           hidden: true,
           attributes: {},
           extData: {
--- a/browser/components/tabview/test/browser_tabview_bug651311.js
+++ b/browser/components/tabview/test/browser_tabview_bug651311.js
@@ -24,11 +24,11 @@ function test() {
       ok(win.TabView.getContentWindow().UI, "content window is loaded");
       finish();
     });
   });
 }
 
 function newWindow(callback) {
   let opts = "chrome,all,dialog=no,height=800,width=800";
-  let win = window.openDialog(getBrowserURL(), "_blank", opts);
+  let win = window.openDialog(getBrowserURL(), "_blank", opts, "about:blank");
   whenDelayedStartupFinished(win, () => callback(win));
 }
--- a/browser/components/tabview/test/head.js
+++ b/browser/components/tabview/test/head.js
@@ -100,17 +100,17 @@ function afterAllTabItemsUpdated(callbac
 }
 
 // ---------
 function newWindowWithTabView(shownCallback, loadCallback, width, height) {
   let winWidth = width || 800;
   let winHeight = height || 800;
   let win = window.openDialog(getBrowserURL(), "_blank",
                               "chrome,all,dialog=no,height=" + winHeight +
-                              ",width=" + winWidth);
+                              ",width=" + winWidth, "about:blank");
 
   whenWindowLoaded(win, function () {
     if (loadCallback)
       loadCallback(win);
   });
 
   whenDelayedStartupFinished(win, function () {
     showTabView(function () shownCallback(win), win);
@@ -328,17 +328,17 @@ function whenDelayedStartupFinished(win,
 }
 
 // ----------
 function newWindowWithState(state, callback) {
   const ss = Cc["@mozilla.org/browser/sessionstore;1"]
              .getService(Ci.nsISessionStore);
 
   let opts = "chrome,all,dialog=no,height=800,width=800";
-  let win = window.openDialog(getBrowserURL(), "_blank", opts);
+  let win = window.openDialog(getBrowserURL(), "_blank", opts, "about:blank");
 
   let numConditions = 2;
   let check = function () {
     if (!--numConditions)
       callback(win);
   };
 
   whenDelayedStartupFinished(win, function () {
@@ -428,8 +428,24 @@ function waitForOnBeforeUnloadDialog(bro
     executeSoon(() => {
       let stack = browser.parentNode;
       let dialogs = stack.getElementsByTagNameNS(XUL_NS, "tabmodalprompt");
       let {button0, button1} = dialogs[0].ui;
       callback(button0, button1);
     });
   }, true);
 }
+
+/**
+ * Overrides browser.js' OpenBrowserWindow() function to enforce an initial
+ * tab different from about:home to not hit the network.
+ */
+function OpenBrowserWindow(aOptions) {
+  let features = "";
+  let url = "about:blank";
+
+  if (aOptions && aOptions.private || false) {
+    features = ",private";
+    url = "about:privatebrowsing";
+  }
+
+  return openDialog(getBrowserURL(), "", "chrome,all,dialog=no" + features, url);
+}