browser_bug462673.js
Go to the documentation of this file.
1 var runs = [
2  function (win, tabbrowser, tab) {
3  is(tabbrowser.browsers.length, 2, "test_bug462673.html has opened a second tab");
4  is(tabbrowser.selectedTab, tab.nextSibling, "dependent tab is selected");
5  tabbrowser.removeTab(tab);
6  ok(win.closed, "Window is closed");
7  },
8  function (win, tabbrowser, tab) {
9  var newTab = tabbrowser.addTab();
10  var newBrowser = newTab.linkedBrowser;
11  tabbrowser.removeTab(tab);
12  ok(!win.closed, "Window stays open");
13  if (!win.closed) {
14  is(tabbrowser.tabContainer.childElementCount, 1, "Window has one tab");
15  is(tabbrowser.browsers.length, 1, "Window has one browser");
16  is(tabbrowser.selectedTab, newTab, "Remaining tab is selected");
17  is(tabbrowser.selectedBrowser, newBrowser, "Browser for remaining tab is selected");
18  is(tabbrowser.mTabBox.selectedPanel, newBrowser.parentNode, "Panel for remaining tab is selected");
19  }
20  }
21 ];
22 
23 function test() {
25  runOneTest();
26 }
27 
28 function runOneTest() {
29  var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
30 
31  win.addEventListener("load", function () {
32  win.removeEventListener("load", arguments.callee, false);
33 
34  var tab = win.gBrowser.tabContainer.firstChild;
35  var browser = tab.linkedBrowser;
36 
37  browser.addEventListener("load", function () {
38  browser.removeEventListener("load", arguments.callee, true);
39 
40  executeSoon(function () {
41  runs.shift()(win, win.gBrowser, tab);
42  win.close();
43  if (runs.length)
44  runOneTest();
45  else
46  finish();
47  });
48  }, true);
49 
50  browser.contentWindow.location =
51  "chrome://mochikit/content/browser/browser/base/content/test/test_bug462673.html";
52  }, false);
53 }
var tab
var newBrowser
var tabbrowser
waitForExplicitFinish()
function getBrowserURL()
var runs
return!aWindow arguments!aWindow arguments[0]
function test()
var browser
Definition: openLocation.js:42
function runOneTest()