Bug 1151048. Disable speculative tokenization in the parser if it's failing too much. r=hsivonen

This commit is contained in:
Boris Zbarsky
2015-04-13 19:36:33 -04:00
parent 4a558be56f
commit 16aad37285
2 changed files with 30 additions and 1 deletions

View File

@@ -1315,7 +1315,11 @@ nsHtml5StreamParser::ParseAvailableData()
if (IsTerminatedOrInterrupted()) {
return;
}
if (mSpeculating && !IsSpeculationEnabled()) {
return;
}
for (;;) {
if (!mFirstBuffer->hasMore()) {
if (mFirstBuffer == mLastBuffer) {
@@ -1454,6 +1458,7 @@ nsHtml5StreamParser::ContinueAfterScripts(nsHtml5Tokenizer* aTokenizer,
!aTreeBuilder->snapshotMatches(speculation->GetSnapshot())) {
speculationFailed = true;
// We've got a failed speculation :-(
MaybeDisableFutureSpeculation();
Interrupt(); // Make the parser thread release the tokenizer mutex sooner
// now fall out of the speculationAutoLock into the tokenizerAutoLock block
} else {