From f8d31e18842b4347bfaae2526c35a95641656abf Mon Sep 17 00:00:00 2001 From: "jst%netscape.com" Date: Fri, 18 Aug 2000 06:52:31 +0000 Subject: [PATCH] Fxing nsbeta3+ bug 45680. Cloning an HTML element with a style attribute didn't clone the style declaration in the element so changing the style on the clone resulted in a style change for both elements. Also fixing a few memory leaks in nsHTMLTableElement. r=pollmann@netscape.com --- .../html/content/src/nsGenericHTMLElement.cpp | 20 ++++++++++++++++++ .../html/content/src/nsHTMLAnchorElement.cpp | 1 + .../html/content/src/nsHTMLAppletElement.cpp | 1 + .../html/content/src/nsHTMLAreaElement.cpp | 1 + content/html/content/src/nsHTMLBRElement.cpp | 1 + .../html/content/src/nsHTMLBaseElement.cpp | 1 + .../content/src/nsHTMLBaseFontElement.cpp | 1 + .../html/content/src/nsHTMLBodyElement.cpp | 1 + .../html/content/src/nsHTMLButtonElement.cpp | 1 + .../html/content/src/nsHTMLDListElement.cpp | 1 + content/html/content/src/nsHTMLDelElement.cpp | 1 + .../content/src/nsHTMLDirectoryElement.cpp | 1 + content/html/content/src/nsHTMLDivElement.cpp | 1 + .../html/content/src/nsHTMLEmbedElement.cpp | 1 + .../content/src/nsHTMLFieldSetElement.cpp | 1 + .../html/content/src/nsHTMLFontElement.cpp | 1 + .../html/content/src/nsHTMLFormElement.cpp | 1 + .../html/content/src/nsHTMLFrameElement.cpp | 1 + .../content/src/nsHTMLFrameSetElement.cpp | 1 + content/html/content/src/nsHTMLHRElement.cpp | 1 + .../html/content/src/nsHTMLHeadElement.cpp | 1 + .../html/content/src/nsHTMLHeadingElement.cpp | 1 + .../html/content/src/nsHTMLHtmlElement.cpp | 1 + .../html/content/src/nsHTMLIFrameElement.cpp | 1 + .../html/content/src/nsHTMLImageElement.cpp | 1 + .../html/content/src/nsHTMLInputElement.cpp | 1 + content/html/content/src/nsHTMLInsElement.cpp | 1 + .../html/content/src/nsHTMLIsIndexElement.cpp | 1 + content/html/content/src/nsHTMLLIElement.cpp | 1 + .../html/content/src/nsHTMLLabelElement.cpp | 1 + .../html/content/src/nsHTMLLegendElement.cpp | 1 + .../html/content/src/nsHTMLLinkElement.cpp | 1 + content/html/content/src/nsHTMLMapElement.cpp | 1 + .../html/content/src/nsHTMLMenuElement.cpp | 1 + .../html/content/src/nsHTMLMetaElement.cpp | 1 + content/html/content/src/nsHTMLModElement.cpp | 1 + .../html/content/src/nsHTMLOListElement.cpp | 1 + .../html/content/src/nsHTMLObjectElement.cpp | 1 + .../content/src/nsHTMLOptGroupElement.cpp | 1 + .../html/content/src/nsHTMLOptionElement.cpp | 1 + .../content/src/nsHTMLParagraphElement.cpp | 1 + .../html/content/src/nsHTMLParamElement.cpp | 1 + content/html/content/src/nsHTMLPreElement.cpp | 1 + .../html/content/src/nsHTMLQuoteElement.cpp | 1 + .../html/content/src/nsHTMLScriptElement.cpp | 1 + .../html/content/src/nsHTMLSelectElement.cpp | 4 +--- .../content/src/nsHTMLSharedObjectElement.cpp | 1 + .../html/content/src/nsHTMLSpacerElement.cpp | 1 + .../html/content/src/nsHTMLSpanElement.cpp | 1 + .../html/content/src/nsHTMLStyleElement.cpp | 1 + .../content/src/nsHTMLTableCaptionElement.cpp | 1 + .../content/src/nsHTMLTableCellElement.cpp | 1 + .../content/src/nsHTMLTableColElement.cpp | 1 + .../src/nsHTMLTableColGroupElement.cpp | 1 + .../html/content/src/nsHTMLTableElement.cpp | 21 ++++++++++--------- .../content/src/nsHTMLTableRowElement.cpp | 1 + .../content/src/nsHTMLTableSectionElement.cpp | 1 + .../content/src/nsHTMLTextAreaElement.cpp | 1 + .../html/content/src/nsHTMLTitleElement.cpp | 1 + .../html/content/src/nsHTMLUListElement.cpp | 1 + .../html/content/src/nsHTMLUnknownElement.cpp | 1 + content/html/content/src/nsHTMLWBRElement.cpp | 1 + .../html/content/src/nsGenericHTMLElement.cpp | 20 ++++++++++++++++++ .../html/content/src/nsHTMLAnchorElement.cpp | 1 + .../html/content/src/nsHTMLAppletElement.cpp | 1 + layout/html/content/src/nsHTMLAreaElement.cpp | 1 + layout/html/content/src/nsHTMLBRElement.cpp | 1 + layout/html/content/src/nsHTMLBaseElement.cpp | 1 + .../content/src/nsHTMLBaseFontElement.cpp | 1 + layout/html/content/src/nsHTMLBodyElement.cpp | 1 + .../html/content/src/nsHTMLButtonElement.cpp | 1 + .../html/content/src/nsHTMLDListElement.cpp | 1 + layout/html/content/src/nsHTMLDelElement.cpp | 1 + .../content/src/nsHTMLDirectoryElement.cpp | 1 + layout/html/content/src/nsHTMLDivElement.cpp | 1 + .../html/content/src/nsHTMLEmbedElement.cpp | 1 + .../content/src/nsHTMLFieldSetElement.cpp | 1 + layout/html/content/src/nsHTMLFontElement.cpp | 1 + layout/html/content/src/nsHTMLFormElement.cpp | 1 + .../html/content/src/nsHTMLFrameElement.cpp | 1 + .../content/src/nsHTMLFrameSetElement.cpp | 1 + layout/html/content/src/nsHTMLHRElement.cpp | 1 + layout/html/content/src/nsHTMLHeadElement.cpp | 1 + .../html/content/src/nsHTMLHeadingElement.cpp | 1 + layout/html/content/src/nsHTMLHtmlElement.cpp | 1 + .../html/content/src/nsHTMLIFrameElement.cpp | 1 + .../html/content/src/nsHTMLImageElement.cpp | 1 + .../html/content/src/nsHTMLInputElement.cpp | 1 + layout/html/content/src/nsHTMLInsElement.cpp | 1 + .../html/content/src/nsHTMLIsIndexElement.cpp | 1 + layout/html/content/src/nsHTMLLIElement.cpp | 1 + .../html/content/src/nsHTMLLabelElement.cpp | 1 + .../html/content/src/nsHTMLLayerElement.cpp | 1 + .../html/content/src/nsHTMLLegendElement.cpp | 1 + layout/html/content/src/nsHTMLLinkElement.cpp | 1 + layout/html/content/src/nsHTMLMapElement.cpp | 1 + layout/html/content/src/nsHTMLMenuElement.cpp | 1 + layout/html/content/src/nsHTMLMetaElement.cpp | 1 + layout/html/content/src/nsHTMLModElement.cpp | 1 + .../html/content/src/nsHTMLOListElement.cpp | 1 + .../html/content/src/nsHTMLObjectElement.cpp | 1 + .../content/src/nsHTMLOptGroupElement.cpp | 1 + .../html/content/src/nsHTMLOptionElement.cpp | 1 + .../content/src/nsHTMLParagraphElement.cpp | 1 + .../html/content/src/nsHTMLParamElement.cpp | 1 + layout/html/content/src/nsHTMLPreElement.cpp | 1 + .../html/content/src/nsHTMLQuoteElement.cpp | 1 + .../html/content/src/nsHTMLScriptElement.cpp | 1 + .../html/content/src/nsHTMLSelectElement.cpp | 4 +--- .../html/content/src/nsHTMLSpacerElement.cpp | 1 + layout/html/content/src/nsHTMLSpanElement.cpp | 1 + .../html/content/src/nsHTMLStyleElement.cpp | 1 + .../content/src/nsHTMLTableCaptionElement.cpp | 1 + .../content/src/nsHTMLTableCellElement.cpp | 1 + .../content/src/nsHTMLTableColElement.cpp | 1 + .../src/nsHTMLTableColGroupElement.cpp | 1 + .../html/content/src/nsHTMLTableElement.cpp | 21 ++++++++++--------- .../content/src/nsHTMLTableRowElement.cpp | 1 + .../content/src/nsHTMLTableSectionElement.cpp | 1 + .../content/src/nsHTMLTextAreaElement.cpp | 1 + .../html/content/src/nsHTMLTitleElement.cpp | 1 + .../html/content/src/nsHTMLUListElement.cpp | 1 + .../html/content/src/nsHTMLUnknownElement.cpp | 1 + layout/html/content/src/nsHTMLWBRElement.cpp | 1 + 124 files changed, 182 insertions(+), 26 deletions(-) diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index ae6d2adcad25..9bf68c86e997 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -438,6 +438,26 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, if (nsnull != mAttributes) { result = mAttributes->Clone(&(aDst->mAttributes)); + + if (NS_SUCCEEDED(result)) { + nsHTMLValue val; + result = aDst->GetHTMLAttribute(nsHTMLAtoms::style, val); + + if (result == NS_CONTENT_ATTR_HAS_VALUE && + val.GetUnit() == eHTMLUnit_ISupports) { + nsCOMPtr supports(dont_AddRef(val.GetISupportsValue())); + nsCOMPtr rule(do_QueryInterface(supports)); + + if (rule) { + nsCOMPtr ruleClone; + + result = rule->Clone(*getter_AddRefs(ruleClone)); + + val.SetISupportsValue(ruleClone); + aDst->SetHTMLAttribute(nsHTMLAtoms::style, val, PR_FALSE); + } + } + } } PRInt32 id; diff --git a/content/html/content/src/nsHTMLAnchorElement.cpp b/content/html/content/src/nsHTMLAnchorElement.cpp index 58127a3483c6..1a967b974aab 100644 --- a/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/content/html/content/src/nsHTMLAnchorElement.cpp @@ -198,6 +198,7 @@ nsHTMLAnchorElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLAppletElement.cpp b/content/html/content/src/nsHTMLAppletElement.cpp index a55090304406..4db86f67d363 100644 --- a/content/html/content/src/nsHTMLAppletElement.cpp +++ b/content/html/content/src/nsHTMLAppletElement.cpp @@ -190,6 +190,7 @@ nsHTMLAppletElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLAreaElement.cpp b/content/html/content/src/nsHTMLAreaElement.cpp index 22b4903fddc1..68fde215ca53 100644 --- a/content/html/content/src/nsHTMLAreaElement.cpp +++ b/content/html/content/src/nsHTMLAreaElement.cpp @@ -172,6 +172,7 @@ nsHTMLAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLBRElement.cpp b/content/html/content/src/nsHTMLBRElement.cpp index a9ca8158495a..75f5dbc0fcf5 100644 --- a/content/html/content/src/nsHTMLBRElement.cpp +++ b/content/html/content/src/nsHTMLBRElement.cpp @@ -120,6 +120,7 @@ nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLBaseElement.cpp b/content/html/content/src/nsHTMLBaseElement.cpp index 2fd0f9628e1a..b62883b1df20 100644 --- a/content/html/content/src/nsHTMLBaseElement.cpp +++ b/content/html/content/src/nsHTMLBaseElement.cpp @@ -121,6 +121,7 @@ nsHTMLBaseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLBaseFontElement.cpp b/content/html/content/src/nsHTMLBaseFontElement.cpp index c3f1f025137c..ccd45cda02c0 100644 --- a/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -123,6 +123,7 @@ nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index 3e579e15cd81..04f8ed672e3b 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -744,6 +744,7 @@ nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 59f67d9a4f38..184cea0f03ea 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -251,6 +251,7 @@ nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLDListElement.cpp b/content/html/content/src/nsHTMLDListElement.cpp index 38875b3c06eb..a6baf2a863ec 100644 --- a/content/html/content/src/nsHTMLDListElement.cpp +++ b/content/html/content/src/nsHTMLDListElement.cpp @@ -120,6 +120,7 @@ nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLDelElement.cpp b/content/html/content/src/nsHTMLDelElement.cpp index 245941164875..a44dce8d4a48 100644 --- a/content/html/content/src/nsHTMLDelElement.cpp +++ b/content/html/content/src/nsHTMLDelElement.cpp @@ -121,6 +121,7 @@ nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLDirectoryElement.cpp b/content/html/content/src/nsHTMLDirectoryElement.cpp index 93a3d71ac21d..e0c3b8d51a87 100644 --- a/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -124,6 +124,7 @@ nsHTMLDirectoryElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLDivElement.cpp b/content/html/content/src/nsHTMLDivElement.cpp index 0375b8477439..b77d8134dba4 100644 --- a/content/html/content/src/nsHTMLDivElement.cpp +++ b/content/html/content/src/nsHTMLDivElement.cpp @@ -121,6 +121,7 @@ nsHTMLDivElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLEmbedElement.cpp b/content/html/content/src/nsHTMLEmbedElement.cpp index 6b9db40d39e6..e84693d42fc1 100644 --- a/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/content/html/content/src/nsHTMLEmbedElement.cpp @@ -148,6 +148,7 @@ nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLFieldSetElement.cpp b/content/html/content/src/nsHTMLFieldSetElement.cpp index c61980ff788c..e7d07fca0f7f 100644 --- a/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -144,6 +144,7 @@ nsHTMLFieldSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLFontElement.cpp b/content/html/content/src/nsHTMLFontElement.cpp index 412667e5f958..170e0fd2bb46 100644 --- a/content/html/content/src/nsHTMLFontElement.cpp +++ b/content/html/content/src/nsHTMLFontElement.cpp @@ -127,6 +127,7 @@ nsHTMLFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index 952ee9982fc7..705ea80bfa11 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -247,6 +247,7 @@ nsHTMLFormElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLFrameElement.cpp b/content/html/content/src/nsHTMLFrameElement.cpp index 4adc9bf9b909..cdfe3d5654f3 100644 --- a/content/html/content/src/nsHTMLFrameElement.cpp +++ b/content/html/content/src/nsHTMLFrameElement.cpp @@ -150,6 +150,7 @@ nsHTMLFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLFrameSetElement.cpp b/content/html/content/src/nsHTMLFrameSetElement.cpp index d9d9de3b3898..36559dd8d333 100644 --- a/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -121,6 +121,7 @@ nsHTMLFrameSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLHRElement.cpp b/content/html/content/src/nsHTMLHRElement.cpp index 8dfb956b5c98..b98d9df918f4 100644 --- a/content/html/content/src/nsHTMLHRElement.cpp +++ b/content/html/content/src/nsHTMLHRElement.cpp @@ -126,6 +126,7 @@ nsHTMLHRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLHeadElement.cpp b/content/html/content/src/nsHTMLHeadElement.cpp index d71c0af821d2..63836516d5d9 100644 --- a/content/html/content/src/nsHTMLHeadElement.cpp +++ b/content/html/content/src/nsHTMLHeadElement.cpp @@ -119,6 +119,7 @@ nsHTMLHeadElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLHeadingElement.cpp b/content/html/content/src/nsHTMLHeadingElement.cpp index 838d819b65d1..76ca3a5ce226 100644 --- a/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/content/html/content/src/nsHTMLHeadingElement.cpp @@ -120,6 +120,7 @@ nsHTMLHeadingElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLHtmlElement.cpp b/content/html/content/src/nsHTMLHtmlElement.cpp index 01728ed502f5..ebdddd43de78 100644 --- a/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/content/html/content/src/nsHTMLHtmlElement.cpp @@ -124,6 +124,7 @@ nsHTMLHtmlElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); it->mInner.Init(it, mInner.mNodeInfo); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); diff --git a/content/html/content/src/nsHTMLIFrameElement.cpp b/content/html/content/src/nsHTMLIFrameElement.cpp index 9c184fcbe2b5..de8d285ff6f4 100644 --- a/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/content/html/content/src/nsHTMLIFrameElement.cpp @@ -155,6 +155,7 @@ nsHTMLIFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp index 43b233c8a957..75718e5afc76 100644 --- a/content/html/content/src/nsHTMLImageElement.cpp +++ b/content/html/content/src/nsHTMLImageElement.cpp @@ -253,6 +253,7 @@ nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 3b7eb080aa4c..fbbf8363bffa 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -283,6 +283,7 @@ nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLInsElement.cpp b/content/html/content/src/nsHTMLInsElement.cpp index 51611eacf939..56aa6b1aac89 100644 --- a/content/html/content/src/nsHTMLInsElement.cpp +++ b/content/html/content/src/nsHTMLInsElement.cpp @@ -121,6 +121,7 @@ nsHTMLInsElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLIsIndexElement.cpp b/content/html/content/src/nsHTMLIsIndexElement.cpp index 530242137679..ac911b53d3fe 100644 --- a/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -120,6 +120,7 @@ nsHTMLIsIndexElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLLIElement.cpp b/content/html/content/src/nsHTMLLIElement.cpp index bbd6c3a1badc..6a89d5f1b237 100644 --- a/content/html/content/src/nsHTMLLIElement.cpp +++ b/content/html/content/src/nsHTMLLIElement.cpp @@ -122,6 +122,7 @@ nsHTMLLIElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLLabelElement.cpp b/content/html/content/src/nsHTMLLabelElement.cpp index 798db1953ad5..9dbd66cefb4f 100644 --- a/content/html/content/src/nsHTMLLabelElement.cpp +++ b/content/html/content/src/nsHTMLLabelElement.cpp @@ -225,6 +225,7 @@ nsHTMLLabelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index f005725713b7..18db6c42a796 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -144,6 +144,7 @@ nsHTMLLegendElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLLinkElement.cpp b/content/html/content/src/nsHTMLLinkElement.cpp index 6ea9cbeca1e1..1ee95654d86d 100644 --- a/content/html/content/src/nsHTMLLinkElement.cpp +++ b/content/html/content/src/nsHTMLLinkElement.cpp @@ -174,6 +174,7 @@ nsHTMLLinkElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLMapElement.cpp b/content/html/content/src/nsHTMLMapElement.cpp index 6621b798c671..b0159871d523 100644 --- a/content/html/content/src/nsHTMLMapElement.cpp +++ b/content/html/content/src/nsHTMLMapElement.cpp @@ -301,6 +301,7 @@ nsHTMLMapElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLMenuElement.cpp b/content/html/content/src/nsHTMLMenuElement.cpp index c005b2ba4300..1a097bbab71d 100644 --- a/content/html/content/src/nsHTMLMenuElement.cpp +++ b/content/html/content/src/nsHTMLMenuElement.cpp @@ -124,6 +124,7 @@ nsHTMLMenuElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLMetaElement.cpp b/content/html/content/src/nsHTMLMetaElement.cpp index de9ce18492b4..271740d70a51 100644 --- a/content/html/content/src/nsHTMLMetaElement.cpp +++ b/content/html/content/src/nsHTMLMetaElement.cpp @@ -126,6 +126,7 @@ nsHTMLMetaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLModElement.cpp b/content/html/content/src/nsHTMLModElement.cpp index cbec8b509775..e90abbf0384d 100644 --- a/content/html/content/src/nsHTMLModElement.cpp +++ b/content/html/content/src/nsHTMLModElement.cpp @@ -121,6 +121,7 @@ nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLOListElement.cpp b/content/html/content/src/nsHTMLOListElement.cpp index eb2f59aabbeb..ad2fb2b2e134 100644 --- a/content/html/content/src/nsHTMLOListElement.cpp +++ b/content/html/content/src/nsHTMLOListElement.cpp @@ -124,6 +124,7 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLObjectElement.cpp b/content/html/content/src/nsHTMLObjectElement.cpp index ac8ef5cc324b..3cbb866ffcdc 100644 --- a/content/html/content/src/nsHTMLObjectElement.cpp +++ b/content/html/content/src/nsHTMLObjectElement.cpp @@ -119,6 +119,7 @@ nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLOptGroupElement.cpp b/content/html/content/src/nsHTMLOptGroupElement.cpp index 9f74daa48020..60fbdeb1d917 100644 --- a/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -124,6 +124,7 @@ nsHTMLOptGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLOptionElement.cpp b/content/html/content/src/nsHTMLOptionElement.cpp index b0dc7f4fe4d3..3fc229694456 100644 --- a/content/html/content/src/nsHTMLOptionElement.cpp +++ b/content/html/content/src/nsHTMLOptionElement.cpp @@ -196,6 +196,7 @@ nsHTMLOptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLParagraphElement.cpp b/content/html/content/src/nsHTMLParagraphElement.cpp index eba12f39f77f..f7852eac3e0d 100644 --- a/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/content/html/content/src/nsHTMLParagraphElement.cpp @@ -126,6 +126,7 @@ nsHTMLParagraphElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); it->mInner.Init(it, mInner.mNodeInfo); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); diff --git a/content/html/content/src/nsHTMLParamElement.cpp b/content/html/content/src/nsHTMLParamElement.cpp index eb4a9bd3981d..312b354312ca 100644 --- a/content/html/content/src/nsHTMLParamElement.cpp +++ b/content/html/content/src/nsHTMLParamElement.cpp @@ -125,6 +125,7 @@ nsHTMLParamElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLPreElement.cpp b/content/html/content/src/nsHTMLPreElement.cpp index 2b9d71406c88..2a628d7474e6 100644 --- a/content/html/content/src/nsHTMLPreElement.cpp +++ b/content/html/content/src/nsHTMLPreElement.cpp @@ -122,6 +122,7 @@ nsHTMLPreElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLQuoteElement.cpp b/content/html/content/src/nsHTMLQuoteElement.cpp index 6d794ea35ee7..01426593ee19 100644 --- a/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/content/html/content/src/nsHTMLQuoteElement.cpp @@ -119,6 +119,7 @@ nsHTMLQuoteElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLScriptElement.cpp b/content/html/content/src/nsHTMLScriptElement.cpp index 8463a8a7537c..11784c27c736 100644 --- a/content/html/content/src/nsHTMLScriptElement.cpp +++ b/content/html/content/src/nsHTMLScriptElement.cpp @@ -132,6 +132,7 @@ nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLSelectElement.cpp b/content/html/content/src/nsHTMLSelectElement.cpp index d68f984b5395..932b7a3f8f96 100644 --- a/content/html/content/src/nsHTMLSelectElement.cpp +++ b/content/html/content/src/nsHTMLSelectElement.cpp @@ -432,11 +432,9 @@ nsHTMLSelectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } - // Stabilize the refcount before copying the inner element. - NS_ADDREF(it); + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); nsresult rv = it->QueryInterface(kIDOMNodeIID, (void**) aReturn); - NS_RELEASE(it); return rv; } diff --git a/content/html/content/src/nsHTMLSharedObjectElement.cpp b/content/html/content/src/nsHTMLSharedObjectElement.cpp index ac8ef5cc324b..3cbb866ffcdc 100644 --- a/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -119,6 +119,7 @@ nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLSpacerElement.cpp b/content/html/content/src/nsHTMLSpacerElement.cpp index 62daf5b7406e..4874b5932aef 100644 --- a/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/content/html/content/src/nsHTMLSpacerElement.cpp @@ -154,6 +154,7 @@ nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLSpanElement.cpp b/content/html/content/src/nsHTMLSpanElement.cpp index e9dacebf97f7..a2ac1d60413b 100644 --- a/content/html/content/src/nsHTMLSpanElement.cpp +++ b/content/html/content/src/nsHTMLSpanElement.cpp @@ -107,6 +107,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLStyleElement.cpp b/content/html/content/src/nsHTMLStyleElement.cpp index d0c8c00b46ac..24e559ab0023 100644 --- a/content/html/content/src/nsHTMLStyleElement.cpp +++ b/content/html/content/src/nsHTMLStyleElement.cpp @@ -144,6 +144,7 @@ nsHTMLStyleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableCaptionElement.cpp b/content/html/content/src/nsHTMLTableCaptionElement.cpp index 14c45f576861..d4f69a0429c5 100644 --- a/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -120,6 +120,7 @@ nsHTMLTableCaptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableCellElement.cpp b/content/html/content/src/nsHTMLTableCellElement.cpp index b5fc18615a22..d47faea6a934 100644 --- a/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/content/html/content/src/nsHTMLTableCellElement.cpp @@ -173,6 +173,7 @@ nsHTMLTableCellElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableColElement.cpp b/content/html/content/src/nsHTMLTableColElement.cpp index ca42bf90496e..b2cd73133deb 100644 --- a/content/html/content/src/nsHTMLTableColElement.cpp +++ b/content/html/content/src/nsHTMLTableColElement.cpp @@ -142,6 +142,7 @@ nsHTMLTableColElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableColGroupElement.cpp b/content/html/content/src/nsHTMLTableColGroupElement.cpp index e326e0fe139c..e2b69c6a3b42 100644 --- a/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -131,6 +131,7 @@ nsHTMLTableColGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableElement.cpp b/content/html/content/src/nsHTMLTableElement.cpp index e3630d98cd62..904229c40347 100644 --- a/content/html/content/src/nsHTMLTableElement.cpp +++ b/content/html/content/src/nsHTMLTableElement.cpp @@ -382,6 +382,7 @@ nsHTMLTableElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } @@ -819,20 +820,20 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue) NS_IMETHODIMP nsHTMLTableElement::DeleteRow(PRInt32 aValue) { - nsIDOMHTMLCollection *rows; - GetRows(&rows); - nsIDOMNode *row=nsnull; - rows->Item(aValue, &row); - if (nsnull!=row) + nsCOMPtr rows; + GetRows(getter_AddRefs(rows)); + nsCOMPtr row; + rows->Item(aValue, getter_AddRefs(row)); + if (row) { - nsIDOMNode *parent=nsnull; - row->GetParentNode(&parent); - if (nsnull!=parent) + nsCOMPtr parent=nsnull; + row->GetParentNode(getter_AddRefs(parent)); + if (parent) { - parent->RemoveChild(row, &row); + nsCOMPtr deleted_row; + parent->RemoveChild(row, getter_AddRefs(deleted_row)); } } - NS_RELEASE(rows); return NS_OK; } diff --git a/content/html/content/src/nsHTMLTableRowElement.cpp b/content/html/content/src/nsHTMLTableRowElement.cpp index fb3db6bdc33d..55b95e34ecde 100644 --- a/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/content/html/content/src/nsHTMLTableRowElement.cpp @@ -276,6 +276,7 @@ nsHTMLTableRowElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTableSectionElement.cpp b/content/html/content/src/nsHTMLTableSectionElement.cpp index 8a87bcf34faf..035f7a7e5314 100644 --- a/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -140,6 +140,7 @@ nsHTMLTableSectionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 318be22c3084..d2635a418e2f 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -191,6 +191,7 @@ nsHTMLTextAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLTitleElement.cpp b/content/html/content/src/nsHTMLTitleElement.cpp index 98e1db0768aa..1ad5edd453e5 100644 --- a/content/html/content/src/nsHTMLTitleElement.cpp +++ b/content/html/content/src/nsHTMLTitleElement.cpp @@ -125,6 +125,7 @@ nsHTMLTitleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLUListElement.cpp b/content/html/content/src/nsHTMLUListElement.cpp index 0838003619ae..4aec9fbc0e98 100644 --- a/content/html/content/src/nsHTMLUListElement.cpp +++ b/content/html/content/src/nsHTMLUListElement.cpp @@ -125,6 +125,7 @@ nsHTMLUListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLUnknownElement.cpp b/content/html/content/src/nsHTMLUnknownElement.cpp index 28dec566ffb4..97205d2bf75a 100644 --- a/content/html/content/src/nsHTMLUnknownElement.cpp +++ b/content/html/content/src/nsHTMLUnknownElement.cpp @@ -249,6 +249,7 @@ nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/content/html/content/src/nsHTMLWBRElement.cpp b/content/html/content/src/nsHTMLWBRElement.cpp index 5c4a59178870..eb53b2d49908 100644 --- a/content/html/content/src/nsHTMLWBRElement.cpp +++ b/content/html/content/src/nsHTMLWBRElement.cpp @@ -119,6 +119,7 @@ nsHTMLWBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsGenericHTMLElement.cpp b/layout/html/content/src/nsGenericHTMLElement.cpp index ae6d2adcad25..9bf68c86e997 100644 --- a/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/layout/html/content/src/nsGenericHTMLElement.cpp @@ -438,6 +438,26 @@ nsGenericHTMLElement::CopyInnerTo(nsIContent* aSrcContent, if (nsnull != mAttributes) { result = mAttributes->Clone(&(aDst->mAttributes)); + + if (NS_SUCCEEDED(result)) { + nsHTMLValue val; + result = aDst->GetHTMLAttribute(nsHTMLAtoms::style, val); + + if (result == NS_CONTENT_ATTR_HAS_VALUE && + val.GetUnit() == eHTMLUnit_ISupports) { + nsCOMPtr supports(dont_AddRef(val.GetISupportsValue())); + nsCOMPtr rule(do_QueryInterface(supports)); + + if (rule) { + nsCOMPtr ruleClone; + + result = rule->Clone(*getter_AddRefs(ruleClone)); + + val.SetISupportsValue(ruleClone); + aDst->SetHTMLAttribute(nsHTMLAtoms::style, val, PR_FALSE); + } + } + } } PRInt32 id; diff --git a/layout/html/content/src/nsHTMLAnchorElement.cpp b/layout/html/content/src/nsHTMLAnchorElement.cpp index 58127a3483c6..1a967b974aab 100644 --- a/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -198,6 +198,7 @@ nsHTMLAnchorElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLAppletElement.cpp b/layout/html/content/src/nsHTMLAppletElement.cpp index a55090304406..4db86f67d363 100644 --- a/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/layout/html/content/src/nsHTMLAppletElement.cpp @@ -190,6 +190,7 @@ nsHTMLAppletElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLAreaElement.cpp b/layout/html/content/src/nsHTMLAreaElement.cpp index 22b4903fddc1..68fde215ca53 100644 --- a/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/layout/html/content/src/nsHTMLAreaElement.cpp @@ -172,6 +172,7 @@ nsHTMLAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLBRElement.cpp b/layout/html/content/src/nsHTMLBRElement.cpp index a9ca8158495a..75f5dbc0fcf5 100644 --- a/layout/html/content/src/nsHTMLBRElement.cpp +++ b/layout/html/content/src/nsHTMLBRElement.cpp @@ -120,6 +120,7 @@ nsHTMLBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLBaseElement.cpp b/layout/html/content/src/nsHTMLBaseElement.cpp index 2fd0f9628e1a..b62883b1df20 100644 --- a/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/layout/html/content/src/nsHTMLBaseElement.cpp @@ -121,6 +121,7 @@ nsHTMLBaseElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLBaseFontElement.cpp b/layout/html/content/src/nsHTMLBaseFontElement.cpp index c3f1f025137c..ccd45cda02c0 100644 --- a/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -123,6 +123,7 @@ nsHTMLBaseFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLBodyElement.cpp b/layout/html/content/src/nsHTMLBodyElement.cpp index 3e579e15cd81..04f8ed672e3b 100644 --- a/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/layout/html/content/src/nsHTMLBodyElement.cpp @@ -744,6 +744,7 @@ nsHTMLBodyElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLButtonElement.cpp b/layout/html/content/src/nsHTMLButtonElement.cpp index 59f67d9a4f38..184cea0f03ea 100644 --- a/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/layout/html/content/src/nsHTMLButtonElement.cpp @@ -251,6 +251,7 @@ nsHTMLButtonElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLDListElement.cpp b/layout/html/content/src/nsHTMLDListElement.cpp index 38875b3c06eb..a6baf2a863ec 100644 --- a/layout/html/content/src/nsHTMLDListElement.cpp +++ b/layout/html/content/src/nsHTMLDListElement.cpp @@ -120,6 +120,7 @@ nsHTMLDListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLDelElement.cpp b/layout/html/content/src/nsHTMLDelElement.cpp index 245941164875..a44dce8d4a48 100644 --- a/layout/html/content/src/nsHTMLDelElement.cpp +++ b/layout/html/content/src/nsHTMLDelElement.cpp @@ -121,6 +121,7 @@ nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLDirectoryElement.cpp b/layout/html/content/src/nsHTMLDirectoryElement.cpp index 93a3d71ac21d..e0c3b8d51a87 100644 --- a/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -124,6 +124,7 @@ nsHTMLDirectoryElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLDivElement.cpp b/layout/html/content/src/nsHTMLDivElement.cpp index 0375b8477439..b77d8134dba4 100644 --- a/layout/html/content/src/nsHTMLDivElement.cpp +++ b/layout/html/content/src/nsHTMLDivElement.cpp @@ -121,6 +121,7 @@ nsHTMLDivElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLEmbedElement.cpp b/layout/html/content/src/nsHTMLEmbedElement.cpp index 6b9db40d39e6..e84693d42fc1 100644 --- a/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -148,6 +148,7 @@ nsHTMLEmbedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLFieldSetElement.cpp b/layout/html/content/src/nsHTMLFieldSetElement.cpp index c61980ff788c..e7d07fca0f7f 100644 --- a/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -144,6 +144,7 @@ nsHTMLFieldSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLFontElement.cpp b/layout/html/content/src/nsHTMLFontElement.cpp index 412667e5f958..170e0fd2bb46 100644 --- a/layout/html/content/src/nsHTMLFontElement.cpp +++ b/layout/html/content/src/nsHTMLFontElement.cpp @@ -127,6 +127,7 @@ nsHTMLFontElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLFormElement.cpp b/layout/html/content/src/nsHTMLFormElement.cpp index 952ee9982fc7..705ea80bfa11 100644 --- a/layout/html/content/src/nsHTMLFormElement.cpp +++ b/layout/html/content/src/nsHTMLFormElement.cpp @@ -247,6 +247,7 @@ nsHTMLFormElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLFrameElement.cpp b/layout/html/content/src/nsHTMLFrameElement.cpp index 4adc9bf9b909..cdfe3d5654f3 100644 --- a/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/layout/html/content/src/nsHTMLFrameElement.cpp @@ -150,6 +150,7 @@ nsHTMLFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLFrameSetElement.cpp b/layout/html/content/src/nsHTMLFrameSetElement.cpp index d9d9de3b3898..36559dd8d333 100644 --- a/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -121,6 +121,7 @@ nsHTMLFrameSetElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLHRElement.cpp b/layout/html/content/src/nsHTMLHRElement.cpp index 8dfb956b5c98..b98d9df918f4 100644 --- a/layout/html/content/src/nsHTMLHRElement.cpp +++ b/layout/html/content/src/nsHTMLHRElement.cpp @@ -126,6 +126,7 @@ nsHTMLHRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLHeadElement.cpp b/layout/html/content/src/nsHTMLHeadElement.cpp index d71c0af821d2..63836516d5d9 100644 --- a/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/layout/html/content/src/nsHTMLHeadElement.cpp @@ -119,6 +119,7 @@ nsHTMLHeadElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLHeadingElement.cpp b/layout/html/content/src/nsHTMLHeadingElement.cpp index 838d819b65d1..76ca3a5ce226 100644 --- a/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -120,6 +120,7 @@ nsHTMLHeadingElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLHtmlElement.cpp b/layout/html/content/src/nsHTMLHtmlElement.cpp index 01728ed502f5..ebdddd43de78 100644 --- a/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -124,6 +124,7 @@ nsHTMLHtmlElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); it->mInner.Init(it, mInner.mNodeInfo); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); diff --git a/layout/html/content/src/nsHTMLIFrameElement.cpp b/layout/html/content/src/nsHTMLIFrameElement.cpp index 9c184fcbe2b5..de8d285ff6f4 100644 --- a/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -155,6 +155,7 @@ nsHTMLIFrameElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLImageElement.cpp b/layout/html/content/src/nsHTMLImageElement.cpp index 43b233c8a957..75718e5afc76 100644 --- a/layout/html/content/src/nsHTMLImageElement.cpp +++ b/layout/html/content/src/nsHTMLImageElement.cpp @@ -253,6 +253,7 @@ nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLInputElement.cpp b/layout/html/content/src/nsHTMLInputElement.cpp index 3b7eb080aa4c..fbbf8363bffa 100644 --- a/layout/html/content/src/nsHTMLInputElement.cpp +++ b/layout/html/content/src/nsHTMLInputElement.cpp @@ -283,6 +283,7 @@ nsHTMLInputElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLInsElement.cpp b/layout/html/content/src/nsHTMLInsElement.cpp index 51611eacf939..56aa6b1aac89 100644 --- a/layout/html/content/src/nsHTMLInsElement.cpp +++ b/layout/html/content/src/nsHTMLInsElement.cpp @@ -121,6 +121,7 @@ nsHTMLInsElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLIsIndexElement.cpp b/layout/html/content/src/nsHTMLIsIndexElement.cpp index 530242137679..ac911b53d3fe 100644 --- a/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -120,6 +120,7 @@ nsHTMLIsIndexElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLLIElement.cpp b/layout/html/content/src/nsHTMLLIElement.cpp index bbd6c3a1badc..6a89d5f1b237 100644 --- a/layout/html/content/src/nsHTMLLIElement.cpp +++ b/layout/html/content/src/nsHTMLLIElement.cpp @@ -122,6 +122,7 @@ nsHTMLLIElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLLabelElement.cpp b/layout/html/content/src/nsHTMLLabelElement.cpp index 798db1953ad5..9dbd66cefb4f 100644 --- a/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/layout/html/content/src/nsHTMLLabelElement.cpp @@ -225,6 +225,7 @@ nsHTMLLabelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLLayerElement.cpp b/layout/html/content/src/nsHTMLLayerElement.cpp index 6dd38e292787..7453d9c2b299 100644 --- a/layout/html/content/src/nsHTMLLayerElement.cpp +++ b/layout/html/content/src/nsHTMLLayerElement.cpp @@ -166,6 +166,7 @@ nsHTMLLayerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLLegendElement.cpp b/layout/html/content/src/nsHTMLLegendElement.cpp index f005725713b7..18db6c42a796 100644 --- a/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/layout/html/content/src/nsHTMLLegendElement.cpp @@ -144,6 +144,7 @@ nsHTMLLegendElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLLinkElement.cpp b/layout/html/content/src/nsHTMLLinkElement.cpp index 6ea9cbeca1e1..1ee95654d86d 100644 --- a/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/layout/html/content/src/nsHTMLLinkElement.cpp @@ -174,6 +174,7 @@ nsHTMLLinkElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLMapElement.cpp b/layout/html/content/src/nsHTMLMapElement.cpp index 6621b798c671..b0159871d523 100644 --- a/layout/html/content/src/nsHTMLMapElement.cpp +++ b/layout/html/content/src/nsHTMLMapElement.cpp @@ -301,6 +301,7 @@ nsHTMLMapElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLMenuElement.cpp b/layout/html/content/src/nsHTMLMenuElement.cpp index c005b2ba4300..1a097bbab71d 100644 --- a/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/layout/html/content/src/nsHTMLMenuElement.cpp @@ -124,6 +124,7 @@ nsHTMLMenuElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLMetaElement.cpp b/layout/html/content/src/nsHTMLMetaElement.cpp index de9ce18492b4..271740d70a51 100644 --- a/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/layout/html/content/src/nsHTMLMetaElement.cpp @@ -126,6 +126,7 @@ nsHTMLMetaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLModElement.cpp b/layout/html/content/src/nsHTMLModElement.cpp index cbec8b509775..e90abbf0384d 100644 --- a/layout/html/content/src/nsHTMLModElement.cpp +++ b/layout/html/content/src/nsHTMLModElement.cpp @@ -121,6 +121,7 @@ nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLOListElement.cpp b/layout/html/content/src/nsHTMLOListElement.cpp index eb2f59aabbeb..ad2fb2b2e134 100644 --- a/layout/html/content/src/nsHTMLOListElement.cpp +++ b/layout/html/content/src/nsHTMLOListElement.cpp @@ -124,6 +124,7 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLObjectElement.cpp b/layout/html/content/src/nsHTMLObjectElement.cpp index ac8ef5cc324b..3cbb866ffcdc 100644 --- a/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/layout/html/content/src/nsHTMLObjectElement.cpp @@ -119,6 +119,7 @@ nsHTMLObjectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLOptGroupElement.cpp b/layout/html/content/src/nsHTMLOptGroupElement.cpp index 9f74daa48020..60fbdeb1d917 100644 --- a/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -124,6 +124,7 @@ nsHTMLOptGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLOptionElement.cpp b/layout/html/content/src/nsHTMLOptionElement.cpp index b0dc7f4fe4d3..3fc229694456 100644 --- a/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/layout/html/content/src/nsHTMLOptionElement.cpp @@ -196,6 +196,7 @@ nsHTMLOptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLParagraphElement.cpp b/layout/html/content/src/nsHTMLParagraphElement.cpp index eba12f39f77f..f7852eac3e0d 100644 --- a/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -126,6 +126,7 @@ nsHTMLParagraphElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); it->mInner.Init(it, mInner.mNodeInfo); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); diff --git a/layout/html/content/src/nsHTMLParamElement.cpp b/layout/html/content/src/nsHTMLParamElement.cpp index eb4a9bd3981d..312b354312ca 100644 --- a/layout/html/content/src/nsHTMLParamElement.cpp +++ b/layout/html/content/src/nsHTMLParamElement.cpp @@ -125,6 +125,7 @@ nsHTMLParamElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLPreElement.cpp b/layout/html/content/src/nsHTMLPreElement.cpp index 2b9d71406c88..2a628d7474e6 100644 --- a/layout/html/content/src/nsHTMLPreElement.cpp +++ b/layout/html/content/src/nsHTMLPreElement.cpp @@ -122,6 +122,7 @@ nsHTMLPreElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLQuoteElement.cpp b/layout/html/content/src/nsHTMLQuoteElement.cpp index 6d794ea35ee7..01426593ee19 100644 --- a/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -119,6 +119,7 @@ nsHTMLQuoteElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLScriptElement.cpp b/layout/html/content/src/nsHTMLScriptElement.cpp index 8463a8a7537c..11784c27c736 100644 --- a/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/layout/html/content/src/nsHTMLScriptElement.cpp @@ -132,6 +132,7 @@ nsHTMLScriptElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLSelectElement.cpp b/layout/html/content/src/nsHTMLSelectElement.cpp index d68f984b5395..932b7a3f8f96 100644 --- a/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/layout/html/content/src/nsHTMLSelectElement.cpp @@ -432,11 +432,9 @@ nsHTMLSelectElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } - // Stabilize the refcount before copying the inner element. - NS_ADDREF(it); + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); nsresult rv = it->QueryInterface(kIDOMNodeIID, (void**) aReturn); - NS_RELEASE(it); return rv; } diff --git a/layout/html/content/src/nsHTMLSpacerElement.cpp b/layout/html/content/src/nsHTMLSpacerElement.cpp index 62daf5b7406e..4874b5932aef 100644 --- a/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -154,6 +154,7 @@ nsHTMLSpacerElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLSpanElement.cpp b/layout/html/content/src/nsHTMLSpanElement.cpp index e9dacebf97f7..a2ac1d60413b 100644 --- a/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/layout/html/content/src/nsHTMLSpanElement.cpp @@ -107,6 +107,7 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLStyleElement.cpp b/layout/html/content/src/nsHTMLStyleElement.cpp index d0c8c00b46ac..24e559ab0023 100644 --- a/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/layout/html/content/src/nsHTMLStyleElement.cpp @@ -144,6 +144,7 @@ nsHTMLStyleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/layout/html/content/src/nsHTMLTableCaptionElement.cpp index 14c45f576861..d4f69a0429c5 100644 --- a/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -120,6 +120,7 @@ nsHTMLTableCaptionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableCellElement.cpp b/layout/html/content/src/nsHTMLTableCellElement.cpp index b5fc18615a22..d47faea6a934 100644 --- a/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -173,6 +173,7 @@ nsHTMLTableCellElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableColElement.cpp b/layout/html/content/src/nsHTMLTableColElement.cpp index ca42bf90496e..b2cd73133deb 100644 --- a/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/layout/html/content/src/nsHTMLTableColElement.cpp @@ -142,6 +142,7 @@ nsHTMLTableColElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/layout/html/content/src/nsHTMLTableColGroupElement.cpp index e326e0fe139c..e2b69c6a3b42 100644 --- a/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -131,6 +131,7 @@ nsHTMLTableColGroupElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableElement.cpp b/layout/html/content/src/nsHTMLTableElement.cpp index e3630d98cd62..904229c40347 100644 --- a/layout/html/content/src/nsHTMLTableElement.cpp +++ b/layout/html/content/src/nsHTMLTableElement.cpp @@ -382,6 +382,7 @@ nsHTMLTableElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } @@ -819,20 +820,20 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue) NS_IMETHODIMP nsHTMLTableElement::DeleteRow(PRInt32 aValue) { - nsIDOMHTMLCollection *rows; - GetRows(&rows); - nsIDOMNode *row=nsnull; - rows->Item(aValue, &row); - if (nsnull!=row) + nsCOMPtr rows; + GetRows(getter_AddRefs(rows)); + nsCOMPtr row; + rows->Item(aValue, getter_AddRefs(row)); + if (row) { - nsIDOMNode *parent=nsnull; - row->GetParentNode(&parent); - if (nsnull!=parent) + nsCOMPtr parent=nsnull; + row->GetParentNode(getter_AddRefs(parent)); + if (parent) { - parent->RemoveChild(row, &row); + nsCOMPtr deleted_row; + parent->RemoveChild(row, getter_AddRefs(deleted_row)); } } - NS_RELEASE(rows); return NS_OK; } diff --git a/layout/html/content/src/nsHTMLTableRowElement.cpp b/layout/html/content/src/nsHTMLTableRowElement.cpp index fb3db6bdc33d..55b95e34ecde 100644 --- a/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -276,6 +276,7 @@ nsHTMLTableRowElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTableSectionElement.cpp b/layout/html/content/src/nsHTMLTableSectionElement.cpp index 8a87bcf34faf..035f7a7e5314 100644 --- a/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -140,6 +140,7 @@ nsHTMLTableSectionElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTextAreaElement.cpp b/layout/html/content/src/nsHTMLTextAreaElement.cpp index 318be22c3084..d2635a418e2f 100644 --- a/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -191,6 +191,7 @@ nsHTMLTextAreaElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLTitleElement.cpp b/layout/html/content/src/nsHTMLTitleElement.cpp index 98e1db0768aa..1ad5edd453e5 100644 --- a/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/layout/html/content/src/nsHTMLTitleElement.cpp @@ -125,6 +125,7 @@ nsHTMLTitleElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLUListElement.cpp b/layout/html/content/src/nsHTMLUListElement.cpp index 0838003619ae..4aec9fbc0e98 100644 --- a/layout/html/content/src/nsHTMLUListElement.cpp +++ b/layout/html/content/src/nsHTMLUListElement.cpp @@ -125,6 +125,7 @@ nsHTMLUListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLUnknownElement.cpp b/layout/html/content/src/nsHTMLUnknownElement.cpp index 28dec566ffb4..97205d2bf75a 100644 --- a/layout/html/content/src/nsHTMLUnknownElement.cpp +++ b/layout/html/content/src/nsHTMLUnknownElement.cpp @@ -249,6 +249,7 @@ nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); } diff --git a/layout/html/content/src/nsHTMLWBRElement.cpp b/layout/html/content/src/nsHTMLWBRElement.cpp index 5c4a59178870..eb53b2d49908 100644 --- a/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/layout/html/content/src/nsHTMLWBRElement.cpp @@ -119,6 +119,7 @@ nsHTMLWBRElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) if (nsnull == it) { return NS_ERROR_OUT_OF_MEMORY; } + nsCOMPtr kungFuDeathGrip(it); mInner.CopyInnerTo(this, &it->mInner, aDeep); return it->QueryInterface(kIDOMNodeIID, (void**) aReturn); }