xref: /third_party/node/test/fixtures/wpt/wasm/jsapi/global/valueOf.any.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/wasm/jsapi/global/
11cb0ef41Sopenharmony_ci// META: global=window,dedicatedworker,jsshell
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_citest(() => {
41cb0ef41Sopenharmony_ci  const argument = { "value": "i32" };
51cb0ef41Sopenharmony_ci  const thisValues = [
61cb0ef41Sopenharmony_ci    undefined,
71cb0ef41Sopenharmony_ci    null,
81cb0ef41Sopenharmony_ci    true,
91cb0ef41Sopenharmony_ci    "",
101cb0ef41Sopenharmony_ci    Symbol(),
111cb0ef41Sopenharmony_ci    1,
121cb0ef41Sopenharmony_ci    {},
131cb0ef41Sopenharmony_ci    WebAssembly.Global,
141cb0ef41Sopenharmony_ci    WebAssembly.Global.prototype,
151cb0ef41Sopenharmony_ci  ];
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci  const fn = WebAssembly.Global.prototype.valueOf;
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ci  for (const thisValue of thisValues) {
201cb0ef41Sopenharmony_ci    assert_throws_js(TypeError, () => fn.call(thisValue), `this=${format_value(thisValue)}`);
211cb0ef41Sopenharmony_ci  }
221cb0ef41Sopenharmony_ci}, "Branding");
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_citest(() => {
251cb0ef41Sopenharmony_ci  const argument = { "value": "i32" };
261cb0ef41Sopenharmony_ci  const global = new WebAssembly.Global(argument, 0);
271cb0ef41Sopenharmony_ci  assert_equals(global.valueOf({}), 0);
281cb0ef41Sopenharmony_ci}, "Stray argument");
29

Indexes created Thu Nov 07 10:32:03 CST 2024