Closed Bug 517312 Opened 11 years ago Closed 4 years ago

FUEL: Application.prefs.all takes longer and longer each time you call it

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED WONTFIX

People

(Reporter: cbartley, Unassigned)

References

Details

FUEL: Application.prefs.all takes longer and longer each time you call it

Repro steps:

1. Open Firefox.
2. Open the Error Console.
3. Click clear.
4. Execute the following line of code and note the result:

  var t = new Date().getTime(); Application.prefs.all; new Date().getTime() - t

5. Repeat step 4 several times.  Note how it takes longer each time.
According to http://mxr.mozilla.org/mozilla-central/source/modules/libpref/public/nsIPrefBranch.idl#315 this is supposed to be called as follows:

var out = {};
getChildList("", {}, out);

Yet in FUEL, http://mxr.mozilla.org/mozilla-central/source/toolkit/components/exthelper/extApplication.js#214 , it's called as follows:

var out = getChildList("", []);

Plus there's a bunch of listeners that get called and XPCOM objects created and destroyed, perhaps the |all|, http://mxr.mozilla.org/mozilla-central/source/toolkit/components/exthelper/extApplication.js#522 , should be cached? I'll give it a shot...
find() creates new Preference objects every time, and each preference object adds itself to the branch's listener (which stays around forever). Hard to solve this without destructors... Avoiding the cache of the root pref branch might actually help, I guess.
(In reply to comment #2)
> Avoiding the cache of the root pref branch
> might actually help, I guess.

iirc this is needed to avoid it being GCed, indeed we had a similar bug in AutoComplete code, if you don't cache to pref branch in your object your listener stops being called after some time (not predeictable). but could be i misread your comment.
FUEL is being removed in bug 1090880, so this is now wontfix.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.