Bug 765620 - When parsing from stream without executing scripts, avoid script execution-related tree ops. r=smaug
This commit is contained in:
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user