Bug 1249685 - Use more nsCOMPtrs for stack variables in DOM code. r=smaug

This commit is contained in:
Andrew McCreight 2016-02-23 16:23:43 -08:00
parent f92eca37c1
commit 1837d54fa7
4 changed files with 6 additions and 6 deletions

View File

@ -2091,7 +2091,7 @@ nsRange::CutContents(DocumentFragment** aFragment)
} else if (nodeToResult) {
nsMutationGuard guard;
nsCOMPtr<nsINode> node = nodeToResult;
nsINode* parent = node->GetParentNode();
nsCOMPtr<nsINode> parent = node->GetParentNode();
if (parent) {
mozilla::ErrorResult error;
parent->RemoveChild(*node, error);

View File

@ -1415,8 +1415,8 @@ nsTreeSanitizer::SanitizeChildren(nsINode* aRoot)
}
if (MustFlatten(ns, localName)) {
RemoveAllAttributes(node);
nsIContent* next = node->GetNextNode(aRoot);
nsIContent* parent = node->GetParent();
nsCOMPtr<nsIContent> next = node->GetNextNode(aRoot);
nsCOMPtr<nsIContent> parent = node->GetParent();
nsCOMPtr<nsIContent> child; // Must keep the child alive during move
ErrorResult rv;
while ((child = node->GetFirstChild())) {

View File

@ -577,7 +577,7 @@ HTMLSelectElement::Add(nsGenericHTMLElement& aElement,
// Just in case we're not the parent, get the parent of the reference
// element
nsINode* parent = aBefore->Element::GetParentNode();
nsCOMPtr<nsINode> parent = aBefore->Element::GetParentNode();
if (!parent || !nsContentUtils::ContentIsDescendantOf(parent, this)) {
// NOT_FOUND_ERR: Raised if before is not a descendant of the SELECT
// element.

View File

@ -521,8 +521,8 @@ HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError)
refIndex = rowCount - 1;
}
Element* refRow = rows->Item(refIndex);
nsINode* parent = refRow->GetParentNode();
RefPtr<Element> refRow = rows->Item(refIndex);
nsCOMPtr<nsINode> parent = refRow->GetParentNode();
// create the row
RefPtr<mozilla::dom::NodeInfo> nodeInfo;