Skip to content

Commit

Permalink
Remove script command items when the monkey menu closes to prevent zo…
Browse files Browse the repository at this point in the history
…mbie compartments.

Refs greasemonkey#1578
  • Loading branch information
Ventero authored and arantius committed Aug 1, 2012
1 parent 928920c commit 2a09200
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,15 @@ function GM_showPopup(aEvent) {
GM_MenuCommander.onPopupShowing(menuCommandPopup);
}

/**
* Clean up the menu after it hides to prevent memory leaks
*/
function GM_hidePopup(aEvent) {
var popup = aEvent.target;

var menuCommandPopup = popup.getElementsByTagName('menupopup')[0];
if(menuCommandPopup) GM_util.emptyEl(menuCommandPopup);
}

// Short-term workaround for #1406: Tab Mix Plus breaks opening links in
// new tabs because it depends on this function, and incorrectly checks for
Expand Down
1 change: 1 addition & 0 deletions content/browser.xul
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
>
<menupopup
onpopupshowing="GM_showPopup(event);"
onpopuphiding="GM_hidePopup(event);"
onclick="GM_popupClicked(event);event.stopPropagation();"
oncommand="GM_popupClicked(event);event.stopPropagation();"
oncontextmenu="event.preventDefault();"
Expand Down

0 comments on commit 2a09200

Please sign in to comment.