Bug 1000894 - fix browser-chrome tests in dom/tests/browser/ to not replace the original tab; r=ehsan
authorNathan Froyd <froydnj@mozilla.com>
Thu, 24 Apr 2014 21:02:59 -0400
changeset 199732 16a37bafa5c816272557a9b2764a8b3137e81808
parent 199731 fd5d78e32b56d3397b3ad384b09125e1d77f94bf
child 199733 241760451193a9e81d443362b5991809c518c91f
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1000894
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 1000894 - fix browser-chrome tests in dom/tests/browser/ to not replace the original tab; r=ehsan
dom/tests/browser/browser_focus_steal_from_chrome.js
dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js
--- a/dom/tests/browser/browser_focus_steal_from_chrome.js
+++ b/dom/tests/browser/browser_focus_steal_from_chrome.js
@@ -3,17 +3,18 @@ function test() {
 
   let secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
                          .getService(Components.interfaces
                                                .nsIScriptSecurityManager);
 
   let fm = Components.classes["@mozilla.org/focus-manager;1"]
                      .getService(Components.interfaces.nsIFocusManager);
 
-  let tabs = [ gBrowser.selectedTab, gBrowser.addTab() ];
+  let tabs = [ gBrowser.addTab(), gBrowser.addTab() ];
+  gBrowser.selectedTab = tabs[0];
 
   let testingList = [
     { uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><input id='target'></body>",
       tagName: "INPUT", methodName: "focus" },
     { uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').select(); }, 10);\"><input id='target'></body>",
       tagName: "INPUT", methodName: "select" },
     { uri: "data:text/html,<body onload=\"setTimeout(function () { document.getElementById('target').focus(); }, 10);\"><a href='about:blank' id='target'>anchor</a></body>",
       tagName: "A", methodName: "focus" },
@@ -56,17 +57,16 @@ function test() {
   let canRetry;
   let callback;
   let loadedCount;
   let setFocusToChrome;
 
   function runNextTest() {
     if (++testingIndex >= testingList.length) {
       // cleaning-up...
-      gBrowser.addTab();
       for (let i = 0; i < tabs.length; i++) {
         gBrowser.removeTab(tabs[i]);
       }
       finish();
       return;
     }
     callback = doTest1;
     loadTestPage(false);
--- a/dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js
+++ b/dom/tests/browser/browser_focus_steal_from_chrome_during_mousedown.js
@@ -8,17 +8,18 @@ function test() {
     "    document.getElementById('willBeFocused').focus();" +
     "    aEvent.preventDefault();" +
     "  }" +
     "</script>" +
     "<body id=\"body\">" +
     "<button id=\"eventTarget\" onmousedown=\"onMouseDown(event);\">click here</button>" +
     "<input id=\"willBeFocused\"></body>";
 
-  let tab = gBrowser.selectedTab;
+  let tab = gBrowser.addTab();
+  gBrowser.selectedTab = tab;
 
   // Set the focus to the contents.
   tab.linkedBrowser.focus();
   // Load on the tab
   tab.linkedBrowser.addEventListener("load", onLoadTab, true);
   tab.linkedBrowser.loadURI(kTestURI);
 
   function onLoadTab() {
@@ -47,13 +48,12 @@ function test() {
       is(e.id, "willBeFocused",
          "The input element isn't active element: button=" + button);
 
       is(fm.focusedElement, e,
          "The active element isn't focused element in App level: button=" +
          button);
     }
 
-    gBrowser.addTab();
     gBrowser.removeTab(tab);
     finish();
   }
 }