1// META: global=window,dedicatedworker,jsshell
2
3test(() => {
4  const argument = { "value": "i32" };
5  const thisValues = [
6    undefined,
7    null,
8    true,
9    "",
10    Symbol(),
11    1,
12    {},
13    WebAssembly.Global,
14    WebAssembly.Global.prototype,
15  ];
16
17  const fn = WebAssembly.Global.prototype.valueOf;
18
19  for (const thisValue of thisValues) {
20    assert_throws_js(TypeError, () => fn.call(thisValue), `this=${format_value(thisValue)}`);
21  }
22}, "Branding");
23
24test(() => {
25  const argument = { "value": "i32" };
26  const global = new WebAssembly.Global(argument, 0);
27  assert_equals(global.valueOf({}), 0);
28}, "Stray argument");
29