FileSystemBaseHandle-postMessage-frames.js (1631B)
1 'use strict'; 2 3 // This script depends on the following scripts: 4 // /fs/resources/messaging-helpers.js 5 // /fs/resources/messaging-blob-helpers.js 6 // /fs/resources/messaging-serialize-helpers.js 7 // /fs/resources/test-helpers.js 8 9 directory_test(async (t, root_dir) => { 10 const iframe = await add_iframe(t, {src: kDocumentMessageTarget}); 11 await do_post_message_test( 12 t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow, 13 /*target_origin=*/ '*'); 14 }, 'Send and receive messages using a same origin iframe.'); 15 16 directory_test(async (t, root_dir) => { 17 const iframe = await add_iframe(t, { 18 src: kDocumentMessageTarget, 19 sandbox: 'allow-scripts allow-same-origin' 20 }); 21 await do_post_message_test( 22 t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow, 23 /*target_origin=*/ '*'); 24 }, 'Send and receive messages using a sandboxed same origin iframe.'); 25 26 directory_test(async (t, root_dir) => { 27 const blob_url = await create_message_target_blob_url(t); 28 const iframe = await add_iframe(t, {src: blob_url}); 29 await do_post_message_test( 30 t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow, 31 /*target_origin=*/ '*'); 32 }, 'Send and receive messages using a blob iframe.'); 33 34 directory_test(async (t, root_dir) => { 35 const iframe_html = await create_message_target_html_without_subresources(t); 36 const iframe = await add_iframe(t, {srcdoc: iframe_html}); 37 await do_post_message_test( 38 t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow, 39 /*target_origin=*/ '*'); 40 }, 'Send and receive messages using an iframe srcdoc.');