Closed Bug 750953 Opened 12 years ago Closed 12 years ago

FUEL Window objects create a large number of objects until shutdown

Categories

(Firefox :: General, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
Firefox 16

People

(Reporter: bent.mozilla, Assigned: justin.lebar+bug)

References

Details

(Keywords: memory-leak, Whiteboard: [fixed by bug 750454] [MemShrink:P2])

+++ This bug was initially created as a clone of Bug #750454 +++

Every FUEL Window object that gets created registers itself as a listener on the tabbrowser for 4 different events ("TabOpen", "TabMove", "TabClose", and "TabSelect"). These event listeners never get removed until shutdown. Also, each time one of those events is fired FUEL creates a new BrowserTab object.

Of course, every Window and BrowserTab object gets added to the gShutdown array.

This makes it really easy to write bloaty code. Consider something innocent like this:

  setInterval(function() {
    if (Application.activeWindow.activeTab.uri.spec == "myURL") {
      alert("Thanks for visiting my page!");
    }
  }, 5000);

Now, the example is dumb, but imagine what happens. Each call to Application.activeWindow makes a new FUEL Window object. Each one of those registers as a "TabSelect" listener.

The first time the the interval runs we end up with 1 Window and 1 BrowserTab in our gShutdown array. If I select a tab I get one "TabSelect" handler running, which adds another BrowserTab to the gShutdown array.

The next time the interval runs we have 2 Window objects and now 3 BrowserTab objects. Then if I select a tab I have 2 "TabSelect" handlers running, each of which adds another BrowserTab object to the gShutdown array.

And that's just after 10 seconds. Imagine letting this go all day, and having lots of tab changes, window creation, etc.

This is a mess.
Blocks: 743069
Whiteboard: [MemShrink]
No longer depends on: 750454
Whiteboard: [MemShrink] → [MemShrink:P2]
No longer depends on: 750469
Was this fixed by bug 750454?
No longer blocks: 743069
> Was this fixed by bug 750454?

Yes, this should be fixed.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
Assignee: nobody → justin.lebar+bug
No longer blocks: 750454
Depends on: 750454
Whiteboard: [MemShrink:P2] → [fixed by bug 750454] [MemShrink:P2]
Version: unspecified → Trunk
Resolution: WORKSFORME → FIXED
Target Milestone: --- → Firefox 16
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.