diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/wasm | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/wasm')
6 files changed, 68 insertions, 12 deletions
diff --git a/testing/web-platform/tests/wasm/jsapi/module/moduleSource.tentative.any.js b/testing/web-platform/tests/wasm/jsapi/module/moduleSource.tentative.any.js index a3d09d55d6..8a94cdd48c 100644 --- a/testing/web-platform/tests/wasm/jsapi/module/moduleSource.tentative.any.js +++ b/testing/web-platform/tests/wasm/jsapi/module/moduleSource.tentative.any.js @@ -9,6 +9,9 @@ setup(() => { test(() => { assert_equals(typeof AbstractModuleSource, "undefined"); +}, "AbstractModuleSource is not a global"); + +test(() => { const AbstractModuleSource = Object.getPrototypeOf(WebAssembly.Module); assert_equals(AbstractModuleSource.name, "AbstractModuleSource"); assert_not_equals(AbstractModuleSource, Function); @@ -16,22 +19,13 @@ test(() => { test(() => { const AbstractModuleSourceProto = Object.getPrototypeOf(WebAssembly.Module.prototype); - assert_not_equals(AbstractModuleSourceProto, Object); + assert_not_equals(AbstractModuleSourceProto, Object.prototype); const AbstractModuleSource = Object.getPrototypeOf(WebAssembly.Module); assert_equals(AbstractModuleSource.prototype, AbstractModuleSourceProto); }, "AbstractModuleSourceProto intrinsic"); test(() => { - const builder = new WasmModuleBuilder(); - - builder - .addFunction("fn", kSig_v_v) - .addBody([]) - .exportFunc(); - builder.addMemory(0, 256, true); - - const buffer = builder.toBuffer() - const module = new WebAssembly.Module(buffer); + const module = new WebAssembly.Module(emptyModuleBinary); const AbstractModuleSource = Object.getPrototypeOf(WebAssembly.Module); const toStringTag = Object.getOwnPropertyDescriptor(AbstractModuleSource.prototype, Symbol.toStringTag).get; diff --git a/testing/web-platform/tests/wasm/webapi/esm-integration/resources/worker-source-phase.js b/testing/web-platform/tests/wasm/webapi/esm-integration/resources/worker-source-phase.js index c7a4f0d437..e1c2703899 100644 --- a/testing/web-platform/tests/wasm/webapi/esm-integration/resources/worker-source-phase.js +++ b/testing/web-platform/tests/wasm/webapi/esm-integration/resources/worker-source-phase.js @@ -1,3 +1,10 @@ import source modSource from "./worker.wasm"; +import { pm } from "./worker-helper.js"; assert_true(modSource instanceof WebAssembly.Module); assert_true(await import.source("./worker.wasm") === modSource); + +await WebAssembly.instantiate(modSource, { + "./worker-helper.js": { + "pm": pm + } +});
\ No newline at end of file diff --git a/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-allows-wasm.tentative.html b/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-allows-wasm.tentative.html new file mode 100644 index 0000000000..07faf9a5a1 --- /dev/null +++ b/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-allows-wasm.tentative.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<title>script-src allows Wasm execution</title> +<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + setup({allow_uncaught_exception: true}); + + const test_load = async_test( + "Importing a WebAssembly module should be allowed by script-src CSP."); + + window.log = []; + document.addEventListener("securitypolicyviolation", (e) => { + window.log.push(e.violatedDirective); + }); + + window.addEventListener("load", test_load.step_func_done(ev => { + assert_array_equals(log, ["executed"]); + })); +</script> +<script type="module" src="./resources/execute-start.wasm"></script> diff --git a/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-blocks-wasm.tentative.html b/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-blocks-wasm.tentative.html new file mode 100644 index 0000000000..c1232730ea --- /dev/null +++ b/testing/web-platform/tests/wasm/webapi/esm-integration/script-src-blocks-wasm.tentative.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<title>script-src blocks Wasm execution</title> +<meta http-equiv="Content-Security-Policy" content="script-src 'unsafe-inline';"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + setup({allow_uncaught_exception: true}); + + const test_load = async_test( + "Importing a WebAssembly module should be guarded by script-src CSP."); + + window.log = []; + document.addEventListener("securitypolicyviolation", (e) => { + window.log.push(e.violatedDirective); + }); + + window.addEventListener("load", test_load.step_func_done(ev => { + assert_array_equals(log, ["script-src-elem"]); + })); +</script> +<script type="module" src="./resources/execute-start.wasm"></script> diff --git a/testing/web-platform/tests/wasm/webapi/esm-integration/source-phase.tentative.html b/testing/web-platform/tests/wasm/webapi/esm-integration/source-phase.tentative.html index eb415a4c6f..870b16bd0a 100644 --- a/testing/web-platform/tests/wasm/webapi/esm-integration/source-phase.tentative.html +++ b/testing/web-platform/tests/wasm/webapi/esm-integration/source-phase.tentative.html @@ -13,7 +13,7 @@ const AbstractModuleSource = Object.getPrototypeOf(WebAssembly.Module); assert_equals(AbstractModuleSource.name, "AbstractModuleSource"); assert_true(exportedNamesSource instanceof AbstractModuleSource); -assert_array_equals(WebAssembly.Module.exports(exportedNamesSource).sort(), +assert_array_equals(WebAssembly.Module.exports(exportedNamesSource).map(({ name }) => name).sort(), ["func", "glob", "mem", "tab"]); const wasmImportFromWasmSource = await import.source("./resources/wasm-import-from-wasm.wasm"); diff --git a/testing/web-platform/tests/wasm/webapi/esm-integration/worker-import-source-phase.tentative.html b/testing/web-platform/tests/wasm/webapi/esm-integration/worker-import-source-phase.tentative.html new file mode 100644 index 0000000000..e193f3efc6 --- /dev/null +++ b/testing/web-platform/tests/wasm/webapi/esm-integration/worker-import-source-phase.tentative.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<title>Testing import of WebAssembly source phase from JavaScript worker</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script type=module> +setup({ single_test: true }); +const worker = new Worker("resources/worker-source-phase.js", { type: "module" }); +worker.onmessage = (msg) => { + assert_equals(msg.data, 42); + done(); +} +</script> |