3 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.
4 However, this test case can work only when customHTMLTokenizerChunkSize() is equal to or smaller than 256. To reproduce the problem with other settings, try
5 adding more tags into body.
7 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.
10 var showingAlert
= false;
12 function log(message
, replace
)
15 document
.getElementById("result").innerHTML
= message
;
17 document
.getElementById("result").innerHTML
+= "<br>" + message
;
27 // Insert a script element so the script will be executed when the resource is loaded.
28 function insertScript()
30 var head
= document
.getElementsByTagName("head")[0];
31 var myScript
= document
.createElement('script');
32 myScript
.type
= 'text/javascript';
33 myScript
.src
= 'resources/bugzilla-48077.js';
34 head
.appendChild(myScript
);
38 // Check JS re-entrancy. If showingAlert is true, we are still in showAlert().
40 log("Error detected!", false);
42 log("No error detected.", false);
45 // Do a time consuming job so we can make HTML parser run over time limit.
48 // time consuming job;
49 var startTime
= new Date();
51 var currentTime
= new Date();
52 log(currentTime
, true);
53 } while (currentTime
- startTime
< 1000);
63 <!-- Time consuming job to make HTML parser run over chunk time limit -->
68 <!-- Lots of tags to make HTML parser run over chunk size limit -->
69 <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>
71 <!-- Time consuming job to make HTML parser run over chunk time limit -->
76 <!-- Lots of tags to make HTML parser run over chunk size limit -->
77 <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>