setting-null-config-navigates-to-about-blank.https.html (2058B)
1 <!DOCTYPE html> 2 <meta name=timeout content=long> 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="/common/get-host-info.sub.js"></script> 8 <script src="resources/utils.js"></script> 9 <title>Test fenced frame null config installation triggers about:blank navigation.</title> 10 11 <body> 12 13 <script> 14 promise_test(async (t) => { 15 var frame_context = await attachFencedFrameContext(); 16 17 // Ensure remote context responds. 18 let alive_indicator = await Promise.race([ 19 frame_context.execute(() => 'alive'), 20 new Promise((resolve, reject) => t.step_timeout( 21 () => reject('timed_out'), 1500)) 22 ]); 23 assert_equals(alive_indicator, 'alive'); 24 25 assert_not_equals(frame_context.element.config, null); 26 // Navigates to about:blank. Because this navigates away from the page 27 // that the frame_context.element.config is currently pointing to, the 28 // FencedFrame's portion of the remote context handling code will be 29 // removed. 30 frame_context.element.config = null; 31 32 let fenced_frame_alive_promise = async (resolve) => { 33 await frame_context.execute(() => {}); 34 resolve('alive'); 35 }; 36 37 // This call should not succeed, because we should have navigated to 38 // about:blank. Note that because the code has been deleted as described 39 // above, we can't actually inspect the URL to determine it is 40 // about:blank; we have to use our timeout as a proxy. 41 let timeout_indicator = await Promise.any([ 42 new Promise(resolve => t.step_timeout( 43 () => fenced_frame_alive_promise(resolve), 500)), 44 new Promise(resolve => t.step_timeout( 45 () => resolve('timed_out'), 1500)) 46 ]); 47 assert_equals(timeout_indicator, 'timed_out'); 48 }, "Test that a fenced frame with a config explicitly set to null navigates to about:blank"); 49 </script> 50 51 </body>