Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<title>Check execution of WebAssembly start function</title>
<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 execute the start function.");
window.log = [];
window.addEventListener("error", ev => {
log.push(ev.message);
});
window.addEventListener("load", test_load.step_func_done(ev => {
assert_array_equals(log, ["executed"]);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/execute-start.wasm" onerror="unreachable()""></script>

View File

@ -0,0 +1,17 @@
<!doctype html>
<title>Exported names from a WebAssembly module</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type=module>
setup({ single_test: true });
import * as mod from "./resources/exported-names.wasm";
assert_array_equals(Object.getOwnPropertyNames(mod).sort(),
["func", "glob", "mem", "tab"]);
assert_true(mod.func instanceof Function);
assert_true(mod.mem instanceof WebAssembly.Memory);
assert_true(mod.glob instanceof WebAssembly.Global);
assert_true(mod.tab instanceof WebAssembly.Table);
assert_throws_js(TypeError, () => { mod.func = 2; });
done();
</script>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>Handling of importing invalid WebAssembly modules</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
window.log = [];
window.addEventListener("error", ev => log.push(ev.error));
const test_load = async_test(
"Test that imports of invalid WebAssembly modules leads to WebAssembly.CompileError on window.");
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log.length, 2);
assert_equals(log[0].constructor, WebAssembly.CompileError);
assert_equals(log[1].constructor, WebAssembly.CompileError);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/invalid-bytecode.wasm" onerror="unreachable()"></script>
<script type="module" src="./resources/invalid-module.wasm" onerror="unreachable()"></script>

View File

@ -0,0 +1,38 @@
<!doctype html>
<title>Cyclic linking between JavaScript and WebAssembly (JS higher)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
const test_load = async_test(
"Check cyclic linking between JavaScript and WebAssembly where JavaScript is higher in the module graph.");
window.log = [];
window.addEventListener("error", ev => {
test_load.step(() => assert_equals(ev.error.constructor, WebAssembly.LinkError));
log.push(ev.message);
});
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log.length, 10);
assert_equals(log[1], 1);
assert_equals(log[3], 2);
assert_equals(log[5], 3);
assert_equals(log[7], 4);
assert_equals(log[9], 5);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/js-wasm-cycle-value.js"
onerror="unreachable()" onload="log.push(1)"></script>
<script type="module" src="./resources/js-wasm-cycle-global.js"
onerror="unreachable()" onload="log.push(2)"></script>
<script type="module" src="./resources/js-wasm-cycle-memory.js"
onerror="unreachable()" onload="log.push(3)"></script>
<script type="module" src="./resources/js-wasm-cycle-table.js"
onerror="unreachable()" onload="log.push(4)"></script>
<script type="module" src="./resources/js-wasm-cycle-function-error.js"
onerror="unreachable()" onload="log.push(5)"></script>

View File

@ -0,0 +1,11 @@
<!doctype html>
<title>Check bindings in JavaScript and WebAssembly cycle (JS higher)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type=module>
setup({ single_test: true });
import { f } from "./resources/js-wasm-cycle.js";
assert_equals(f(), 24);
done();
</script>

View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<title>Handling of importing invalid WebAssembly modules</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
window.log = [];
window.addEventListener("error", ev => log.push(ev.error));
const test_load = async_test(
"Test that imports of invalid WebAssembly modules leads to WebAssembly.CompileError on window.");
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log.length, 2);
assert_equals(log[0].constructor, WebAssembly.CompileError);
assert_equals(log[1].constructor, WebAssembly.CompileError);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/invalid-bytecode.wasm" onerror="unreachable()"></script>
<script type="module" src="./resources/invalid-module.wasm" onerror="unreachable()"></script>

View File

@ -0,0 +1 @@
export { f } from "./resources/resolve-export.wasm";

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<title>Check ResolveExport on invalid re-export from WebAssembly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
const test_load = async_test(
"Re-export of missing Wasm export should result in SyntaxError.");
window.log = [];
window.addEventListener("error", ev => {
test_load.step(() => assert_equals(ev.error.constructor, SyntaxError));
log.push(ev.message);
});
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log[1], 1);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resolve-export.js"
onerror="unreachable()" onload="log.push(1)"></script>

View File

@ -0,0 +1,2 @@
export const func = 42;
import { f } from "./js-wasm-cycle-function-error.wasm";

View File

@ -0,0 +1,2 @@
export const glob = new WebAssembly.Global({ value: "i32" }, 42);
import { f } from "./js-wasm-cycle-global.wasm";

View File

@ -0,0 +1,2 @@
export const mem = new WebAssembly.Memory({ initial: 10 });
import { f } from "./js-wasm-cycle-memory.wasm";

View File

@ -0,0 +1,2 @@
export const tab = new WebAssembly.Table({ element: "anyfunc" });
import { f } from "./js-wasm-cycle-table.wasm";

View File

@ -0,0 +1,2 @@
export const val = 42;
import { f } from "./js-wasm-cycle-value.wasm";

View File

