nav2-test-document-replaced.html (2281B)
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-navigation-timing-interface"/> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script> 11 setup({ single_test: true }); 12 13 var navigation_frame; 14 var pnt1; 15 var step = 1; 16 function onload_test() 17 { 18 navigation_frame = document.getElementById("frameContext").contentWindow; 19 setTimeout("nav_frame();", 0); 20 } 21 22 function nav_frame() 23 { 24 switch (step) 25 { 26 case 1: 27 { 28 pnt1 = navigation_frame.performance.getEntriesByType("navigation")[0]; 29 navigation_frame.location.href = '/navigation-timing/resources/blank_page_green_with_onunload.html'; 30 step++; 31 break; 32 } 33 case 2: 34 { 35 navigation_frame.history.back(); 36 step++; 37 break; 38 } 39 case 3: 40 { 41 var pnt2 = navigation_frame.performance.getEntriesByType("navigation")[0]; 42 assert_equals(pnt1.type, "navigate"); 43 assert_equals(pnt2.type, "back_forward"); 44 done(); 45 break; 46 } 47 default: 48 break; 49 } 50 } 51 </script> 52 </head> 53 <body> 54 <h1> 55 Description</h1> 56 <p> 57 This test validates that a PerformanceNavigationTiming corresponding to a detached document can't access a different document's state. </p> 58 <iframe id="frameContext" onload="onload_test();" src="resources/blank_page_yellow_with_onunload.html" style="width: 250px; height: 250px;"></iframe> 59 </body> 60 </html>