test-timing-xserver-redirect.html (3269B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>window.performance.timing.redirect attributes on a cross-origin server redirected navigation</title> 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/> 8 <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"/> 9 <script src="/resources/testharness.js"></script> 10 <script src="/resources/testharnessreport.js"></script> 11 <script src="/common/performance-timeline-utils.js"></script> 12 <script src="resources/webperftestharness.js"></script> 13 <script src="/common/utils.js"></script> 14 <script> 15 setup({explicit_done: true}); 16 17 // 18 // Test configuration 19 // 20 21 var subdomain = "www"; 22 23 // 24 // Tests 25 // 26 function onload_test() 27 { 28 test_namespace('navigation'); 29 if (performanceNamespace === undefined) 30 { 31 // avoid script errors 32 done(); 33 return; 34 } 35 36 performanceNamespace = document.getElementById("frameContext").contentWindow.performance; 37 test_equals(performanceNamespace.navigation.type, 38 performanceNamespace.navigation.TYPE_NAVIGATE, 39 'timing.navigation.type is TYPE_NAVIGATE'); 40 test_equals(performanceNamespace.navigation.redirectCount, 0, 'navigation.redirectCount == 0 on a cross-origin server redirected navigation'); 41 42 test_timing_greater_than('navigationStart', 0); 43 44 test_equals(performanceNamespace.timing.redirectStart, 0, 'timing.redirectStart == 0 on a server redirected navigation from another domain'); 45 test_equals(performanceNamespace.timing.redirectEnd, 0, 'timing.redirectEnd == 0 on a server redirected navigation from another domain'); 46 47 done(); 48 } 49 </script> 50 51 </head> 52 <body> 53 <h1>Description</h1> 54 <p>This test validates the values of the window.performance.redirectCount and the 55 window.performance.timing.redirectStart/End times for a cross-origin server side redirect navigation.</p> 56 57 <div id="log"></div> 58 <br /> 59 <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> 60 <script> 61 // combine the page origin and redirect origin into the IFRAME's src URL 62 var destUrl = make_absolute_url({subdomain: subdomain, 63 path: "/common/redirect.py", 64 query: "location=" + make_absolute_url( 65 {path: "/navigation-timing/resources/blank_page_green.html"}) 66 }); 67 var frameContext = document.getElementById("frameContext"); 68 frameContext.onload = onload_test; 69 frameContext.src = destUrl; 70 </script> 71 </body> 72 </html>