Skip to content

Commit

Permalink
Don't handle events from submenus in GM_{show,hide}Popup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ventero committed Jul 13, 2013
1 parent a89695c commit 8073f86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 6 additions & 1 deletion content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ function GM_showPopup(aEvent) {
return mi;
}

// Make sure this event was triggered by opening the actual monkey menu,
// not one of its submenus.
if (aEvent.currentTarget != aEvent.target) return;

var popup = aEvent.target;
var scriptsFramedEl = popup.getElementsByClassName("scripts-framed-point")[0];
var scriptsTopEl = popup.getElementsByClassName("scripts-top-point")[0];
Expand Down Expand Up @@ -383,7 +387,8 @@ function GM_showPopup(aEvent) {
*/
function GM_hidePopup(aEvent) {
var popup = aEvent.target;

// Only handle the actual monkey menu event.
if (aEvent.currentTarget != aEvent.target) return;
// Propagate to commands sub-menu.
var commandsPopup = popup.querySelector(
'menupopup.greasemonkey-user-script-commands-popup');
Expand Down
6 changes: 1 addition & 5 deletions content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@
accesskey="&menu.commands.accesskey;"
label="&menu.commands;"
>
<menupopup
class='greasemonkey-user-script-commands-popup'
onpopupshowing="event.stopPropagation();"
onpopuphiding="event.stopPropagation();"
/>
<menupopup class='greasemonkey-user-script-commands-popup' />
</menu>

<menuseparator />
Expand Down

0 comments on commit 8073f86

Please sign in to comment.