Bug 523087 - Check for termination before every tree op in the HTML5 parser. r=bnewman.

This commit is contained in:
Henri Sivonen
2009-10-21 15:10:14 +03:00
parent 5c9324592e
commit 875857fc6b
3 changed files with 19 additions and 12 deletions

View File

@@ -128,7 +128,6 @@ nsHtml5TreeOpExecutor::DidBuildModel(PRBool aTerminated)
// This is comes from nsXMLContentSink
DidBuildModelImpl(aTerminated);
mDocument->ScriptLoader()->RemoveObserver(this);
nsContentSink::StartLayout(PR_FALSE);
ScrollToRef();
mDocument->RemoveObserver(this);
mDocument->EndLoad();
@@ -294,6 +293,10 @@ nsHtml5TreeOpExecutor::Flush()
const nsHtml5TreeOperation* start = mOpQueue.Elements();
const nsHtml5TreeOperation* end = start + opQueueLength;
for (nsHtml5TreeOperation* iter = (nsHtml5TreeOperation*)start; iter < end; ++iter) {
if (NS_UNLIKELY(!mParser)) {
// The previous tree op caused a call to nsIParser::Terminate();
break;
}
iter->Perform(this);
}
FlushPendingAppendNotifications();
@@ -316,10 +319,15 @@ nsHtml5TreeOpExecutor::Flush()
#endif
}
}
ScheduleTimer();
mFlushing = PR_FALSE;
if (!mParser) {
return;
}
ScheduleTimer();
if (mScriptElement) {
NS_ASSERTION(!mCallDidBuildModel, "Had a script element and DidBuildModel call");
RunScript();