You can clone with
HTTPS or Subversion.
Steps to reproduce:
Tested with GM 1.0, Firefox 15.0 and 17.0a1 (nightly from 2012-08-24).
The reason for this leak seems to be that GM_MenuCommander.onPopupShowing (via createMenuItem) attaches an event listener to the menu item, which via the command function keeps a reference to the content scope. Since the event listener is never removed, the scope and thus the compartment is held alive.
I'm only able to reproduce this once per Firefox instance though, not sure why.
(For reference, see also this comment on #1578.)
This depends on DOM cleanup. I thought removing the element from the DOM meant Firefox also cleaned up the event handlers' references.
But if you have two separate GM_rmc scripts affecting two different domains, you can see that the first page's menu item causes a leaked compartment. The second time you open the menu on a different domain, you should see the first compartment removed, and the second compartment stays referenced by that different menu item.
But that's not what I see. I see the first page that you ever opened the menu on stay, forever. Everything else gets cleaned up as expected. I don't have an explanation yet.
(The above: I've only tested in beta channel FF 15 so far.)
Kill GM_rmc zombies by clearing references via DOM.