Last Comment Bug 750953 - FUEL Window objects create a large number of objects until shutdown
: FUEL Window objects create a large number of objects until shutdown
Status: RESOLVED FIXED
[fixed by bug 750454] [MemShrink:P2]
: mlk
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
: -- major with 1 vote (vote)
: Firefox 16
Assigned To: Justin Lebar (not reading bugmail)
:
:
Mentors:
Depends on: 750454 750583
Blocks: 730546
  Show dependency treegraph
 
Reported: 2012-05-01 16:13 PDT by Ben Turner (not reading bugmail, use the needinfo flag!)
Modified: 2012-06-23 01:19 PDT (History)
25 users (show)
bugzillamozillaorg_serge_20140323: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Ben Turner (not reading bugmail, use the needinfo flag!) 2012-05-01 16:13:38 PDT
+++ 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.
Comment 1 :Gavin Sharp [email: gavin@gavinsharp.com] 2012-06-21 16:15:55 PDT
Was this fixed by bug 750454?
Comment 2 Justin Lebar (not reading bugmail) 2012-06-21 16:46:05 PDT
> Was this fixed by bug 750454?

Yes, this should be fixed.

Note You need to log in before you can comment on or make changes to this bug.