mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb: Import WebAssembly jsapi cross-realm torture tests from WPT
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
The failures here are due to us not actually implementing the error types yet.
This commit is contained in:
parent
7b0c2da14f
commit
86c756a589
Notes:
github-actions[bot]
2025-04-23 12:32:06 +00:00
Author: https://github.com/ADKaster
Commit: 86c756a589
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4440
Reviewed-by: https://github.com/gmta ✅
3 changed files with 1866 additions and 0 deletions
|
@ -0,0 +1,126 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 120 tests
|
||||
|
||||
75 Pass
|
||||
45 Fail
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `0` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `-1` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `""` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `"str"` prototype
|
||||
Pass WebAssembly.Module: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Pass WebAssembly.Module: bound cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Module: bound bound cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Module: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Module: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Module: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Pass WebAssembly.Module: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `0` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `-1` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `""` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `"str"` prototype
|
||||
Pass WebAssembly.Instance: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Pass WebAssembly.Instance: bound cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Instance: bound bound cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Instance: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Instance: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Instance: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Pass WebAssembly.Instance: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `0` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `-1` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `""` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `"str"` prototype
|
||||
Pass WebAssembly.Memory: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Pass WebAssembly.Memory: bound cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Memory: bound bound cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Memory: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Memory: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Memory: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Pass WebAssembly.Memory: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `0` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `-1` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `""` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `"str"` prototype
|
||||
Pass WebAssembly.Table: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Pass WebAssembly.Table: bound cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Table: bound bound cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Table: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Table: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Table: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Pass WebAssembly.Table: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `0` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `-1` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `""` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `"str"` prototype
|
||||
Pass WebAssembly.Global: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Pass WebAssembly.Global: bound cross-realm NewTarget with `undefined` prototype
|
||||
Pass WebAssembly.Global: bound bound cross-realm NewTarget with `null` prototype
|
||||
Pass WebAssembly.Global: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Pass WebAssembly.Global: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Pass WebAssembly.Global: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Pass WebAssembly.Global: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `0` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `-1` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `""` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `"str"` prototype
|
||||
Fail WebAssembly.CompileError: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Fail WebAssembly.CompileError: bound cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.CompileError: bound bound cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.CompileError: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.CompileError: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.CompileError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Fail WebAssembly.CompileError: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `0` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `-1` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `""` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `"str"` prototype
|
||||
Fail WebAssembly.LinkError: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Fail WebAssembly.LinkError: bound cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.LinkError: bound bound cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.LinkError: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.LinkError: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.LinkError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Fail WebAssembly.LinkError: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `0` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `-1` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `""` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `"str"` prototype
|
||||
Fail WebAssembly.RuntimeError: cross-realm NewTarget with `symbol "Symbol()"` prototype
|
||||
Fail WebAssembly.RuntimeError: bound cross-realm NewTarget with `undefined` prototype
|
||||
Fail WebAssembly.RuntimeError: bound bound cross-realm NewTarget with `null` prototype
|
||||
Fail WebAssembly.RuntimeError: bound Proxy of cross-realm NewTarget with `false` prototype
|
||||
Fail WebAssembly.RuntimeError: Proxy of cross-realm NewTarget with `true` prototype
|
||||
Fail WebAssembly.RuntimeError: Proxy of Proxy of cross-realm NewTarget with `-0` prototype
|
||||
Fail WebAssembly.RuntimeError: Proxy of bound cross-realm NewTarget with `NaN` prototype
|
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>WebAssembly JS API: Default [[Prototype]] value is from NewTarget's Realm</title>
|
||||
<link rel="help" href="https://webidl.spec.whatwg.org/#internally-create-a-new-object-implementing-the-interface">
|
||||
<link rel="help" href="https://tc39.es/ecma262/#sec-nativeerror">
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<script src="wasm-module-builder.js"></script>
|
||||
<body>
|
||||
<iframe id="constructor-iframe" hidden></iframe>
|
||||
<iframe id="new-target-iframe" hidden></iframe>
|
||||
<iframe id="other-iframe" hidden></iframe>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const constructorRealm = document.querySelector("#constructor-iframe").contentWindow;
|
||||
const newTargetRealm = document.querySelector("#new-target-iframe").contentWindow;
|
||||
const otherRealm = document.querySelector("#other-iframe").contentWindow;
|
||||
|
||||
const emptyModuleBinary = new WasmModuleBuilder().toBuffer();
|
||||
const interfaces = [
|
||||
["Module", emptyModuleBinary],
|
||||
["Instance", new WebAssembly.Module(emptyModuleBinary)],
|
||||
["Memory", {initial: 0}],
|
||||
["Table", {element: "anyfunc", initial: 0}],
|
||||
["Global", {value: "i32"}],
|
||||
|
||||
// See step 2 of https://tc39.es/ecma262/#sec-nativeerror
|
||||
["CompileError"],
|
||||
["LinkError"],
|
||||
["RuntimeError"],
|
||||
];
|
||||
|
||||
const primitives = [
|
||||
undefined,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
0,
|
||||
-1,
|
||||
"",
|
||||
"str",
|
||||
Symbol(),
|
||||
];
|
||||
|
||||
const getNewTargets = function* (realm) {
|
||||
for (const primitive of primitives) {
|
||||
const newTarget = new realm.Function();
|
||||
newTarget.prototype = primitive;
|
||||
yield [newTarget, "cross-realm NewTarget with `" + format_value(primitive) + "` prototype"];
|
||||
}
|
||||
|
||||
// GetFunctionRealm (https://tc39.es/ecma262/#sec-getfunctionrealm) coverage:
|
||||
const bindOther = otherRealm.Function.prototype.bind;
|
||||
const ProxyOther = otherRealm.Proxy;
|
||||
|
||||
const bound = new realm.Function();
|
||||
bound.prototype = undefined;
|
||||
yield [bindOther.call(bound), "bound cross-realm NewTarget with `undefined` prototype"];
|
||||
|
||||
const boundBound = new realm.Function();
|
||||
boundBound.prototype = null;
|
||||
yield [bindOther.call(bindOther.call(boundBound)), "bound bound cross-realm NewTarget with `null` prototype"];
|
||||
|
||||
const boundProxy = new realm.Function();
|
||||
boundProxy.prototype = false;
|
||||
yield [bindOther.call(new ProxyOther(boundProxy, {})), "bound Proxy of cross-realm NewTarget with `false` prototype"];
|
||||
|
||||
const proxy = new realm.Function();
|
||||
proxy.prototype = true;
|
||||
yield [new ProxyOther(proxy, {}), "Proxy of cross-realm NewTarget with `true` prototype"];
|
||||
|
||||
const proxyProxy = new realm.Function();
|
||||
proxyProxy.prototype = -0;
|
||||
yield [new ProxyOther(new ProxyOther(proxyProxy, {}), {}), "Proxy of Proxy of cross-realm NewTarget with `-0` prototype"];
|
||||
|
||||
const proxyBound = new realm.Function();
|
||||
proxyBound.prototype = NaN;
|
||||
yield [new ProxyOther(bindOther.call(proxyBound), {}), "Proxy of bound cross-realm NewTarget with `NaN` prototype"];
|
||||
};
|
||||
|
||||
for (const [interfaceName, constructorArg] of interfaces) {
|
||||
for (const [newTarget, testDescription] of getNewTargets(newTargetRealm)) {
|
||||
test(() => {
|
||||
const Constructor = constructorRealm.WebAssembly[interfaceName];
|
||||
const object = Reflect.construct(Constructor, [constructorArg], newTarget);
|
||||
|
||||
const NewTargetConstructor = newTargetRealm.WebAssembly[interfaceName];
|
||||
assert_true(object instanceof NewTargetConstructor);
|
||||
assert_equals(Object.getPrototypeOf(object), NewTargetConstructor.prototype);
|
||||
}, `WebAssembly.${interfaceName}: ${testDescription}`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
1645
Tests/LibWeb/Text/input/wpt-import/wasm/jsapi/wasm-module-builder.js
Normal file
1645
Tests/LibWeb/Text/input/wpt-import/wasm/jsapi/wasm-module-builder.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue