1
0
Fork 0
firefox/testing/web-platform/tests/wasm/jsapi/global/valueOf.any.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
646 B
JavaScript

// META: global=window,dedicatedworker,jsshell,shadowrealm
test(() => {
const argument = { "value": "i32" };
const thisValues = [
undefined,
null,
true,
"",
Symbol(),
1,
{},
WebAssembly.Global,
WebAssembly.Global.prototype,
];
const fn = WebAssembly.Global.prototype.valueOf;
for (const thisValue of thisValues) {
assert_throws_js(TypeError, () => fn.call(thisValue), `this=${format_value(thisValue)}`);
}
}, "Branding");
test(() => {
const argument = { "value": "i32" };
const global = new WebAssembly.Global(argument, 0);
assert_equals(global.valueOf({}), 0);
}, "Stray argument");