Some of nsDocument::mPrincipal objects are leaked




16 years ago
8 years ago


(Reporter: leonidr, Unassigned)


1.0 Branch

Firefox Tracking Flags

(Not tracked)



(3 attachments)



16 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; Debian/ Gecko/20030305 Galeon/1.3.3
Build Identifier: 

This is for Mozilla 1.0.2. I haven't checked 1.3 or trunk yet, but I'm going to
do it. Attached pages load each other via JavaScript. It seems that
nsStandardURL objects with URLs of pages aren't freed, even if you quit Mozilla.

Reproducible: Always

Steps to Reproduce:
1. Add some counting facility to nsStandardURL constructor/destructor
2. Load urltest1.html
-- Or ---
1. Put urltest1.html and urltest2.html into directory with the longest path
possible, like 2K of characters.
2. Load urltest1.html
Actual Results:  
Counter goes up and never stops.
-- Or ---
Mozilla consumes more and more memory until it crashes.

Expected Results:  
Counter stops going up on some value.
-- Or ---
Mozilla frees used memory eventually.

Comment 1

16 years ago
Created attachment 118225 [details]
First test page (urltest1.html)

Comment 2

16 years ago
Created attachment 118226 [details]
Second test page (urltest2.html)


16 years ago
Version: Trunk → 1.0 Branch

Comment 3

16 years ago
I looked at nsStandardURL object's refcounter. After object has been removed
from session history, refcounter value was 1. So, I think there is one
unbalanced AddRef somewhere.

Comment 4

16 years ago
-> whitebox qa
QA Contact: benc → ashishbhatt

Comment 5

16 years ago
It is not network, but content. And not nsStandardURL, but
nsDocument::mPrincipal. nsDocument::mPrincipal is raw pointer in 1.0.2, not
nsCOMPtr as in Mozilla 1.3. So, it is released manually by NS_IF_RELEASE in
nsDocument destructor. The problem is that release happens before calling
mNodeInfoManager->DropDocumentReference(). But DropDocumentReference in turn
calls nsDocuments::GetPrincipal where mPrincipal is getting initialized and
AddRef'ed again. Hence the leak.
Changing bug's title and component.
Component: Networking → DOM Other
Summary: Some of nsStandardURL objects are leaked → Some of nsDocument::mPrincipal objects are leaked

Comment 6

16 years ago
please set the default owners when you hop components.
Assignee: dougt → dom_bugs
QA Contact: ashishbhatt → gerardok

Comment 7

16 years ago
It was fixed on trunk. See
Fixed on the trunk, marking FIXED.
Last Resolved: 16 years ago
Resolution: --- → FIXED

Comment 9

16 years ago
But what about the branch? It must be fixed there too. And I'm going to provide
patch for 1.0 branch. Or I don't understand bug's life cycle and "fixed" means
something else?
In general, the focus has moved off the 1.0 branch, but if you still has an
interest in fixing this on the branch, then feel free to open up this bug and
provide a patch.

Comment 11

16 years ago
Reopening: I've got a patch.
Resolution: FIXED → ---

Comment 12

16 years ago
Created attachment 119085 [details] [diff] [review]
patch converting nsDocument::mPrincipal into an nsCOMPtr

This is a patch from bug 17201, backported to 1.0 branch.

Comment 13

16 years ago
bug 170201, sorry.
Comment on attachment 119085 [details] [diff] [review]
patch converting nsDocument::mPrincipal into an nsCOMPtr

Attachment #119085 - Flags: superreview+
Asa, Brendan, are we still maintaining the 1.0 branch?  If so, should we land
this there?
This is an automated message, with ID "auto-resolve01".

This bug has had no comments for a long time. Statistically, we have found that
bug reports that have not been confirmed by a second user after three months are
highly unlikely to be the source of a fix to the code.

While your input is very important to us, our resources are limited and so we
are asking for your help in focussing our efforts. If you can still reproduce
this problem in the latest version of the product (see below for how to obtain a
copy) or, for feature requests, if it's not present in the latest version and
you still believe we should implement it, please visit the URL of this bug
(given at the top of this mail) and add a comment to that effect, giving more
reproduction information if you have it.

If it is not a problem any longer, you need take no action. If this bug is not
changed in any way in the next two weeks, it will be automatically resolved.
Thank you for your help in this matter.

The latest beta releases can be obtained from:
This bug has been automatically resolved after a period of inactivity (see above
comment). If anyone thinks this is incorrect, they should feel free to reopen it.
Last Resolved: 16 years ago14 years ago
Resolution: --- → EXPIRED
You need to log in before you can comment on or make changes to this bug.