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