browser/components/tabview/test/browser_tabview_bug631662.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 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   let cw;
     6   let prefix;
     7   let timestamp;
     9   let storeTimestamp = function () {
    10     timestamp = cw.TabItems._lastUpdateTime;
    11   }
    13   let checkTimestamp = function () {
    14     is(timestamp, cw.TabItems._lastUpdateTime, prefix +
    15        ": tabs were not updated");
    16   }
    18   let actionAddTab = function () {
    19     storeTimestamp();
    20     gBrowser.addTab("about:mozilla");
    22     afterAllTabsLoaded(function () {
    23       checkTimestamp();
    24       next();
    25     });
    26   }
    28   let actionMoveTab = function () {
    29     storeTimestamp();
    30     gBrowser.moveTabTo(gBrowser.tabs[0], 1);
    31     gBrowser.moveTabTo(gBrowser.tabs[1], 0);
    32     checkTimestamp();
    33     next();
    34   }
    36   let actionSelectTab = function () {
    37     storeTimestamp();
    38     gBrowser.selectedTab = gBrowser.tabs[1]
    39     gBrowser.selectedTab = gBrowser.tabs[0]
    40     checkTimestamp();
    41     next();
    42   }
    44   let actionRemoveTab = function () {
    45     storeTimestamp();
    46     gBrowser.removeTab(gBrowser.tabs[1]);
    47     checkTimestamp();
    48     next();
    49   }
    51   let actions = [
    52     {name: "add", func: actionAddTab},
    53     {name: "move", func: actionMoveTab},
    54     {name: "select", func: actionSelectTab},
    55     {name: "remove", func: actionRemoveTab}
    56   ];
    58   let next = function () {
    59     let action = actions.shift();
    61     if (action) {
    62       prefix = action.name;
    63       action.func();
    64     } else {
    65       finish();
    66     }
    67   }
    69   waitForExplicitFinish();
    71   showTabView(function () {
    72     cw = TabView.getContentWindow();
    73     hideTabView(next);
    74   });
    75 }

mercurial