Bug 765620 - When parsing from stream without executing scripts, avoid script execution-related tree ops. r=smaug

This commit is contained in:
Henri Sivonen
2012-06-20 10:05:39 +03:00
parent b89242d733
commit 67be401de2
11 changed files with 40 additions and 32 deletions

View File

@@ -759,6 +759,13 @@ nsHtml5TreeOpExecutor::StartLayout() {
void
nsHtml5TreeOpExecutor::RunScript(nsIContent* aScriptElement)
{
if (mRunsToCompletion) {
// We are in createContextualFragment() or in the upcoming document.parse().
// Do nothing. Let's not even mark scripts malformed here, because that
// could cause serialization weirdness later.
return;
}
NS_ASSERTION(aScriptElement, "No script to run");
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(aScriptElement);
@@ -770,13 +777,6 @@ nsHtml5TreeOpExecutor::RunScript(nsIContent* aScriptElement)
return;
}
if (mPreventScriptExecution) {
sele->PreventExecution();
}
if (mRunsToCompletion) {
return;
}
if (sele->GetScriptDeferred() || sele->GetScriptAsync()) {
DebugOnly<bool> block = sele->AttemptToExecute();
NS_ASSERTION(!block, "Defer or async script tried to block.");