Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / PerformanceTests / Parser / html-parser-threaded.html
1 <!DOCTYPE html>
2 <body>
3 <script src="../resources/runner.js"></script>
4 <script>
5 // Use the threaded parser if available:
6 if (window.internals && window.internals.settings.setThreadedHTMLParser)
7     window.internals.settings.setThreadedHTMLParser(true);
8
9 var specURL = "resources/html5.html";
10
11 var iframe = document.createElement("iframe");
12 iframe.style.display = "none";  // Prevent creation of the rendering tree, so we only test HTML parsing.
13 iframe.sandbox = '';  // Prevent external script loads which could cause write() to return before completing the parse.
14 document.body.appendChild(iframe);
15
16 PerfTestRunner.prepareToMeasureValuesAsync({
17     description: "Measures performance of the threaded HTML parser (if available).",
18     done: onCompletedRun,
19     unit: 'ms'
20 });
21
22 iframe.onload = function() {
23     var now = PerfTestRunner.now();
24     PerfTestRunner.measureValueAsync(now - then);
25     then = now;
26     iframe.src = specURL;
27 }
28 var then = PerfTestRunner.now();
29 iframe.src = specURL;
30
31 function onCompletedRun() {
32     iframe.onload = null;
33     // FIXME: This should probably remove the iframe, but that currently
34     // causes the threaded-parser to never send the load event for the main page.
35     // document.body.removeChild(iframe);
36 }
37 </script>
38 </body>