mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 16:22:53 +00:00
Fix possible crash due to misuse of nsCOMPtr. Bug 238005, r=caillon,
sr=peterv, a=asa
This commit is contained in:
parent
f4f167dc73
commit
d088ac5727
@ -1024,13 +1024,15 @@ nsHTMLSelectElement::Add(nsIDOMHTMLElement* aElement,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> ancestor(parent);
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
while (ancestor != NS_STATIC_CAST(nsIDOMNode*, this)) {
|
||||
ancestor->GetParentNode(getter_AddRefs(ancestor));
|
||||
if (!ancestor) {
|
||||
ancestor->GetParentNode(getter_AddRefs(temp));
|
||||
if (!temp) {
|
||||
// NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT
|
||||
// element.
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
temp.swap(ancestor);
|
||||
}
|
||||
|
||||
// If the before parameter is not null, we are equivalent to the
|
||||
|
Loading…
x
Reference in New Issue
Block a user