Bug 641802 - 'Move to group' option stays populated with the old data even after the groups have been deleted in panorama [f=raymond, r=ian]

This commit is contained in:
Tim Taubert 2011-04-06 14:03:41 -07:00
Родитель 2b0ca95917
Коммит c59b3a23c1
3 изменённых файлов: 69 добавлений и 2 удалений

Просмотреть файл

@ -320,8 +320,10 @@ let TabView = {
// ----------
// On move to group pop showing.
moveToGroupPopupShowing: function TabView_moveToGroupPopupShowing(event) {
// there are hidden tabs so initialize the iframe and update the context menu
if ((gBrowser.tabs.length - gBrowser.visibleTabs.length) > 0)
// Update the context menu only if Panorama was already initialized or if
// there are hidden tabs.
let numHiddenTabs = gBrowser.tabs.length - gBrowser.visibleTabs.length;
if (this._window || numHiddenTabs > 0)
this.updateContextMenu(TabContextMenu.contextTab, event.target);
},

Просмотреть файл

@ -123,6 +123,7 @@ _BROWSER_FILES = \
browser_tabview_bug634085.js \
browser_tabview_bug634158.js \
browser_tabview_bug635696.js \
browser_tabview_bug641802.js \
browser_tabview_bug645653.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

Просмотреть файл

@ -0,0 +1,64 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let openMoveToGroupPopup = function () {
let tab = gBrowser.selectedTab;
document.popupNode = tab;
contextMenu.openPopup(tab, "end_after", 0, 0, true, false);
tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false);
}
let hideMoveToGroupPopup = function () {
tvMenuPopup.hidePopup();
contextMenu.hidePopup();
}
let assertValidPrerequisites = function (visible) {
let cw = TabView.getContentWindow();
is(cw.GroupItems.groupItems.length, 1, "there is one groupItem");
is(gBrowser.tabs.length, 1, "there is one tab");
is(TabView.isVisible(), visible, "tabview is visible");
}
let tvMenu = document.getElementById("context_tabViewMenu");
let contextMenu = document.getElementById("tabContextMenu");
let tvMenuPopup = document.getElementById("context_tabViewMenuPopup");
waitForExplicitFinish();
registerCleanupFunction(function () {
hideMoveToGroupPopup();
hideTabView(function () {});
let groupItems = TabView.getContentWindow().GroupItems.groupItems;
if (groupItems.length > 1)
closeGroupItem(groupItems[0], function () {});
});
showTabView(function () {
assertValidPrerequisites(true);
hideTabView(function () {
let groupItem = createGroupItemWithBlankTabs(window, 200, 200, 10, 1);
groupItem.setTitle("group2");
gBrowser.selectedTab = gBrowser.tabs[0];
executeSoon(function () {
openMoveToGroupPopup();
is(tvMenuPopup.firstChild.getAttribute("label"), "group2", "menuItem is present");
hideMoveToGroupPopup();
closeGroupItem(groupItem, function () {
openMoveToGroupPopup();
is(tvMenuPopup.firstChild.tagName, "menuseparator", "menuItem is not present");
hideMoveToGroupPopup();
assertValidPrerequisites(false);
finish();
});
});
});
});
}