window-parent.https.html (1798B)
1 <!DOCTYPE html> 2 <title>Test window.parent</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="resources/utils.js"></script> 7 8 <body> 9 10 <script> 11 promise_test(async () => { 12 const window_parent_key = token(); 13 const window_parent_ack_key = token(); 14 15 attachFencedFrame(generateURL("resources/window-parent-inner.html", 16 [window_parent_key, window_parent_ack_key])); 17 18 // Get the result for the top-level fenced frame. 19 const fenced_frame_result = await nextValueFromServer(window_parent_key); 20 assert_equals(fenced_frame_result, "pass: fenced frame", "The top-level " + 21 "fenced frame has the right value for " + 22 "`window.parent`"); 23 24 // Write an ACK, so that the fenced frame knows it can send message over the 25 // `window_parent_key` channel again. 26 writeValueToServer(window_parent_ack_key, "ACK"); 27 28 // Get the result for the iframe inside the fenced frame. 29 const iframe_in_fenced_frame_result = await nextValueFromServer(window_parent_key); 30 assert_equals(iframe_in_fenced_frame_result, "pass: fenced frame > iframe", 31 "The iframe inside the top-level fenced frame has the right " + 32 "value for `window.parent`"); 33 34 writeValueToServer(window_parent_ack_key, "ACK"); 35 36 // Get the result for the nested fenced frame. 37 const nested_fenced_frame_result = await nextValueFromServer(window_parent_key); 38 assert_equals(nested_fenced_frame_result, "pass: fenced frame > fenced frame", 39 "The nested fenced frame inside the top-level fenced frame " + 40 "has the right value for `window.parent`"); 41 }, "window.parent"); 42 </script> 43 44 </body>