Bug 1159276 - Prevent showing the source context menu if the breakpoint context menu is also going to be shown;r=jlongster

This commit is contained in:
Brian Grinstead 2015-04-28 14:10:08 -07:00
Родитель 7fea255279
Коммит 6b0d5ba3f0
2 изменённых файлов: 22 добавлений и 2 удалений

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

@ -101,7 +101,7 @@ function test() {
return finished;
}
function initialChecks() {
let initialChecks = Task.async(function*() {
for (let source of gSources) {
for (let breakpoint of source) {
ok(gBreakpoints._getAdded(breakpoint.attachment),
@ -118,6 +118,17 @@ function test() {
let enableSelfId = prefix + "enableSelf-" + identifier + "-menuitem";
let disableSelfId = prefix + "disableSelf-" + identifier + "-menuitem";
// Check to make sure that only the bp context menu is shown when right clicking
// this node (Bug 1159276).
let menu = gDebugger.document.getElementById("bp-mPop-" + identifier);
let contextMenuShown = once(gDebugger.document, "popupshown");
EventUtils.synthesizeMouseAtCenter(breakpoint.prebuiltNode, {type: 'contextmenu', button: 2}, gDebugger);
let event = yield contextMenuShown;
is (event.originalTarget.id, menu.id, "The correct context menu was shown");
let contextMenuHidden = once(gDebugger.document, "popuphidden");
menu.hidePopup();
yield contextMenuHidden;
is(gDebugger.document.getElementById(enableSelfId).getAttribute("hidden"), "true",
"The 'Enable breakpoint' context menu item should initially be hidden'.");
ok(!gDebugger.document.getElementById(disableSelfId).hasAttribute("hidden"),
@ -126,7 +137,7 @@ function test() {
"All breakpoints should initially have a checked checkbox.");
}
}
}
});
function checkBreakpointToggleSelf(aIndex) {
let deferred = promise.defer();

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

@ -400,6 +400,15 @@ SideMenuWidget.prototype = {
return;
}
// Don't show the menu if a descendant node is going to be visible also.
let node = e.originalTarget;
while (node && node !== this._list) {
if (node.hasAttribute("contextmenu")) {
return;
}
node = node.parentNode;
}
this._contextMenu.openPopupAtScreen(e.screenX, e.screenY, true);
},