nav2-test-redirect-chain-xserver-partial-opt-in.html (2763B)
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 const frame_performance = document.getElementById("frameContext").contentWindow.performance; 17 assert_equals(frame_performance.getEntriesByType("navigation")[0].type, 18 "navigate", 19 "Expected navigation type to be navigate."); 20 assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectCount, 0, 21 "Expected redirectCount to be 0."); 22 assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectStart, 0, 23 "Expected redirectStart to be 0."); 24 assert_equals(frame_performance.getEntriesByType("navigation")[0].redirectEnd, 0, 25 "Expected redirectEnd to be 0."); 26 done(); 27 } 28 </script> 29 30 </head> 31 <body> 32 <h1>Description</h1> 33 <p>This test validates the values of the window.performance.getEntriesByType("navigation")[0].redirectCount and the 34 window.performance.getEntriesByType("navigation")[0].redirectStart/End times for a cross-origin server side redirect navigation when the redirect chooses to opt-in.</p> 35 36 <iframe id="frameContext" src="" style="width: 250px; height: 250px;"></iframe> 37 <script> 38 // combine the page origin and redirect origin into the IFRAME's src URL 39 const destUrl_first = make_absolute_url({subdomain: "www", 40 path: "/common/redirect-opt-in.py", 41 query: "location=" + make_absolute_url( 42 {path: "/navigation-timing/resources/blank_page_green.html"}) 43 }); 44 const destUrl = make_absolute_url({subdomain: "www", 45 path: "/common/redirect.py", 46 query: "location=" + destUrl_first}); 47 let frameContext = document.getElementById("frameContext"); 48 frameContext.onload = onload_test; 49 frameContext.src = destUrl; 50 </script> 51 </body> 52 </html>