Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zombie compartments in GM_registerMenuCommand/GM_MenuCommander.onPopupShowing #1608

Closed
Ventero opened this issue Aug 24, 2012 · 2 comments
Closed
Milestone

Comments

@Ventero
Copy link
Contributor

Ventero commented Aug 24, 2012

Steps to reproduce:

  1. Install this script: https://gist.github.com/3041689
  2. Open any page
  3. Open the monkey menu, mouseover the "User Script Commands..." item
  4. Close the tab
  5. Check about:compartments for zombie compartments

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.)

@arantius
Copy link
Collaborator

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.

@arantius
Copy link
Collaborator

(The above: I've only tested in beta channel FF 15 so far.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants