navigate-related-page-by-name.https.html (1972B)
1 <!DOCTYPE html> 2 <title>Test named frame navigation of related pages.</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 // A: top-level frame 13 // C: fencedframe 14 // B: auxiliary browsing context 15 // 16 // C should not be able to navigate B. 17 18 // Create an auxiliary browsing context with a particular name. 19 const second_window = attachWindowContext({target: "target_name"}); 20 21 // Create a fenced frame, and use the same target name inside of it. 22 const frame = attachFencedFrameContext(); 23 await frame.execute(async () => { 24 window.open("resources/dummy.html", "target_name"); 25 }); 26 27 // Confirm that the top-level frame's related page (`second_window`) 28 // wasn't navigated by the fenced frame, i.e. that name resolution 29 // for related pages is fenced. 30 await second_window.execute(() => {}); 31 }, 'navigate related pages from inside a fenced frame'); 32 33 promise_test(async () => { 34 // A: top-level frame 35 // B: auxiliary browsing context 36 // C: fencedframe 37 // 38 // A should not be able to navigate C. 39 40 // Create an auxiliary browsing context. 41 const second_window = attachWindowContext(); 42 await second_window.execute(async () => { 43 // Create a fenced frame inside that context and give it a particular name. 44 window.frame = attachFencedFrameContext(); 45 await window.frame.execute(() => { 46 window.name = "target_name"; 47 }); 48 }); 49 50 // Navigate that target name from the original top-level frame. 51 window.open("resources/dummy.html", "target_name"); 52 53 // Confirm that the fenced frame wasn't navigated. 54 await second_window.execute(async () => { 55 await frame.execute(() => {}); 56 }); 57 }, 'navigate fenced frames inside related pages from the embedder'); 58 59 </script> 60 </body>