michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: let cw; michael@0: let prefix; michael@0: let timestamp; michael@0: michael@0: let storeTimestamp = function () { michael@0: timestamp = cw.TabItems._lastUpdateTime; michael@0: } michael@0: michael@0: let checkTimestamp = function () { michael@0: is(timestamp, cw.TabItems._lastUpdateTime, prefix + michael@0: ": tabs were not updated"); michael@0: } michael@0: michael@0: let actionAddTab = function () { michael@0: storeTimestamp(); michael@0: gBrowser.addTab("about:mozilla"); michael@0: michael@0: afterAllTabsLoaded(function () { michael@0: checkTimestamp(); michael@0: next(); michael@0: }); michael@0: } michael@0: michael@0: let actionMoveTab = function () { michael@0: storeTimestamp(); michael@0: gBrowser.moveTabTo(gBrowser.tabs[0], 1); michael@0: gBrowser.moveTabTo(gBrowser.tabs[1], 0); michael@0: checkTimestamp(); michael@0: next(); michael@0: } michael@0: michael@0: let actionSelectTab = function () { michael@0: storeTimestamp(); michael@0: gBrowser.selectedTab = gBrowser.tabs[1] michael@0: gBrowser.selectedTab = gBrowser.tabs[0] michael@0: checkTimestamp(); michael@0: next(); michael@0: } michael@0: michael@0: let actionRemoveTab = function () { michael@0: storeTimestamp(); michael@0: gBrowser.removeTab(gBrowser.tabs[1]); michael@0: checkTimestamp(); michael@0: next(); michael@0: } michael@0: michael@0: let actions = [ michael@0: {name: "add", func: actionAddTab}, michael@0: {name: "move", func: actionMoveTab}, michael@0: {name: "select", func: actionSelectTab}, michael@0: {name: "remove", func: actionRemoveTab} michael@0: ]; michael@0: michael@0: let next = function () { michael@0: let action = actions.shift(); michael@0: michael@0: if (action) { michael@0: prefix = action.name; michael@0: action.func(); michael@0: } else { michael@0: finish(); michael@0: } michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: showTabView(function () { michael@0: cw = TabView.getContentWindow(); michael@0: hideTabView(next); michael@0: }); michael@0: }