FUEL Window objects create a large number of objects until shutdown

RESOLVED FIXED in Firefox 16

Status

()

Firefox
General
--
major
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Ben Turner (not reading bugmail, use the needinfo flag!), Assigned: Justin Lebar (not reading bugmail))

Tracking

({mlk})

Trunk
Firefox 16
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

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

Updated

5 years ago
Blocks: 743069

Updated

5 years ago
Whiteboard: [MemShrink]
No longer depends on: 750454
Blocks: 750454
Whiteboard: [MemShrink] → [MemShrink:P2]
No longer depends on: 750469
Was this fixed by bug 750454?
No longer blocks: 743069
(Assignee)

Comment 2

5 years ago
> Was this fixed by bug 750454?

Yes, this should be fixed.
Status: NEW → RESOLVED
Last Resolved: 5 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.