Bug 975719 - Australis - right clicking an empty bit of toolbar shouldn't cause errors, r=jaws

This commit is contained in:
Gijs Kruitbosch 2014-02-25 00:14:41 +00:00
parent e3ab70f7af
commit 7e3a78ee6f
2 changed files with 38 additions and 1 deletions

View File

@ -4243,7 +4243,7 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
if (toolbarItem && toolbarItem.localName == "toolbarpaletteitem") {
toolbarItem = toolbarItem.firstChild;
} else {
} else if (toolbarItem && toolbarItem.localName != "toolbar") {
while (toolbarItem && toolbarItem.parentNode) {
let parent = toolbarItem.parentNode;
if ((parent.classList && parent.classList.contains("customization-target")) ||
@ -4253,6 +4253,8 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
break;
toolbarItem = parent;
}
} else {
toolbarItem = null;
}
// Right-clicking on an empty part of the tabstrip will exit

View File

@ -35,6 +35,41 @@ add_task(function() {
yield hiddenPromise;
});
// Right-click on an empty bit of extra toolbar should
// show a context menu with moving options disabled,
// and a toggle option for the extra toolbar
add_task(function() {
let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = contextMenuShown(contextMenu);
let toolbar = createToolbarWithPlacements("880164_empty_toolbar", []);
toolbar.setAttribute("context", "toolbar-context-menu");
toolbar.setAttribute("toolbarname", "Fancy Toolbar for Context Menu");
EventUtils.synthesizeMouseAtCenter(toolbar, {type: "contextmenu", button: 2 });
yield shownPromise;
let expectedEntries = [
[".customize-context-moveToPanel", false],
[".customize-context-removeFromToolbar", false],
["---"]
];
if (!isOSX) {
expectedEntries.push(["#toggle_toolbar-menubar", true]);
}
expectedEntries.push(
["#toggle_PersonalToolbar", true],
["#toggle_880164_empty_toolbar", true],
["---"],
[".viewCustomizeToolbar", true]
);
checkContextMenu(contextMenu, expectedEntries);
let hiddenPromise = contextMenuHidden(contextMenu);
contextMenu.hidePopup();
yield hiddenPromise;
removeCustomToolbars();
});
// Right-click on the urlbar-container should
// show a context menu with disabled options to move it.
add_task(function() {