browser/base/content/test/general/browser_bug462673.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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     // Closing a tab will also close its parent chrome window, but async
     7     executeSoon(function() {
     8       ok(win.closed, "Window is closed");
     9       testComplete(win);
    10     });
    11   },
    12   function (win, tabbrowser, tab) {
    13     var newTab = tabbrowser.addTab();
    14     var newBrowser = newTab.linkedBrowser;
    15     tabbrowser.removeTab(tab);
    16     ok(!win.closed, "Window stays open");
    17     if (!win.closed) {
    18       is(tabbrowser.tabContainer.childElementCount, 1, "Window has one tab");
    19       is(tabbrowser.browsers.length, 1, "Window has one browser");
    20       is(tabbrowser.selectedTab, newTab, "Remaining tab is selected");
    21       is(tabbrowser.selectedBrowser, newBrowser, "Browser for remaining tab is selected");
    22       is(tabbrowser.mTabBox.selectedPanel, newBrowser.parentNode.parentNode.parentNode.parentNode, "Panel for remaining tab is selected");
    23     }
    24     testComplete(win);
    25   }
    26 ];
    28 function test() {
    29   waitForExplicitFinish();
    30   runOneTest();
    31 }
    33 function testComplete(win) {
    34   win.close();
    35   if (runs.length)
    36     runOneTest();
    37   else
    38     finish();
    39 }
    41 function runOneTest() {
    42   var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
    44   win.addEventListener("load", function () {
    45     win.removeEventListener("load", arguments.callee, false);
    47     var tab = win.gBrowser.tabContainer.firstChild;
    48     var browser = tab.linkedBrowser;
    50     browser.addEventListener("load", function () {
    51       browser.removeEventListener("load", arguments.callee, true);
    53       executeSoon(function () {
    54         runs.shift()(win, win.gBrowser, tab);
    55       });
    56     }, true);
    58     var rootDir = getRootDirectory(gTestPath);
    59     browser.contentWindow.location = rootDir + "test_bug462673.html"
    60   }, false);
    61 }

mercurial