diff --git a/content/base/src/nsDOMParser.cpp b/content/base/src/nsDOMParser.cpp index 7316f483955..b982c896cdd 100644 --- a/content/base/src/nsDOMParser.cpp +++ b/content/base/src/nsDOMParser.cpp @@ -69,9 +69,6 @@ nsDOMParser::ParseFromString(const PRUnichar *str, rv = SetUpDocument(DocumentFlavorHTML, getter_AddRefs(domDocument)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr document = do_QueryInterface(domDocument); - nsDependentString sourceBuffer(str); - rv = nsContentUtils::ParseDocumentHTML(sourceBuffer, document, false); - NS_ENSURE_SUCCESS(rv, rv); // Keep the XULXBL state, base URL and principal setting in sync with the // XML case @@ -85,6 +82,10 @@ nsDOMParser::ParseFromString(const PRUnichar *str, // And the right principal document->SetPrincipal(mPrincipal); + nsDependentString sourceBuffer(str); + rv = nsContentUtils::ParseDocumentHTML(sourceBuffer, document, false); + NS_ENSURE_SUCCESS(rv, rv); + domDocument.forget(aResult); return rv; }