Bug 1145395 - Use the local fragment variable rather than *outFragNode; r=ehsan

This commit is contained in:
Ms2ger 2015-05-13 17:58:25 +02:00
parent f335a83ac9
commit a0d89be92b

View File

@ -2050,20 +2050,19 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
doc,
getter_AddRefs(fragment),
aTrustedInput);
*outFragNode = fragment;
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(*outFragNode, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(fragment, NS_ERROR_FAILURE);
RemoveBodyAndHead(*outFragNode);
RemoveBodyAndHead(fragment);
if (contextAsNode) {
// unite the two trees
nsCOMPtr<nsIDOMNode> junk;
contextLeaf->AppendChild(*outFragNode, getter_AddRefs(junk));
*outFragNode = contextAsNode;
contextLeaf->AppendChild(fragment, getter_AddRefs(junk));
fragment = contextAsNode;
}
rv = StripFormattingNodes(*outFragNode, true);
rv = StripFormattingNodes(fragment, true);
NS_ENSURE_SUCCESS(rv, rv);
// If there was no context, then treat all of the data we did get as the
@ -2071,9 +2070,10 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
if (contextLeaf) {
*outEndNode = *outStartNode = contextLeaf;
} else {
*outEndNode = *outStartNode = *outFragNode;
*outEndNode = *outStartNode = fragment;
}
*outFragNode = fragment.forget();
*outStartOffset = 0;
// get the infoString contents