OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" > |
| 5 <title>Navigation Timing 2 WPT</title> |
| 6 <link rel="author" title="Google" href="http://www.google.com/" /> |
| 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navig
ation-timing-interface"/> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <h1>Description</h1> |
| 13 <p>This test validates that all of the window.performance.getEntriesByTy
pe("navigation") attributes remain unchanged after an in document navigation (UR
L fragment change).</p> |
| 14 |
| 15 <script> |
| 16 var navTiming2Attributes = [ |
| 17 'connectEnd', |
| 18 'connectStart', |
| 19 'decodedBodySize', |
| 20 'domComplete', |
| 21 'domContentLoadedEventEnd', |
| 22 'domContentLoadedEventStart', |
| 23 'domInteractive', |
| 24 'domainLookupEnd', |
| 25 'domainLookupStart', |
| 26 'duration', |
| 27 'encodedBodySize', |
| 28 'entryType', |
| 29 'fetchStart', |
| 30 'initiatorType', |
| 31 'loadEventEnd', |
| 32 'loadEventStart', |
| 33 'name', |
| 34 'redirectCount', |
| 35 'redirectEnd', |
| 36 'redirectStart', |
| 37 'requestStart', |
| 38 'responseEnd', |
| 39 'responseStart', |
| 40 'secureConnectionStart', |
| 41 'transferSize', |
| 42 'type', |
| 43 'unloadEventEnd', |
| 44 'unloadEventStart', |
| 45 'workerStart' |
| 46 ]; |
| 47 |
| 48 var initial_timing = {}; |
| 49 |
| 50 function check_timing_not_changed() |
| 51 { |
| 52 var timing = window.performance.getEntriesByType("navigation")[0
]; |
| 53 for (var i = 0; i < navTiming2Attributes.length; ++i) |
| 54 { |
| 55 var property = navTiming2Attributes[i]; |
| 56 assert_equals(timing[property], initial_timing[property], |
| 57 property + " is the same after in document navig
ation."); |
| 58 } |
| 59 done(); |
| 60 } |
| 61 |
| 62 function save_timing_after_load() |
| 63 { |
| 64 var timing = window.performance.getEntriesByType("navigation")[0
]; |
| 65 for (var i = 0; i < navTiming2Attributes.length; ++i) |
| 66 { |
| 67 var property = navTiming2Attributes[i]; |
| 68 initial_timing[property] = timing[property]; |
| 69 } |
| 70 window.location.href = "#1"; |
| 71 setTimeout("check_timing_not_changed()", 0); |
| 72 } |
| 73 |
| 74 function load_handler() |
| 75 { |
| 76 window.removeEventListener("load", load_handler); |
| 77 setTimeout("save_timing_after_load()", 0); |
| 78 } |
| 79 |
| 80 window.addEventListener("load", load_handler, false); |
| 81 </script> |
| 82 </body> |
| 83 </html> |
OLD | NEW |