nav2-test-redirect-xserver.html (2504B)
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-2/#sec-PerformanceNavigationTiming"/> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/common/utils.js"></script> 11 <script> 12 setup({ single_test: true }); 13 14 function onload_test() 15 { 16 var performanceNamespace = document.getElementById("frameContext").contentWindow.performance; 17 assert_equals(performanceNamespace.getEntriesByType("navigation")[0].type, 18 "navigate", 19 "Expected navigation type to be navigate."); 20 assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectCount, 0, 21 "Expected redirectCount to be 0."); 22 assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectStart, 0, 23 "Expected redirectStart to be 0."); 24 assert_equals(performanceNamespace.getEntriesByType("navigation")[0].redirectEnd, 0, 25 "Expected redirectEnd to be 0."); 26 27 done(); 28 } 29 </script> 30 31 </head> 32 <body> 33 <h1>Description</h1> 34 <p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the 35 window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation.</p> 36 37 <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> 38 <script> 39 // combine the page origin and redirect origin into the IFRAME's src URL 40 var destUrl = make_absolute_url({subdomain: "www", 41 path: "/common/redirect.py", 42 query: "location=" + make_absolute_url( 43 {path: "/navigation-timing/resources/blank_page_green.html"}) 44 }); 45 var frameContext = document.getElementById("frameContext"); 46 frameContext.onload = onload_test; 47 frameContext.src = destUrl; 48 </script> 49 </body> 50 </html>