summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html')
-rw-r--r--testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html b/testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html
new file mode 100644
index 0000000000..b64d97083f
--- /dev/null
+++ b/testing/web-platform/mozilla/tests/dom/fs/support/fs-open_writable_after_trigger.sub.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<title>Child context test(s)</title>
+<head>
+ <script src="/resources/testharness.js"></script>
+ <script src="testHelpers.js"></script>
+</head>
+<body>
+ <div id="log"></div>
+ <script>
+ const channel = new BroadcastChannel("Coordinate writables");
+
+ let triggered = false;
+
+ channel.onmessage = e => {
+ if ("Create writable in the second window" === e.data) {
+ triggered = true;
+ }
+ };
+
+ channel.postMessage("Second window ready!");
+
+ promise_test(async t => {
+ try {
+ const maxWaitMs = 2000;
+ await waitUntil(() => { return triggered; }, maxWaitMs);
+ assert_true(triggered, "Did we receive a trigger?");
+
+ const dir = await navigator.storage.getDirectory();
+ const opts = { create: true };
+ const file = await dir.getFileHandle('funky-file-handle', opts);
+ let writable = await file.createWritable({});
+ t.add_cleanup(async () => { await writable.close(); });
+ assert_true(!!writable, "Did we receive a writable?");
+
+ channel.postMessage("Success");
+ } catch(err) {
+ channel.postMessage(err.message);
+
+ throw err;
+ }
+ });
+ </script>
+</body>
+</html>