@ -0,0 +1,13 @@
function f() { return 42; }
export { f };
import { mem, tab, glob, func } from "./js-wasm-cycle.wasm";
assert_true(glob instanceof WebAssembly.Global);
assert_equals(glob.valueOf(), 1);
assert_true(mem instanceof WebAssembly.Memory);
assert_true(tab instanceof WebAssembly.Table);
assert_true(func instanceof Function);
f = () => { return 24 };
assert_equals(func(), 42);

View File

@ -0,0 +1 @@
export function logExec() { log.push("executed"); }

View File

@ -0,0 +1 @@
export let f = 5;

View File

@ -0,0 +1 @@
export let g = 5;

View File

@ -0,0 +1 @@
export let m = 5;

View File

@ -0,0 +1 @@
export let t = 5;

View File

@ -0,0 +1,15 @@
import * as mod from "./wasm-js-cycle.wasm";
let jsGlob = new WebAssembly.Global({ value: "i32", mutable: true }, 42);
let jsMem = new WebAssembly.Memory({ initial: 10 });
let jsTab = new WebAssembly.Table({ initial: 10, element: "anyfunc" });
let jsFunc = () => { return 42; };
export { jsGlob, jsMem, jsTab, jsFunc };
export function mutateBindings() {
jsGlob = 0;
jsMem = 0;
jsTab = 0;
jsFunc = 0;
}

View File

@ -0,0 +1 @@
export function pm(x) { postMessage(x); }

View File

@ -0,0 +1 @@
import * as mod from "./worker.wasm"

Binary file not shown.

View File

@ -0,0 +1,14 @@
<!doctype html>
<title>Check import and export between WebAssembly modules</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type=module>
setup({ single_test: true });
window.log = [];
import { logExec } from "./resources/wasm-import-from-wasm.wasm";
logExec();
assert_equals(log.length, 1);
assert_equals(log[0], "executed");
done();
</script>

View File

@ -0,0 +1,34 @@
<!doctype html>
<title>Errors for imports of WebAssembly modules</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
const test_load = async_test(
"Invalid imports for WebAssembly modules should error.");
window.log = [];
window.addEventListener("error", ev => {
test_load.step(() => assert_equals(ev.error.constructor, WebAssembly.LinkError));
log.push(ev.message);
});
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log[1], 1);
assert_equals(log[3], 2);
assert_equals(log[5], 3);
assert_equals(log[7], 4);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/wasm-import-func.wasm"
onerror="unreachable()" onload="log.push(1)"></script>
<script type="module" src="./resources/wasm-import-memory.wasm"
onerror="unreachable()" onload="log.push(2)"></script>
<script type="module" src="./resources/wasm-import-table.wasm"
onerror="unreachable()" onload="log.push(3)"></script>
<script type="module" src="./resources/wasm-import-global.wasm"
onerror="unreachable()" onload="log.push(4)"></script>

View File

@ -0,0 +1,32 @@
<!doctype html>
<title>Check bindings in JavaScript and WebAssembly cycle (Wasm higher)</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type=module>
setup({ single_test: true });
import * as wasm from "./resources/wasm-js-cycle.wasm";
import * as js from "./resources/wasm-js-cycle.js";
js.mutateBindings();
assert_true(wasm.wasmGlob instanceof WebAssembly.Global);
assert_equals(wasm.wasmGlob.valueOf(), 24);
assert_true(wasm.wasmFunc instanceof Function);
assert_equals(wasm.wasmFunc(), 43);
assert_equals(wasm.incrementGlob(), 43);
const buf = new Int32Array(wasm.wasmMem.buffer);
assert_equals(buf[0], 0);
assert_equals(wasm.mutateMem(), 42);
assert_equals(buf[0], 42);
assert_equals(wasm.wasmTab.get(0), null);
const ref = wasm.mutateTab();
assert_true(ref instanceof Function);
assert_equals(wasm.wasmTab.get(0), ref);
done();
</script>

View File

@ -0,0 +1,26 @@
<!doctype html>
<title>Errors for linking WebAssembly module scripts</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception: true});
const test_load = async_test(
"Link errors for imports between WebAssembly modules should be reported.");
window.log = [];
window.addEventListener("error", ev => {
test_load.step(() => assert_equals(ev.error.constructor, WebAssembly.LinkError));
log.push(ev.message);
});
window.addEventListener("load", test_load.step_func_done(ev => {
assert_equals(log.length, 2);
assert_equals(log[1], 1);
}));
function unreachable() { log.push("unexpected"); }
</script>
<script type="module" src="./resources/wasm-import-error-from-wasm.wasm"
onerror="unreachable()" onload="log.push(1)"></script>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Testing import of WebAssembly 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.js", { type: "module" });
worker.onmessage = (msg) => {
assert_equals(msg.data, 42);
done();
}
</script>

View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<title>Testing WebAssembly 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.wasm", { type: "module" });
worker.onmessage = (msg) => {
assert_equals(msg, 42);
done();
}
</script>