зеркало из https://github.com/mozilla/gecko-dev.git
Bug 502973 - Suppress EOF upon Terminate() in HTML5 parser. r=mrbkap.
This commit is contained in:
Родитель
ff231a3159
Коммит
731a5370a6
|
@ -424,6 +424,8 @@ nsHtml5Parser::Terminate(void)
|
|||
if (mLifeCycle == TERMINATED) {
|
||||
return NS_OK;
|
||||
}
|
||||
mSuppressEOF = PR_TRUE;
|
||||
|
||||
// XXX - [ until we figure out a way to break parser-sink circularity ]
|
||||
// Hack - Hold a reference until we are completely done...
|
||||
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
|
||||
|
@ -500,8 +502,8 @@ nsHtml5Parser::ParseFragment(const nsAString& aSourceBuffer,
|
|||
}
|
||||
mLifeCycle = TERMINATED;
|
||||
mTokenizer->eof();
|
||||
mTokenizer->end();
|
||||
mTreeBuilder->Flush();
|
||||
mTokenizer->end();
|
||||
DropParserAndPerfHint();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -529,6 +531,7 @@ nsHtml5Parser::Reset()
|
|||
mFragmentMode = PR_FALSE;
|
||||
mBlocked = PR_FALSE;
|
||||
mSuspending = PR_FALSE;
|
||||
mSuppressEOF = PR_FALSE;
|
||||
mLifeCycle = NOT_STARTED;
|
||||
mScriptElement = nsnull;
|
||||
mUninterruptibleDocWrite = PR_FALSE;
|
||||
|
@ -768,9 +771,11 @@ nsHtml5Parser::DidBuildModel()
|
|||
{
|
||||
NS_ASSERTION(mLifeCycle == STREAM_ENDING, "Bad life cycle.");
|
||||
mLifeCycle = TERMINATED;
|
||||
mTokenizer->eof();
|
||||
if (!mSuppressEOF) {
|
||||
mTokenizer->eof();
|
||||
mTreeBuilder->Flush();
|
||||
}
|
||||
mTokenizer->end();
|
||||
mTreeBuilder->Flush();
|
||||
// This is comes from nsXMLContentSink
|
||||
DidBuildModelImpl();
|
||||
mDocument->ScriptLoader()->RemoveObserver(this);
|
||||
|
|
|
@ -563,6 +563,11 @@ class nsHtml5Parser : public nsIParser,
|
|||
* The event loop will spin ASAP
|
||||
*/
|
||||
PRBool mSuspending;
|
||||
|
||||
/**
|
||||
* Whether EOF needs to be suppressed
|
||||
*/
|
||||
PRBool mSuppressEOF;
|
||||
|
||||
/**
|
||||
* The current point on parser life cycle
|
||||
|
|
|
@ -277,6 +277,7 @@ void
|
|||
nsHtml5TreeBuilder::end()
|
||||
{
|
||||
mFlushTimer->Cancel();
|
||||
mOpQueue.Clear();
|
||||
#ifdef DEBUG
|
||||
mActive = PR_FALSE;
|
||||
#endif
|
||||
|
@ -383,7 +384,6 @@ nsHtml5TreeBuilder::elementPopped(PRInt32 aNamespace, nsIAtom* aName, nsIContent
|
|||
if (aNamespace == kNameSpaceID_SVG) {
|
||||
#if 0
|
||||
if (aElement->HasAttr(kNameSpaceID_None, nsHtml5Atoms::onload)) {
|
||||
Flush();
|
||||
nsEvent event(PR_TRUE, NS_SVG_LOAD);
|
||||
event.eventStructType = NS_SVG_EVENT;
|
||||
event.flags |= NS_EVENT_FLAG_CANT_BUBBLE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче