Fix for bug 83093 (Leaks went up by about 200k) r=heikki, sr=jst, a=chofmann.

This commit is contained in:
peterv%netscape.com 2001-05-30 19:17:42 +00:00
parent 99c654b1e4
commit 4d452fd30a
4 changed files with 19 additions and 12 deletions

View File

@ -69,9 +69,14 @@ public:
/**
* Tells this element to update the stylesheet.
*
* @param aNotify .
* @param aOldDocument .
* @param aDocIndex .
* @param aNotify if true we notify the document of the
* removal of the stylesheet.
* @param aOldDocument the document that this element was part
* of (nsnull if we're not moving the element
* from one document to another).
* @param aDocIndex index of the stylesheet in the document's
* stylesheet list. -1 means we'll look up the
* index from the position of the element.
*/
NS_IMETHOD UpdateStyleSheet(PRBool aNotify,
nsIDocument *aOldDocument,

View File

@ -36,8 +36,7 @@
nsStyleLinkElement::nsStyleLinkElement() :
mDontLoadStyle(PR_FALSE),
mUpdatesEnabled(PR_TRUE),
mAppend(PR_FALSE)
mUpdatesEnabled(PR_TRUE)
{
}
@ -91,7 +90,6 @@ nsStyleLinkElement::SetEnableUpdates(PRBool aEnableUpdates)
NS_IMETHODIMP
nsStyleLinkElement::StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify)
{
mParser = nsnull;
return NS_OK;
}
@ -164,6 +162,13 @@ nsStyleLinkElement::UpdateStyleSheet(PRBool aNotify, nsIDocument *aOldDocument,
if (!mUpdatesEnabled)
return NS_OK;
// Keep a strong ref to the parser so it's still around when we pass it
// to the CSS loader. Release strong ref in mParser so we don't hang on
// to the parser once we start the load or if we fail to load the
// stylesheet.
nsCOMPtr<nsIParser> parser = mParser;
mParser = nsnull;
nsCOMPtr<nsIContent> thisContent;
QueryInterface(NS_GET_IID(nsIContent), getter_AddRefs(thisContent));
@ -318,7 +323,7 @@ nsStyleLinkElement::UpdateStyleSheet(PRBool aNotify, nsIDocument *aOldDocument,
rv = loader->LoadStyleLink(thisContent, uri, title, media,
kNameSpaceID_Unknown,
insertionPoint,
((blockParser) ? mParser.get() : nsnull),
((blockParser) ? parser.get() : nsnull),
doneLoading,
this);

View File

@ -69,9 +69,8 @@ protected:
nsCOMPtr<nsIStyleSheet> mStyleSheet;
nsCOMPtr<nsIParser> mParser;
PRBool mDontLoadStyle;
PRBool mUpdatesEnabled;
PRBool mAppend;
PRPackedBool mDontLoadStyle;
PRPackedBool mUpdatesEnabled;
};
#endif /* nsStyleLinkElement_h___ */

View File

@ -4680,8 +4680,6 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode)
src.StripWhitespace();
if (!mInsideNoXXXTag && NS_SUCCEEDED(rv) && src.IsEmpty()) {
PRInt32 i, count = aNode.GetAttributeCount();
nsAutoString title;
nsAutoString type;
nsAutoString media;