gecko-dev/testing/web-platform/tests/wasm/jsapi/global/valueOf.any.js
Ms2ger 207d9a7b66 Bug 1492778 - Add tests for calling WebAssembly functions with too many arguments; r=lth
--HG--
rename : testing/web-platform/tests/wasm/jsapi/global/value-set.any.js => testing/web-platform/tests/wasm/jsapi/global/value-get-set.any.js
2018-09-21 13:45:50 +02:00

28 lines
614 B
JavaScript

// META: global=jsshell
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(new 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");