From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../broadcastchannel-success-and-failure.html | 38 ++++++++++++ .../module/broadcastchannel-success.html | 59 ++++++++++++++++++ .../module/cross-origin-module-sharing-fails.html | 38 ++++++++++++ .../module/identity-not-preserved.html | 66 +++++++++++++++++++++ .../wasm/serialization/module/incrementer.wasm | Bin 0 -> 46 bytes .../module/nested-worker-success.any.js | 9 +++ .../wasm/serialization/module/no-transferring.html | 31 ++++++++++ .../wasm/serialization/module/resources/blank.html | 2 + .../module/resources/broadcastchannel-iframe.html | 20 +++++++ .../resources/broadcastchannel-sharedworker.js | 7 +++ .../module/resources/broadcastchannel-worker.js | 9 +++ .../module/resources/create-empty-wasm-module.js | 4 ++ .../module/resources/echo-iframe.html | 11 ++++ .../serialization/module/resources/echo-worker.js | 5 ++ .../resources/incrementer-iframe-domain.sub.html | 12 ++++ .../resources/incrementer-iframe-failure.html | 5 ++ .../module/resources/incrementer-iframe.html | 11 ++++ .../module/resources/incrementer-popup.html | 11 ++++ .../resources/incrementer-worker-with-channel.js | 8 +++ .../module/resources/incrementer-worker.js | 5 ++ .../module/resources/incrementer.wasm | Bin 0 -> 46 bytes .../module/resources/nested-iframe-1.html | 5 ++ .../module/resources/nested-iframe-2.html | 5 ++ .../module/resources/nested-iframe-3.html | 5 ++ .../resources/nested-iframe-4-incrementer.html | 11 ++++ .../module/resources/serviceworker-failure.js | 35 +++++++++++ .../module/resources/sharedworker-failure.js | 21 +++++++ .../module/resources/test-incrementer.js | 57 ++++++++++++++++++ .../module/serialization-via-history.html | 34 +++++++++++ .../module/serialization-via-idb.any.js | 45 ++++++++++++++ .../serialization-via-notifications-api.any.js | 28 +++++++++ .../share-module-cross-origin-fails.sub.html | 31 ++++++++++ .../module/window-domain-success.sub.html | 26 ++++++++ .../module/window-messagechannel-success.html | 21 +++++++ .../module/window-serviceworker-failure.https.html | 56 +++++++++++++++++ .../module/window-sharedworker-failure.html | 33 +++++++++++ ...indow-similar-but-cross-origin-success.sub.html | 25 ++++++++ .../module/window-simple-success.html | 57 ++++++++++++++++++ 38 files changed, 846 insertions(+) create mode 100644 testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success-and-failure.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/cross-origin-module-sharing-fails.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/identity-not-preserved.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/incrementer.wasm create mode 100644 testing/web-platform/tests/wasm/serialization/module/nested-worker-success.any.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/no-transferring.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/blank.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-iframe.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-sharedworker.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-worker.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/create-empty-wasm-module.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/echo-iframe.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/echo-worker.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-domain.sub.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-failure.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-popup.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker-with-channel.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/incrementer.wasm create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-1.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-2.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-3.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-4-incrementer.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/serviceworker-failure.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/sharedworker-failure.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/resources/test-incrementer.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/serialization-via-history.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/serialization-via-idb.any.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/serialization-via-notifications-api.any.js create mode 100644 testing/web-platform/tests/wasm/serialization/module/share-module-cross-origin-fails.sub.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-domain-success.sub.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-messagechannel-success.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-serviceworker-failure.https.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-sharedworker-failure.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-similar-but-cross-origin-success.sub.html create mode 100644 testing/web-platform/tests/wasm/serialization/module/window-simple-success.html (limited to 'testing/web-platform/tests/wasm/serialization/module') diff --git a/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success-and-failure.html b/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success-and-failure.html new file mode 100644 index 0000000000..0d11cc595b --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success-and-failure.html @@ -0,0 +1,38 @@ + + +WebAssembly.Module cannot cross agent clusters, BroadcastChannel edition + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success.html b/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success.html new file mode 100644 index 0000000000..ddc242b82e --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/broadcastchannel-success.html @@ -0,0 +1,59 @@ + + + +Structured cloning of WebAssembly.Module: BroadcastChannel within the same agent cluster + + + + +
+ + diff --git a/testing/web-platform/tests/wasm/serialization/module/cross-origin-module-sharing-fails.html b/testing/web-platform/tests/wasm/serialization/module/cross-origin-module-sharing-fails.html new file mode 100644 index 0000000000..cd3e99b9ec --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/cross-origin-module-sharing-fails.html @@ -0,0 +1,38 @@ +Postmessage of a WebAssembly.Module cross-origin fails with a messageerror + + + + + + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/identity-not-preserved.html b/testing/web-platform/tests/wasm/serialization/module/identity-not-preserved.html new file mode 100644 index 0000000000..24bb3b16d8 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/identity-not-preserved.html @@ -0,0 +1,66 @@ + + + +WebAssembly.Modules, when cloned, do not give back the same object + + + + +
+ + diff --git a/testing/web-platform/tests/wasm/serialization/module/incrementer.wasm b/testing/web-platform/tests/wasm/serialization/module/incrementer.wasm new file mode 100644 index 0000000000..47afcdef2a Binary files /dev/null and b/testing/web-platform/tests/wasm/serialization/module/incrementer.wasm differ diff --git a/testing/web-platform/tests/wasm/serialization/module/nested-worker-success.any.js b/testing/web-platform/tests/wasm/serialization/module/nested-worker-success.any.js new file mode 100644 index 0000000000..84fbd92a29 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/nested-worker-success.any.js @@ -0,0 +1,9 @@ +// META: global=dedicatedworker,sharedworker +// META: script=resources/test-incrementer.js +"use strict"; + +promise_test(t => { + const worker = new Worker("resources/incrementer-worker.js"); + + return testSharingViaIncrementerScript(t, worker, "parent worker", worker, "sub-worker"); +}, "postMessaging to a dedicated sub-worker allows them to see each others' modifications"); diff --git a/testing/web-platform/tests/wasm/serialization/module/no-transferring.html b/testing/web-platform/tests/wasm/serialization/module/no-transferring.html new file mode 100644 index 0000000000..2f0f674b1f --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/no-transferring.html @@ -0,0 +1,31 @@ + + + +WebAssembly.Modules cannot be transferred + + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/blank.html b/testing/web-platform/tests/wasm/serialization/module/resources/blank.html new file mode 100644 index 0000000000..a3c3a4689a --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/blank.html @@ -0,0 +1,2 @@ + +Empty doc diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-iframe.html b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-iframe.html new file mode 100644 index 0000000000..83e347b5cb --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-iframe.html @@ -0,0 +1,20 @@ + + +A test page that uses a given WebAssembly.Module sent from a BroadcastChannel + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-sharedworker.js b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-sharedworker.js new file mode 100644 index 0000000000..310e0e9358 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-sharedworker.js @@ -0,0 +1,7 @@ +const channel = new BroadcastChannel("anne was here"); +channel.onmessageerror = ({ data }) => { + if(data === null) { + channel.postMessage("sw-success"); + } +} +channel.postMessage("hi"); diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-worker.js b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-worker.js new file mode 100644 index 0000000000..76a8177060 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/broadcastchannel-worker.js @@ -0,0 +1,9 @@ +const channel = new BroadcastChannel("anne was here"); +channel.onmessage = ({ data }) => { + if(data === "hi" || data === "sw-success") { + return; + } else if(data instanceof WebAssembly.Module) { + channel.postMessage("dw-success"); + } +} +channel.postMessage("hi"); diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/create-empty-wasm-module.js b/testing/web-platform/tests/wasm/serialization/module/resources/create-empty-wasm-module.js new file mode 100644 index 0000000000..7326710c9e --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/create-empty-wasm-module.js @@ -0,0 +1,4 @@ +function createEmptyWasmModule() { + return new WebAssembly.Module( + new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00])); +} diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/echo-iframe.html b/testing/web-platform/tests/wasm/serialization/module/resources/echo-iframe.html new file mode 100644 index 0000000000..c4fd5824a1 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/echo-iframe.html @@ -0,0 +1,11 @@ + + +A test page that echos back anything postMessaged to it to its parent + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/echo-worker.js b/testing/web-platform/tests/wasm/serialization/module/resources/echo-worker.js new file mode 100644 index 0000000000..cbbde8a73c --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/echo-worker.js @@ -0,0 +1,5 @@ +"use strict"; + +self.onmessage = ({ data }) => { + self.postMessage(data); +}; diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-domain.sub.html b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-domain.sub.html new file mode 100644 index 0000000000..d2d18de499 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-domain.sub.html @@ -0,0 +1,12 @@ + + +A test page that is sent a WebAssembly Module + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-failure.html b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-failure.html new file mode 100644 index 0000000000..5212a9ec72 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe-failure.html @@ -0,0 +1,5 @@ +A test page that is sent a WebAssembly Module cross-origin cannot receive it + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe.html b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe.html new file mode 100644 index 0000000000..5c8bc0735e --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-iframe.html @@ -0,0 +1,11 @@ + + +A test page that is sent a WebAssembly Module + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-popup.html b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-popup.html new file mode 100644 index 0000000000..660e472b27 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-popup.html @@ -0,0 +1,11 @@ + + +A test page that is sent a WebAssembly Module + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker-with-channel.js b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker-with-channel.js new file mode 100644 index 0000000000..0323b3e52e --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker-with-channel.js @@ -0,0 +1,8 @@ +"use strict"; +importScripts("/resources/testharness.js"); +importScripts("./test-incrementer.js"); + +self.onmessage = ({ data }) => { + // data will be a MessagePort + setupDestinationIncrementer(data, data); +}; diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker.js b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker.js new file mode 100644 index 0000000000..1779ceea52 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer-worker.js @@ -0,0 +1,5 @@ +"use strict"; +importScripts("/resources/testharness.js"); +importScripts("./test-incrementer.js"); + +setupDestinationIncrementer(self, self); diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/incrementer.wasm b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer.wasm new file mode 100644 index 0000000000..47afcdef2a Binary files /dev/null and b/testing/web-platform/tests/wasm/serialization/module/resources/incrementer.wasm differ diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-1.html b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-1.html new file mode 100644 index 0000000000..fe93cc0c4b --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-1.html @@ -0,0 +1,5 @@ + + +Nesting level 1 + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-2.html b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-2.html new file mode 100644 index 0000000000..fad52ce9de --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-2.html @@ -0,0 +1,5 @@ + + +Nesting level 2 + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-3.html b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-3.html new file mode 100644 index 0000000000..7971022b2c --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-3.html @@ -0,0 +1,5 @@ + + +Nesting level 3 + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-4-incrementer.html b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-4-incrementer.html new file mode 100644 index 0000000000..f419f4bc36 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/nested-iframe-4-incrementer.html @@ -0,0 +1,11 @@ + + +A test page that is sent a WebAssembly Module, nested 4 levels deep in iframes + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/serviceworker-failure.js b/testing/web-platform/tests/wasm/serialization/module/resources/serviceworker-failure.js new file mode 100644 index 0000000000..4ef380c253 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/serviceworker-failure.js @@ -0,0 +1,35 @@ +// Based on similar tests in html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/. +"use strict"; +self.importScripts("/resources/testharness.js"); +self.importScripts("./create-empty-wasm-module.js"); + +let state = "start in worker"; + +self.onmessage = e => { + if (e.data === "start in window") { + assert_equals(state, "start in worker"); + e.source.postMessage(state); + state = "we are expecting a messageerror due to the window sending us a WebAssembly.Module"; + } else if (e.data === "we are expecting a messageerror due to the worker sending us a WebAssembly.Module") { + assert_equals(state, "onmessageerror was received in worker"); + e.source.postMessage(createEmptyWasmModule()); + state = "done in worker"; + } else { + e.source.postMessage(`worker onmessage was reached when in state "${state}" and data ${e.data}`); + } +}; + +self.onmessageerror = e => { + if (state === "we are expecting a messageerror due to the window sending us a WebAssembly.Module") { + assert_equals(e.constructor.name, "ExtendableMessageEvent", "type"); + assert_equals(e.data, null, "data"); + assert_equals(e.origin, self.origin, "origin"); + assert_not_equals(e.source, null, "source"); + assert_equals(e.ports.length, 0, "ports length"); + + state = "onmessageerror was received in worker"; + e.source.postMessage(state); + } else { + e.source.postMessage(`worker onmessageerror was reached when in state "${state}" and data ${e.data}`); + } +}; diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/sharedworker-failure.js b/testing/web-platform/tests/wasm/serialization/module/resources/sharedworker-failure.js new file mode 100644 index 0000000000..854c70b9e8 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/sharedworker-failure.js @@ -0,0 +1,21 @@ +importScripts("./test-incrementer.js"); +importScripts("./create-empty-wasm-module.js"); + +let state = "send-sw-failure" +onconnect = initialE => { + let port = initialE.source; + port.postMessage(state) + port.onmessage = e => { + if(state === "" && e.data === "send-window-failure") { + port.postMessage(createEmptyWasmModule()) + } else { + port.postMessage("failure") + } + } + port.onmessageerror = e => { + if(state === "send-sw-failure") { + port.postMessage("send-sw-failure-success") + state = "" + } + } +} diff --git a/testing/web-platform/tests/wasm/serialization/module/resources/test-incrementer.js b/testing/web-platform/tests/wasm/serialization/module/resources/test-incrementer.js new file mode 100644 index 0000000000..65cb33227a --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/resources/test-incrementer.js @@ -0,0 +1,57 @@ +// Based on similar tests in html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/. +// +// This file is simplified from the one there, because it only tests that the +// module can be passed and that functions can be run. The SharedArrayBuffer +// version also tests that the memory is shared between the agents. + +"use strict"; + +function createWasmModule() { + return fetch('incrementer.wasm') + .then(response => { + if (!response.ok) + throw new Error(response.statusText); + return response.arrayBuffer(); + }) + .then(WebAssembly.compile); +} + +function testModule(module) { + let instance = new WebAssembly.Instance(module); + let increment = instance.exports["increment"]; + assert_equals(typeof increment, "function", `The type of the increment export should be "function", got ${typeof increment}`); + let result = increment(42); + assert_equals(result, 43, `increment(42) should be 43, got ${result}`); +} + +self.testSharingViaIncrementerScript = (t, whereToListen, whereToListenLabel, whereToSend, whereToSendLabel, origin) => { + return createWasmModule().then(module => { + return new Promise(resolve => { + + whereToListen.onmessage = t.step_func(({ data }) => { + switch (data.message) { + case "module received": { + testModule(data.module); + resolve(); + break; + } + } + }); + + whereToSend.postMessage({ message: "send module", module }, origin); + }); + }); +}; + +self.setupDestinationIncrementer = (whereToListen, whereToSendBackTo, origin) => { + whereToListen.onmessage = ({ data }) => { + switch (data.message) { + case "send module": { + let module = data.module; + testModule(data.module); + whereToSendBackTo.postMessage({ message: "module received", module }, origin); + break; + } + } + }; +}; diff --git a/testing/web-platform/tests/wasm/serialization/module/serialization-via-history.html b/testing/web-platform/tests/wasm/serialization/module/serialization-via-history.html new file mode 100644 index 0000000000..38d4301d70 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/serialization-via-history.html @@ -0,0 +1,34 @@ + + + +WebAssembly.Module cloning via history's methods invoking StructuredSerializeForStorage + + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/serialization-via-idb.any.js b/testing/web-platform/tests/wasm/serialization/module/serialization-via-idb.any.js new file mode 100644 index 0000000000..2591d2fe74 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/serialization-via-idb.any.js @@ -0,0 +1,45 @@ +// META: script=/IndexedDB/resources/support.js +"use strict"; + +function createEmptyWasmModule() { + return new WebAssembly.Module( + new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00])); +} + +async_test(t => { + const openReq = createdb(t); + + openReq.onupgradeneeded = e => { + const db = e.target.result; + const store = db.createObjectStore("store", { keyPath: "key" }); + + assert_throws_dom("DataCloneError", () => { + store.put({ key: 1, property: createEmptyWasmModule() }); + }); + t.done(); + }; +}, "WebAssembly.Module cloning via IndexedDB: basic case"); + +async_test(t => { + const openReq = createdb(t); + + openReq.onupgradeneeded = e => { + const db = e.target.result; + const store = db.createObjectStore("store", { keyPath: "key" }); + + let getter1Called = false; + let getter2Called = false; + + assert_throws_dom("DataCloneError", () => { + store.put({ key: 1, property: [ + { get x() { getter1Called = true; return 5; } }, + createEmptyWasmModule(), + { get x() { getter2Called = true; return 5; } } + ]}); + }); + + assert_true(getter1Called, "The getter before the WebAssembly.Module must have been called"); + assert_false(getter2Called, "The getter after the WebAssembly.Module must not have been called"); + t.done(); + }; +}, "WebAssembly.Module cloning via the IndexedDB: is interleaved correctly"); diff --git a/testing/web-platform/tests/wasm/serialization/module/serialization-via-notifications-api.any.js b/testing/web-platform/tests/wasm/serialization/module/serialization-via-notifications-api.any.js new file mode 100644 index 0000000000..3672192df7 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/serialization-via-notifications-api.any.js @@ -0,0 +1,28 @@ +"use strict"; + +function createEmptyWasmModule() { + return new WebAssembly.Module( + new Uint8Array([0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00])); +} + +test(() => { + assert_throws_dom("DataCloneError", () => { + new Notification("Bob: Hi", { data: createEmptyWasmModule() }); + }) +}, "WebAssembly.Module cloning via the Notifications API's data member: basic case"); + +test(() => { + let getter1Called = false; + let getter2Called = false; + + assert_throws_dom("DataCloneError", () => { + new Notification("Bob: Hi", { data: [ + { get x() { getter1Called = true; return 5; } }, + createEmptyWasmModule(), + { get x() { getter2Called = true; return 5; } } + ]}); + }); + + assert_true(getter1Called, "The getter before the SAB must have been called"); + assert_false(getter2Called, "The getter after the SAB must not have been called"); +}, "WebAssembly.Module cloning via the Notifications API's data member: is interleaved correctly"); diff --git a/testing/web-platform/tests/wasm/serialization/module/share-module-cross-origin-fails.sub.html b/testing/web-platform/tests/wasm/serialization/module/share-module-cross-origin-fails.sub.html new file mode 100644 index 0000000000..5a52b96698 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/share-module-cross-origin-fails.sub.html @@ -0,0 +1,31 @@ +Postmessage of a WebAssembly.Module cross-origin fails with a messageerror + + + + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-domain-success.sub.html b/testing/web-platform/tests/wasm/serialization/module/window-domain-success.sub.html new file mode 100644 index 0000000000..07360d8264 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-domain-success.sub.html @@ -0,0 +1,26 @@ + + + +Structured cloning of WebAssembly.Module into same-origin-domain windows + + + + +
+ + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-messagechannel-success.html b/testing/web-platform/tests/wasm/serialization/module/window-messagechannel-success.html new file mode 100644 index 0000000000..e686c81135 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-messagechannel-success.html @@ -0,0 +1,21 @@ + + + +Structured cloning of WebAssembly.Module using MessageChannel + + + + +
+ + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-serviceworker-failure.https.html b/testing/web-platform/tests/wasm/serialization/module/window-serviceworker-failure.https.html new file mode 100644 index 0000000000..d7285e2fa3 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-serviceworker-failure.https.html @@ -0,0 +1,56 @@ + + + +WebAssembly.Module cannot cross agent clusters, service worker edition + + + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-sharedworker-failure.html b/testing/web-platform/tests/wasm/serialization/module/window-sharedworker-failure.html new file mode 100644 index 0000000000..667e985a30 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-sharedworker-failure.html @@ -0,0 +1,33 @@ + + +WebAssembly.Modules cannot cross agent clusters, shared worker edition + + + + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-similar-but-cross-origin-success.sub.html b/testing/web-platform/tests/wasm/serialization/module/window-similar-but-cross-origin-success.sub.html new file mode 100644 index 0000000000..a615547de0 --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-similar-but-cross-origin-success.sub.html @@ -0,0 +1,25 @@ + + + +Structured cloning of WebAssembly.Module to similar-origin, but not same-origin, windows + + + + +
+ + diff --git a/testing/web-platform/tests/wasm/serialization/module/window-simple-success.html b/testing/web-platform/tests/wasm/serialization/module/window-simple-success.html new file mode 100644 index 0000000000..6f2ccf465e --- /dev/null +++ b/testing/web-platform/tests/wasm/serialization/module/window-simple-success.html @@ -0,0 +1,57 @@ + + + +Structured cloning of WebAssembly.Module: simple success cases that don't need dedicated files + + + + +
+ + -- cgit v1.2.3