OLD | NEW |
1 window.performance = window.performance || {}; | 1 window.performance = window.performance || {}; |
2 var navigation = performance.navigation || {}; | 2 var navigation = performance.navigation || {}; |
3 var timing = performance.timing || {}; | 3 var timing = performance.timing || {}; |
4 var originalTiming = {}; | 4 var originalTiming = {}; |
5 | 5 |
6 window.addEventListener("load", function() { setTimeout(testTimingWithDocumentOp
en, 0); }, false); | 6 window.addEventListener("load", function() { setTimeout(testTimingWithDocumentOp
en, 0); }, false); |
7 | 7 |
8 function testTimingWithDocumentOpen() | 8 function testTimingWithDocumentOpen() |
9 { | 9 { |
10 for (property in timing) { | 10 for (property in timing) { |
11 originalTiming[property] = timing[property]; | 11 originalTiming[property] = timing[property]; |
12 } | 12 } |
13 | 13 |
14 document.open(); | 14 document.open(); |
15 document.write("<html>"); | 15 document.write("<html>"); |
16 document.write("<head>"); | 16 document.write("<head>"); |
17 document.write("<script src=\"../js/resources/js-test-pre.js\"></script>"); | 17 document.write("<script src=\"../js/resources/js-test-pre.js\"></script>"); |
18 document.write("</head>"); | 18 document.write("</head>"); |
19 document.write("<body>"); | 19 document.write("<body>"); |
20 document.write("<script src=\"../js/resources/js-test-post.js\"></script>"); | |
21 document.write("</body>"); | 20 document.write("</body>"); |
22 document.write("</html>"); | 21 document.write("</html>"); |
23 document.close(); | 22 document.close(); |
24 | 23 |
25 description("This test verifies that the NavigationTimings don't change afte
r a document.open()."); | 24 description("This test verifies that the NavigationTimings don't change afte
r a document.open()."); |
26 | 25 |
27 setTimeout(finishTest, 0); | 26 setTimeout(finishTest, 0); |
28 } | 27 } |
29 | 28 |
30 function finishTest() { | 29 function finishTest() { |
31 keys = Object.keys(timing).sort(); | 30 keys = Object.keys(timing).sort(); |
32 for (var i = 0; i < keys.length; ++i) { | 31 for (var i = 0; i < keys.length; ++i) { |
33 shouldBe("timing." + keys[i], "originalTiming." + keys[i]); | 32 shouldBe("timing." + keys[i], "originalTiming." + keys[i]); |
34 } | 33 } |
35 | 34 |
36 finishJSTest(); | 35 finishJSTest(); |
37 } | 36 } |
38 | 37 |
39 jsTestIsAsync = true; | 38 jsTestIsAsync = true; |
OLD | NEW |