Commit 747253ad authored by Steve Becker's avatar Steve Becker Committed by Commit Bot

Split up Native File System postmessage() tests

Splits each of the following tests into 3 separate tests to avoid
timeouts:

native_FileSystemBaseHandle-postMessage-manual.https.tentative.html
native_FileSystemBaseHandle-postMessage-MessagePort-manual.https.tentative.html

These tests take 5 to 7 seconds to pass, which is dangerously close to
the 7 second timeout.  A previous attempt added <meta timeout=long> to
address the timeouts.  However, wpt.py does not respect
<meta timeout=long> for tests with filenames that contain "manual".
The following bug requests a fix for wpt.py:

https://github.com/web-platform-tests/wpt/issues/21527

This change solves the timeout by splitting  each test into 3 groups:
iframe tests, window.open() tests and worker tests.  The change adds the
following 12 test files since each test runs twice, once for the native
file system and once for the virtual file system:

Native file system tests:

native_FileSystemBaseHandle-postMessage-frames-manual.https.tentative.html
native_FileSystemBaseHandle-postMessage-windows-manual.https.tentative.html
native_FileSystemBaseHandle-postMessage-workers-manual.https.tentative.html

native_FileSystemBaseHandle-postMessage-MessagePort-frames-manual.https.tentative.html
native_FileSystemBaseHandle-postMessage-MessagePort-windows-manual.https.tentative.html
native_FileSystemBaseHandle-postMessage-MessagePort-workers-manual.https.tentative.html

Virtual file system tests:

sandboxed_FileSystemBaseHandle-postMessage-frames.tentative.https.window.js
sandboxed_FileSystemBaseHandle-postMessage-windows.tentative.https.window.js
sandboxed_FileSystemBaseHandle-postMessage-workers.tentative.https.window.js

sandboxed_FileSystemBaseHandle-postMessage-MessagePort-frames.tentative.https.window.js
sandboxed_FileSystemBaseHandle-postMessage-MessagePort-windows.tentative.https.window.js
sandboxed_FileSystemBaseHandle-postMessage-MessagePort-workers.tentative.https.window.js

