navigate-by-name-succeed.https.html (1266B)
1 <!DOCTYPE html> 2 <title>Test successful named frame navigation.</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/utils.js"></script> 6 <script src="/common/dispatcher/dispatcher.js"></script> 7 <script src="resources/utils.js"></script> 8 9 <body> 10 <script> 11 promise_test(async () => { 12 // This test uses the following layout: 13 // A: Top-level frame 14 // B: fencedframe 15 // C: iframe 16 // 17 // The purpose is to test that named target lookups of C succeed in A, i.e. 18 // that lookups work even when the first child of a frame is fenced. 19 20 const fencedframe = attachFencedFrameContext(); 21 const iframe = attachIFrameContext(); 22 23 // Give the iframe a name. 24 await iframe.execute(() => { window.name = "target_frame"; }); 25 26 // Modify state in the iframe, using a JS navigation to the target name. 27 window.open("javascript:window.success=true;", "target_frame"); 28 29 // Check that the navigation happened in the iframe. 30 await iframe.execute(() => { 31 // If the JS code didn't run in the iframe, `window.success` would be 32 // undefined. 33 assert_true(window.success, 'The JS code ran in the iframe.'); 34 }); 35 }, 'navigate iframe sibling of fenced frame'); 36 </script> 37 </body>