FileSystemBaseHandle-postMessage-MessagePort-frames.js (1707B)
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( 10 async (t, root_dir) => { 11 const iframe = await add_iframe(t, {src: kDocumentMessageTarget}); 12 await do_message_port_test( 13 t, root_dir, /*target=*/ iframe.contentWindow, 14 /*target_origin=*/ '*'); 15 }, 16 'Send and receive messages using a message port in a same origin ' + 17 'iframe.'); 18 19 directory_test( 20 async (t, root_dir) => { 21 const iframe = await add_iframe(t, { 22 src: kDocumentMessageTarget, 23 sandbox: 'allow-scripts allow-same-origin' 24 }); 25 await do_message_port_test( 26 t, root_dir, /*target=*/ iframe.contentWindow, 27 /*target_origin=*/ '*'); 28 }, 29 'Send and receive messages using a message port in a sandboxed same ' + 30 'origin iframe.'); 31 32 directory_test(async (t, root_dir) => { 33 const blob_url = await create_message_target_blob_url(t); 34 const iframe = await add_iframe(t, {src: blob_url}); 35 await do_message_port_test( 36 t, root_dir, /*target=*/ iframe.contentWindow, /*target_origin=*/ '*'); 37 }, 'Send and receive messages using a message port in a blob iframe.'); 38 39 directory_test(async (t, root_dir) => { 40 const iframe_html = await create_message_target_html_without_subresources(t); 41 const iframe = await add_iframe(t, {srcdoc: iframe_html}); 42 await do_message_port_test( 43 t, root_dir, /*target=*/ iframe.contentWindow, /*target_origin=*/ '*'); 44 }, 'Send and receive messages using a message port in an iframe srcdoc.');