1
0
Fork 0
firefox/testing/web-platform/tests/fs/script-tests/FileSystemBaseHandle-postMessage-MessagePort-frames.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

44 lines
1.7 KiB
JavaScript

'use strict';
// This script depends on the following scripts:
// /fs/resources/messaging-helpers.js
// /fs/resources/messaging-blob-helpers.js
// /fs/resources/messaging-serialize-helpers.js
// /fs/resources/test-helpers.js
directory_test(
async (t, root_dir) => {
const iframe = await add_iframe(t, {src: kDocumentMessageTarget});
await do_message_port_test(
t, root_dir, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
},
'Send and receive messages using a message port in a same origin ' +
'iframe.');
directory_test(
async (t, root_dir) => {
const iframe = await add_iframe(t, {
src: kDocumentMessageTarget,
sandbox: 'allow-scripts allow-same-origin'
});
await do_message_port_test(
t, root_dir, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
},
'Send and receive messages using a message port in a sandboxed same ' +
'origin iframe.');
directory_test(async (t, root_dir) => {
const blob_url = await create_message_target_blob_url(t);
const iframe = await add_iframe(t, {src: blob_url});
await do_message_port_test(
t, root_dir, /*target=*/ iframe.contentWindow, /*target_origin=*/ '*');
}, 'Send and receive messages using a message port in a blob iframe.');
directory_test(async (t, root_dir) => {
const iframe_html = await create_message_target_html_without_subresources(t);
const iframe = await add_iframe(t, {srcdoc: iframe_html});
await do_message_port_test(
t, root_dir, /*target=*/ iframe.contentWindow, /*target_origin=*/ '*');
}, 'Send and receive messages using a message port in an iframe srcdoc.');