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.

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

mercurial