зеркало из https://github.com/mozilla/pjs.git
Fix miscellaneous form element leaks. r=pollmann@netscape.com
This commit is contained in:
Родитель
08b72455a6
Коммит
03406c3659
|
@ -170,7 +170,7 @@ nsHTMLOptionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(kIJSNativeInitializerIID)) {
|
||||
nsIJSNativeInitializer* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -372,7 +372,8 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
|
|||
if (thisNode == thisOption) {
|
||||
res = NS_OK;
|
||||
*aIndex = i;
|
||||
break;
|
||||
NS_IF_RELEASE(thisOption);
|
||||
break; // skips the release below, thus release above needed
|
||||
}
|
||||
NS_IF_RELEASE(thisOption);
|
||||
}
|
||||
|
@ -636,10 +637,10 @@ nsHTMLOptionElement::Initialize(JSContext* aContext,
|
|||
JSString* jsstr = JS_ValueToString(aContext, argv[0]);
|
||||
if (nsnull != jsstr) {
|
||||
// Create a new text node and append it to the option
|
||||
nsIContent* textNode;
|
||||
nsCOMPtr<nsIContent> textNode;
|
||||
nsITextContent* content;
|
||||
|
||||
result = NS_NewTextNode(&textNode);
|
||||
result = NS_NewTextNode(getter_AddRefs(textNode));
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -657,6 +658,7 @@ nsHTMLOptionElement::Initialize(JSContext* aContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
// this addrefs textNode:
|
||||
result = mInner.AppendChildTo(textNode, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
|
|
|
@ -1189,6 +1189,7 @@ nsHTMLSelectElement::SetProperty(JSContext *aContext,
|
|||
res = mOptions->QueryInterface(kIJSScriptObjectIID, (void **)&optList);
|
||||
if (NS_SUCCEEDED(res) && optList) {
|
||||
res = optList->SetProperty(aContext, aObj, aID, aVp);
|
||||
NS_RELEASE(optList);
|
||||
}
|
||||
} else {
|
||||
res = mInner.SetProperty(aContext, aObj, aID, aVp);
|
||||
|
@ -1427,13 +1428,13 @@ nsHTMLOptionCollection::RemoveOption(nsIContent* aOption)
|
|||
PRInt32
|
||||
nsHTMLOptionCollection::IndexOf(nsIContent* aOption)
|
||||
{
|
||||
nsIDOMHTMLOptionElement* option;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option;
|
||||
|
||||
if (mDirty && (nsnull != mSelect)) {
|
||||
GetOptions();
|
||||
}
|
||||
if ((nsnull != aOption) &&
|
||||
NS_SUCCEEDED(aOption->QueryInterface(kIDOMHTMLOptionElementIID, (void**)&option))) {
|
||||
NS_SUCCEEDED(aOption->QueryInterface(kIDOMHTMLOptionElementIID, getter_AddRefs(option)))) {
|
||||
return mElements.IndexOf(option);
|
||||
}
|
||||
return -1;
|
||||
|
|
|
@ -170,7 +170,7 @@ nsHTMLOptionElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
if (aIID.Equals(kIJSNativeInitializerIID)) {
|
||||
nsIJSNativeInitializer* tmp = this;
|
||||
*aInstancePtr = (void*) tmp;
|
||||
AddRef();
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
|
@ -372,7 +372,8 @@ nsHTMLOptionElement::GetIndex(PRInt32* aIndex)
|
|||
if (thisNode == thisOption) {
|
||||
res = NS_OK;
|
||||
*aIndex = i;
|
||||
break;
|
||||
NS_IF_RELEASE(thisOption);
|
||||
break; // skips the release below, thus release above needed
|
||||
}
|
||||
NS_IF_RELEASE(thisOption);
|
||||
}
|
||||
|
@ -636,10 +637,10 @@ nsHTMLOptionElement::Initialize(JSContext* aContext,
|
|||
JSString* jsstr = JS_ValueToString(aContext, argv[0]);
|
||||
if (nsnull != jsstr) {
|
||||
// Create a new text node and append it to the option
|
||||
nsIContent* textNode;
|
||||
nsCOMPtr<nsIContent> textNode;
|
||||
nsITextContent* content;
|
||||
|
||||
result = NS_NewTextNode(&textNode);
|
||||
result = NS_NewTextNode(getter_AddRefs(textNode));
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
}
|
||||
|
@ -657,6 +658,7 @@ nsHTMLOptionElement::Initialize(JSContext* aContext,
|
|||
return result;
|
||||
}
|
||||
|
||||
// this addrefs textNode:
|
||||
result = mInner.AppendChildTo(textNode, PR_FALSE);
|
||||
if (NS_FAILED(result)) {
|
||||
return result;
|
||||
|
|
|
@ -1189,6 +1189,7 @@ nsHTMLSelectElement::SetProperty(JSContext *aContext,
|
|||
res = mOptions->QueryInterface(kIJSScriptObjectIID, (void **)&optList);
|
||||
if (NS_SUCCEEDED(res) && optList) {
|
||||
res = optList->SetProperty(aContext, aObj, aID, aVp);
|
||||
NS_RELEASE(optList);
|
||||
}
|
||||
} else {
|
||||
res = mInner.SetProperty(aContext, aObj, aID, aVp);
|
||||
|
@ -1427,13 +1428,13 @@ nsHTMLOptionCollection::RemoveOption(nsIContent* aOption)
|
|||
PRInt32
|
||||
nsHTMLOptionCollection::IndexOf(nsIContent* aOption)
|
||||
{
|
||||
nsIDOMHTMLOptionElement* option;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option;
|
||||
|
||||
if (mDirty && (nsnull != mSelect)) {
|
||||
GetOptions();
|
||||
}
|
||||
if ((nsnull != aOption) &&
|
||||
NS_SUCCEEDED(aOption->QueryInterface(kIDOMHTMLOptionElementIID, (void**)&option))) {
|
||||
NS_SUCCEEDED(aOption->QueryInterface(kIDOMHTMLOptionElementIID, getter_AddRefs(option)))) {
|
||||
return mElements.IndexOf(option);
|
||||
}
|
||||
return -1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче