Closed Bug 385087 Opened 17 years ago Closed 17 years ago

use XPCOMUtils in content pref services to prevent leaks

Categories

(Toolkit :: Preferences, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: myk, Assigned: myk)

References

Details

Attachments

(1 file)

After the content pref service got checked in, Rlk on fxdbug-linux-tbox went from 2.99KB to 3.07KB and then to 3.16KB.  It now fluctuates between the latter two numbers, whereas before it was fluctuating between the former two.

Per discussion on #developers, one issue is inline XPCOM plumbing.  We should switch to XPCOMUtils, although that'll only help once bug 381651 lands.
Here's a patch that uses XPCOMUtils (the version in bug 381651).  Note that the following statement does not successfully import the module:

Components.utils.import("rel:XPCOMUtils.jsm");

It causes the app to complain:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXPCComponents_Utils.import]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: file:///home/myk/Projects/minefield/build/firefox-debug/dist/bin/components/nsContentPrefService.js :: <TOP_LEVEL> :: line 41"  data: no]

But this works:

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Assignee: nobody → myk
Status: NEW → ASSIGNED
Attachment #269013 - Flags: review?(sayrer)
Blocks: 385237
No longer blocks: 385237
Attachment #269013 - Flags: review?(sayrer) → review+
Checking in toolkit/components/contentprefs/src/nsContentPrefService.js;
/cvsroot/mozilla/toolkit/components/contentprefs/src/nsContentPrefService.js,v  <--  nsContentPrefService.js
new revision: 1.5; previous revision: 1.4
done
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
I backed this out, because it raised the leak stats. Locally, I can verify that it causes three leaked XPCWrappedNative objects and one XPCWrappedNativeProto object.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Urm, right.  I thought it hadn't, but I wasn't running the bloat cycle, merely starting up and then shutting down the browser.  After running the bloat cycle, I see the same increase in the number and type of leaked objects.
Checked in again now that bug 180380 has fixed the leaks.
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: