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=\"../../resources/js-test.js\"></script>"); | 17 document.write("<script src=\"../../resources/js-test.js\"></script>"); |
18 document.write("</head>"); | 18 document.write("</head>"); |
19 document.write("<body>"); | 19 document.write("<body>"); |
20 document.write("</body>"); | 20 document.write("</body>"); |
21 document.write("</html>"); | 21 document.write("</html>"); |
22 document.close(); | 22 document.close(); |
23 | 23 |
24 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()."); |
25 | 25 |
26 setTimeout(finishTest, 0); | 26 setTimeout(finishTest, 0); |
27 } | 27 } |
28 | 28 |
29 function finishTest() { | 29 function finishTest() { |
30 keys = Object.keys(timing).sort(); | 30 var properties = getAllPropertyNames(timing); |
31 for (var i = 0; i < keys.length; ++i) { | 31 for (var i = 0; i < properties.length; ++i) { |
32 shouldBe("timing." + keys[i], "originalTiming." + keys[i]); | 32 shouldBe("timing." + properties[i], "originalTiming." + properties[i]); |
33 } | 33 } |
34 | 34 |
35 finishJSTest(); | 35 finishJSTest(); |
36 } | 36 } |
37 | 37 |
38 jsTestIsAsync = true; | 38 jsTestIsAsync = true; |
OLD | NEW |