Wed, 31 Dec 2014 06:09:35 +0100
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 is(gBrowser.tabs.length, 1, "Only one tab exist");
7 let originalTab = gBrowser.tabs[0];
9 popup(originalTab);
10 ok(!document.getElementById("context_closeTab").disabled, "The 'Close tab' menu item is enabled");
11 ok(document.getElementById("context_openTabInWindow").disabled, "The 'Move to New Window' menu item is disabled");
13 let newTabOne = gBrowser.addTab("about:blank", {skipAnimation: true});
15 waitForExplicitFinish();
17 showTabView(function() {
18 registerCleanupFunction(function () {
19 while (gBrowser.tabs.length > 1)
20 gBrowser.removeTab(gBrowser.tabs[1]);
21 TabView.hide();
22 });
24 let contentWindow = TabView.getContentWindow();
25 is(contentWindow.GroupItems.groupItems.length, 1, "Has one group only");
27 let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
28 ok(tabItems.length, 2, "There are two tabItems in this group");
30 whenTabViewIsHidden(function() {
31 popup(gBrowser.tabs[0]);
33 ok(!document.getElementById("context_closeTab").disabled, "The 'Close tab' menu item is enabled");
34 ok(!document.getElementById("context_openTabInWindow").disabled, "The 'Move to New Window' menu item is enabled");
36 let newTabTwo = gBrowser.selectedTab;
37 gBrowser.selectedTab = originalTab;
39 gBrowser.removeTab(newTabOne);
40 gBrowser.removeTab(newTabTwo);
42 finish();
43 });
44 let newGroup = contentWindow.GroupItems.newGroup();
45 newGroup.newTab();
46 });
47 }
49 function popup(tab) {
50 let menu = document.getElementById("tabContextMenu");
51 var evt = new Event("");
52 tab.dispatchEvent(evt);
53 menu.openPopup(tab, "end_after", 0, 0, true, false, evt);
54 TabContextMenu.updateContextMenu(menu);
55 is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
56 menu.hidePopup();
57 }