Bug: 1046634
Bug: 1044519
Change-Id: Ide552f708d7514e299a68887b91659ac2226018d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035055Reviewed-by: default avatarMarijn Kruisselbrink <mek@chromium.org>
Commit-Queue: Steve Becker <stevebe@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#739069}
parent 97bc8736
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/native-fs-test-helpers.js"></script>
<script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage-MessagePort-frames.js"></script>
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/native-fs-test-helpers.js"></script>
<script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage-MessagePort-windows.js"></script>
<!doctype html> <!doctype html>
<meta charset=utf-8> <meta charset=utf-8>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
...@@ -12,4 +11,4 @@ ...@@ -12,4 +11,4 @@
<script src="resources/messaging-helpers.js"></script> <script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script> <script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script> <script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage-MessagePort.js"></script> <script src="script-tests/FileSystemBaseHandle-postMessage-MessagePort-workers.js"></script>
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/native-fs-test-helpers.js"></script>
<script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage-frames.js"></script>
<!doctype html>
<meta charset=utf-8>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/native-fs-test-helpers.js"></script>
<script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage-windows.js"></script>
<!doctype html> <!doctype html>
<meta charset=utf-8> <meta charset=utf-8>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
...@@ -12,4 +11,4 @@ ...@@ -12,4 +11,4 @@
<script src="resources/messaging-helpers.js"></script> <script src="resources/messaging-helpers.js"></script>
<script src="resources/messaging-blob-helpers.js"></script> <script src="resources/messaging-blob-helpers.js"></script>
<script src="resources/messaging-serialize-helpers.js"></script> <script src="resources/messaging-serialize-helpers.js"></script>
<script src="script-tests/FileSystemBaseHandle-postMessage.js"></script> <script src="script-tests/FileSystemBaseHandle-postMessage-workers.js"></script>
...@@ -175,3 +175,13 @@ async function do_post_message_test( ...@@ -175,3 +175,13 @@ async function do_post_message_test(
await assert_equals_cloned_handles(response.cloned_handles, handles); await assert_equals_cloned_handles(response.cloned_handles, handles);
} }
// Runs the same test as do_post_message_test(), but uses a MessagePort.
// This test starts by establishing a message channel between the test runner
// and |target|. Afterwards, the test sends FileSystemHandles through the
// message port channel.
async function do_message_port_test(test, root_dir, target, target_origin) {
const message_port = create_message_channel(target, target_origin);
await do_post_message_test(
test, root_dir, /*receiver=*/ message_port, /*target=*/ message_port);
}
// META: script=resources/test-helpers.js
// META: script=resources/sandboxed-fs-test-helpers.js
// META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage-MessagePort-frames.js
// META: script=resources/test-helpers.js
// META: script=resources/sandboxed-fs-test-helpers.js
// META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage-MessagePort-windows.js
...@@ -4,5 +4,4 @@ ...@@ -4,5 +4,4 @@
// META: script=resources/messaging-helpers.js // META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js // META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js // META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage-MessagePort.js // META: script=script-tests/FileSystemBaseHandle-postMessage-MessagePort-workers.js
// META: timeout=long
// META: script=resources/test-helpers.js
// META: script=resources/sandboxed-fs-test-helpers.js
// META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage-frames.js
// META: script=resources/test-helpers.js
// META: script=resources/sandboxed-fs-test-helpers.js
// META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage-windows.js
...@@ -4,5 +4,4 @@ ...@@ -4,5 +4,4 @@
// META: script=resources/messaging-helpers.js // META: script=resources/messaging-helpers.js
// META: script=resources/messaging-blob-helpers.js // META: script=resources/messaging-blob-helpers.js
// META: script=resources/messaging-serialize-helpers.js // META: script=resources/messaging-serialize-helpers.js
// META: script=script-tests/FileSystemBaseHandle-postMessage.js // META: script=script-tests/FileSystemBaseHandle-postMessage-workers.js
// META: timeout=long
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/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.');
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
directory_test(
async (t, root_dir) => {
const child_window = await open_window(t, kDocumentMessageTarget);
await do_message_port_test(
t, root_dir, /*target=*/ child_window, /*target_origin=*/ '*');
},
'Send and receive messages using a message port in a same origin ' +
'window.');
directory_test(async (t, root_dir) => {
const blob_url = await create_message_target_blob_url(t);
const child_window = await open_window(t, blob_url);
await do_message_port_test(
t, root_dir, /*target=*/ child_window, /*target_origin=*/ '*');
}, 'Send and receive messages using a message port in a blob window.');
directory_test(
async (t, root_dir) => {
const url =
`${kDocumentMessageTarget}?pipe=header(Content-Security-Policy` +
', sandbox allow-scripts allow-same-origin)';
const child_window = await open_window(t, url);
await do_message_port_test(
t, root_dir, /*target=*/ child_window, /*target_origin=*/ '*');
},
'Send and receive messages using a message port in a sandboxed same ' +
'origin window.');
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
// /service-workers/service-worker/resources/test-helpers.sub.js
directory_test(
async (t, root_dir) => {
const dedicated_worker =
create_dedicated_worker(t, kDedicatedWorkerMessageTarget);
await do_message_port_test(t, root_dir, /*target=*/ dedicated_worker);
},
'Send and receive messages using a message port in a dedicated ' +
'worker.');
directory_test(
async (t, root_dir) => {
const scope = `${kServiceWorkerMessageTarget}` +
'?post-message-to-message-port-with-file-handle';
const registration =
await create_service_worker(t, kServiceWorkerMessageTarget, scope);
await do_message_port_test(
t, root_dir, /*target=*/ registration.installing);
},
'Send and receive messages using a message port in a service ' +
'worker.');
if (self.SharedWorker !== undefined) {
directory_test(
async (t, root_dir) => {
const shared_worker = new SharedWorker(kSharedWorkerMessageTarget);
shared_worker.port.start();
await do_message_port_test(t, root_dir, /*target=*/ shared_worker.port);
},
'Send and receive messages using a message port in a shared ' +
' worker.');
}
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
// /service-workers/service-worker/resources/test-helpers.sub.js
// Runs the same test as do_post_message_test(), but uses a MessagePort.
// This test starts by establishing a message channel between the test runner
// and |target|. Afterwards, the test sends FileSystemHandles through the
// message port channel.
async function do_message_port_test(test, root_dir, target, target_origin) {
const message_port = create_message_channel(target, target_origin);
await do_post_message_test(
test, root_dir, /*receiver=*/message_port, /*target=*/message_port);
}
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.');
directory_test(async (t, root_dir) => {
const child_window = await open_window(t, kDocumentMessageTarget);
await do_message_port_test(
t, root_dir, /*target=*/child_window, /*target_origin=*/'*');
}, 'Send and receive messages using a message port in a same origin ' +
'window.');
directory_test(async (t, root_dir) => {
const blob_url = await create_message_target_blob_url(t);
const child_window = await open_window(t, blob_url);
await do_message_port_test(
t, root_dir, /*target=*/child_window, /*target_origin=*/'*');
}, 'Send and receive messages using a message port in a blob window.');
directory_test(async (t, root_dir) => {
const url = `${kDocumentMessageTarget}?pipe=header(Content-Security-Policy` +
', sandbox allow-scripts allow-same-origin)';
const child_window = await open_window(t, url);
await do_message_port_test(
t, root_dir, /*target=*/child_window, /*target_origin=*/'*');
}, 'Send and receive messages using a message port in a sandboxed same ' +
'origin window.');
directory_test(async (t, root_dir) => {
const dedicated_worker =
create_dedicated_worker(t, kDedicatedWorkerMessageTarget);
await do_message_port_test(t, root_dir, /*target=*/dedicated_worker);
}, 'Send and receive messages using a message port in a dedicated ' +
'worker.');
directory_test(async (t, root_dir) => {
const scope = `${kServiceWorkerMessageTarget}` +
'?post-message-to-message-port-with-file-handle';
const registration = await create_service_worker(
t, kServiceWorkerMessageTarget, scope);
await do_message_port_test(t, root_dir, /*target=*/registration.installing);
}, 'Send and receive messages using a message port in a service ' +
'worker.');
if (self.SharedWorker !== undefined) {
directory_test(async (t, root_dir) => {
const shared_worker = new SharedWorker(kSharedWorkerMessageTarget);
shared_worker.port.start();
await do_message_port_test(t, root_dir, /*target=*/shared_worker.port);
}, 'Send and receive messages using a message port in a shared ' +
' worker.');
}
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
directory_test(async (t, root_dir) => {
const iframe = await add_iframe(t, {src: kDocumentMessageTarget});
await do_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ iframe.contentWindow,
/*target_origin=*/ '*');
}, 'Send and receive messages using an iframe srcdoc.');
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
directory_test(async (t, root_dir) => {
const child_window = await open_window(t, kDocumentMessageTarget);
await do_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ child_window,
/*target_origin=*/ '*');
}, 'Send and receive messages using a same origin window.');
directory_test(async (t, root_dir) => {
const blob_url = await create_message_target_blob_url(t);
const child_window = await open_window(t, blob_url);
await do_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ child_window,
/*target_origin=*/ '*');
}, 'Send and receive messages using a blob window.');
directory_test(async (t, root_dir) => {
const url = `${kDocumentMessageTarget}?pipe=header(Content-Security-Policy` +
', sandbox allow-scripts allow-same-origin)';
const child_window = await open_window(t, url);
await do_post_message_test(
t, root_dir, /*receiver=*/ self, /*target=*/ child_window,
/*target_origin=*/ '*');
}, 'Send and receive messages using a sandboxed same origin window.');
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
// /service-workers/service-worker/resources/test-helpers.sub.js
directory_test(async (t, root_dir) => {
const dedicated_worker =
create_dedicated_worker(t, kDedicatedWorkerMessageTarget);
await do_post_message_test(
t, root_dir, /*receiver=*/ dedicated_worker,
/*target=*/ dedicated_worker);
}, 'Send and receive messages using a dedicated worker.');
directory_test(async (t, root_dir) => {
const scope = `${kServiceWorkerMessageTarget}?post-message-with-file-handle`;
const registration =
await create_service_worker(t, kServiceWorkerMessageTarget, scope);
await do_post_message_test(
t, root_dir, /*receiver=*/ navigator.serviceWorker,
/*target=*/ registration.installing);
}, 'Send and receive messages using a service worker.');
if (self.SharedWorker !== undefined) {
directory_test(async (t, root_dir) => {
const shared_worker = new SharedWorker(kSharedWorkerMessageTarget);
shared_worker.port.start();
await do_post_message_test(
t, root_dir, /*receiver=*/ shared_worker.port,
/*target=*/ shared_worker.port);
}, 'Send and receive messages using a shared worker.');
}
'use strict';
// This script depends on the following scripts:
// /native-file-system/resources/messaging-helpers.js
// /native-file-system/resources/messaging-blob-helpers.js
// /native-file-system/resources/messaging-serialize-helpers.js
// /native-file-system/resources/test-helpers.js
// /service-workers/service-worker/resources/test-helpers.sub.js
directory_test(async (t, root_dir) => {
const iframe = await add_iframe(t, { src: kDocumentMessageTarget });
await do_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/iframe.contentWindow,
/*target_origin=*/'*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/iframe.contentWindow,
/*target_origin=*/'*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/iframe.contentWindow,
/*target_origin=*/'*');
}, 'Send and receive messages using 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_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/iframe.contentWindow,
/*target_origin=*/'*');
}, 'Send and receive messages using an iframe srcdoc.');
directory_test(async (t, root_dir) => {
const child_window = await open_window(t, kDocumentMessageTarget);
await do_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/child_window,
/*target_origin=*/'*');
}, 'Send and receive messages using a same origin window.');
directory_test(async (t, root_dir) => {
const blob_url = await create_message_target_blob_url(t);
const child_window = await open_window(t, blob_url);
await do_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/child_window,
/*target_origin=*/'*');
}, 'Send and receive messages using a blob window.');
directory_test(async (t, root_dir) => {
const url = `${kDocumentMessageTarget}?pipe=header(Content-Security-Policy` +
', sandbox allow-scripts allow-same-origin)';
const child_window = await open_window(t, url);
await do_post_message_test(
t, root_dir, /*receiver=*/self, /*target=*/child_window,
/*target_origin=*/'*');
}, 'Send and receive messages using a sandboxed same origin window.');
directory_test(async (t, root_dir) => {
const dedicated_worker =
create_dedicated_worker(t, kDedicatedWorkerMessageTarget);
await do_post_message_test(
t, root_dir, /*receiver=*/dedicated_worker, /*target=*/dedicated_worker);
}, 'Send and receive messages using a dedicated worker.');
directory_test(async (t, root_dir) => {
const scope = `${kServiceWorkerMessageTarget}?post-message-with-file-handle`;
const registration = await create_service_worker(
t, kServiceWorkerMessageTarget, scope);
await do_post_message_test(
t, root_dir, /*receiver=*/navigator.serviceWorker,
/*target=*/registration.installing);
}, 'Send and receive messages using a service worker.');
if (self.SharedWorker !== undefined) {
directory_test(async (t, root_dir) => {
const shared_worker = new SharedWorker(kSharedWorkerMessageTarget);
shared_worker.port.start();
await do_post_message_test(
t, root_dir, /*receiver=*/shared_worker.port,
/*target=*/shared_worker.port);
}, 'Send and receive messages using a shared worker.');
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment