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({done: onCompletedRun, unit: 'ms'}); 17 18 iframe.onload = function() { 19 var now = PerfTestRunner.now(); 20 PerfTestRunner.measureValueAsync(now - then); 21 then = now; 22 iframe.src = specURL; 23 } 24 var then = PerfTestRunner.now(); 25 iframe.src = specURL; 26 27 function onCompletedRun() { 28 iframe.onload = null; 29 // 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. 31 // document.body.removeChild(iframe); 32 } 33 </script> 34 </body> 35