Ongoing fix for bug 81446. r=peter lubcynzski. sr=jst. a=asa. Fixes leaks of PARAM elements which now get destroyed when the document goes away. This fix ddoes away with 394206 bytes of leaks described in bugs 129423, 129424, 129425, 129429. We still leak memory across reloads of the same page so bug 81446 is being left open.

This commit is contained in:
nisheeth%netscape.com 2002-03-11 21:52:32 +00:00
Родитель f500f24a80
Коммит 5e2562e44e
2 изменённых файлов: 40 добавлений и 46 удалений

Просмотреть файл

@ -2955,29 +2955,26 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// now fill in the PARAM name/value pairs from the cached DOM nodes
c = 0;
for (PRInt16 idx = 0; idx < mNumCachedParams; idx++) {
nsCOMPtr<nsISupports> sup = ourParams->ElementAt(idx);
if (sup) {
nsCOMPtr<nsIDOMElement> param = do_QueryInterface(sup);
if (param) {
nsAutoString name;
nsAutoString value;
param->GetAttribute(NS_LITERAL_STRING("name"), name); // check for empty done above
param->GetAttribute(NS_LITERAL_STRING("value"), value);
/*
* According to the HTML 4.01 spec, at
* http://www.w3.org/TR/html4/types.html#type-cdata
* ''User agents may ignore leading and trailing
* white space in CDATA attribute values (e.g., "
* myval " may be interpreted as "myval"). Authors
* should not declare attribute values with
* leading or trailing white space.''
*/
name.CompressWhitespace(); // XXX right function?
value.CompressWhitespace();
mCachedAttrParamNames [mNumCachedAttrs + 1 + c] = ToNewUTF8String(name);
mCachedAttrParamValues[mNumCachedAttrs + 1 + c] = ToNewUTF8String(value);
c++; // rules!
}
nsCOMPtr<nsIDOMElement> param = do_QueryElementAt(ourParams, idx);
if (param) {
nsAutoString name;
nsAutoString value;
param->GetAttribute(NS_LITERAL_STRING("name"), name); // check for empty done above
param->GetAttribute(NS_LITERAL_STRING("value"), value);
/*
* According to the HTML 4.01 spec, at
* http://www.w3.org/TR/html4/types.html#type-cdata
* ''User agents may ignore leading and trailing
* white space in CDATA attribute values (e.g., "
* myval " may be interpreted as "myval"). Authors
* should not declare attribute values with
* leading or trailing white space.''
*/
name.CompressWhitespace(); // XXX right function?
value.CompressWhitespace();
mCachedAttrParamNames [mNumCachedAttrs + 1 + c] = ToNewUTF8String(name);
mCachedAttrParamValues[mNumCachedAttrs + 1 + c] = ToNewUTF8String(value);
c++; // rules!
}
}

Просмотреть файл

@ -2955,29 +2955,26 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
// now fill in the PARAM name/value pairs from the cached DOM nodes
c = 0;
for (PRInt16 idx = 0; idx < mNumCachedParams; idx++) {
nsCOMPtr<nsISupports> sup = ourParams->ElementAt(idx);
if (sup) {
nsCOMPtr<nsIDOMElement> param = do_QueryInterface(sup);
if (param) {
nsAutoString name;
nsAutoString value;
param->GetAttribute(NS_LITERAL_STRING("name"), name); // check for empty done above
param->GetAttribute(NS_LITERAL_STRING("value"), value);
/*
* According to the HTML 4.01 spec, at
* http://www.w3.org/TR/html4/types.html#type-cdata
* ''User agents may ignore leading and trailing
* white space in CDATA attribute values (e.g., "
* myval " may be interpreted as "myval"). Authors
* should not declare attribute values with
* leading or trailing white space.''
*/
name.CompressWhitespace(); // XXX right function?
value.CompressWhitespace();
mCachedAttrParamNames [mNumCachedAttrs + 1 + c] = ToNewUTF8String(name);
mCachedAttrParamValues[mNumCachedAttrs + 1 + c] = ToNewUTF8String(value);
c++; // rules!
}
nsCOMPtr<nsIDOMElement> param = do_QueryElementAt(ourParams, idx);
if (param) {
nsAutoString name;
nsAutoString value;
param->GetAttribute(NS_LITERAL_STRING("name"), name); // check for empty done above
param->GetAttribute(NS_LITERAL_STRING("value"), value);
/*
* According to the HTML 4.01 spec, at
* http://www.w3.org/TR/html4/types.html#type-cdata
* ''User agents may ignore leading and trailing
* white space in CDATA attribute values (e.g., "
* myval " may be interpreted as "myval"). Authors
* should not declare attribute values with
* leading or trailing white space.''
*/
name.CompressWhitespace(); // XXX right function?
value.CompressWhitespace();
mCachedAttrParamNames [mNumCachedAttrs + 1 + c] = ToNewUTF8String(name);
mCachedAttrParamValues[mNumCachedAttrs + 1 + c] = ToNewUTF8String(value);
c++; // rules!
}
}