<html><!--
This test case is used to prove HTMLParserScheduler should be suspended when page loading is deferred. See https://bugs.webkit.org/show_bug.cgi?id=48077.
However, this test case can work only when customHTMLTokenizerChunkSize() is equal to or smaller than 256. To reproduce the problem with other settings, try
adding more tags into body.
To use the test case, open it in browser, when the alert shows up, wait for a few seconds, and close the alert. If it shows "Error detected", that means the problem exists.
--><script>var showingAlert = false;
functionlog(message, replace)
{
if (replace)
document.getElementById("result").innerHTML = message;
else
document.getElementById("result").innerHTML += "<br>" + message;
}
functionshowAlert()
{
showingAlert = true;
alert("Test");
showingAlert = false;
}
// Insert a script element so the script will be executed when the resource is loaded.
functioninsertScript()
{
var head = document.getElementsByTagName("head")[0];
var myScript = document.createElement('script');
myScript.type = 'text/javascript';
myScript.src = 'resources/bugzilla-48077.js';
head.appendChild(myScript);
}
functioncheck()
{
// Check JS re-entrancy. If showingAlert is true, we are still in showAlert().
if (showingAlert)
log("Error detected!", false);
else
log("No error detected.", false);
}
// Do a time consuming job so we can make HTML parser run over time limit.
functionlogTime()
{
// time consuming job;
var startTime = newDate();
do {
var currentTime = newDate();
log(currentTime, true);
} while (currentTime - startTime < 1000);
}
</script><body><p id="result"></p><script>
insertScript();
</script><!-- Time consuming job to make HTML parser run over chunk time limit --><script>
logTime();
</script><!-- Lots of tags to make HTML parser run over chunk size limit --><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><!-- Time consuming job to make HTML parser run over chunk time limit --><script>
logTime();
</script><!-- Lots of tags to make HTML parser run over chunk size limit --><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><a>1</a><script>
check();
</script></body></html>