Bug 1333990: Part 2c.1 - Interrupt the XML flush loop after inserting document element. r?hsivonen
MozReview-Commit-ID: 8CslW407IaQ
--- a/dom/xml/nsXMLContentSink.cpp
+++ b/dom/xml/nsXMLContentSink.cpp
@@ -574,18 +574,16 @@ nsXMLContentSink::CloseElement(nsIConten
// Now tell the script that it's ready to go. This may execute the script
// or return true, or neither if the script doesn't need executing.
bool block = sele->AttemptToExecute();
// If the parser got blocked, make sure to return the appropriate rv.
// I'm not sure if this is actually needed or not.
if (mParser && !mParser->IsParserEnabled()) {
- // XXX The HTML sink doesn't call BlockParser here, why do we?
- GetParser()->BlockParser();
block = true;
}
return block ? NS_ERROR_HTMLPARSER_BLOCK : NS_OK;
}
nsresult rv = NS_OK;
if (nodeInfo->Equals(nsGkAtoms::meta, kNameSpaceID_XHTML) &&
@@ -1010,16 +1008,20 @@ nsXMLContentSink::HandleStartElement(con
if (content != mDocElement && !mCurrentHead) {
// This isn't the root and we're not inside an XHTML <head>.
// Might need to start layout
MaybeStartLayout(false);
}
if (content == mDocElement) {
NotifyDocElementCreated(mDocument);
+
+ if (aInterruptable && NS_SUCCEEDED(result) && mParser && !mParser->IsParserEnabled()) {
+ return NS_ERROR_HTMLPARSER_BLOCK;
+ }
}
return aInterruptable && NS_SUCCEEDED(result) ? DidProcessATokenImpl() :
result;
}
NS_IMETHODIMP
nsXMLContentSink::HandleEndElement(const char16_t *aName)