xref: /third_party/node/test/fixtures/wpt/wasm/webapi/invalid-args.any.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/fixtures/wpt/wasm/webapi/
11cb0ef41Sopenharmony_ci// META: global=window,worker
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst invalidArguments = [
41cb0ef41Sopenharmony_ci  [undefined],
51cb0ef41Sopenharmony_ci  [null],
61cb0ef41Sopenharmony_ci  [true],
71cb0ef41Sopenharmony_ci  ["test"],
81cb0ef41Sopenharmony_ci  [Symbol()],
91cb0ef41Sopenharmony_ci  [0],
101cb0ef41Sopenharmony_ci  [0.1],
111cb0ef41Sopenharmony_ci  [NaN],
121cb0ef41Sopenharmony_ci  [{}, "Empty object"],
131cb0ef41Sopenharmony_ci  [Response, "Response interface object"],
141cb0ef41Sopenharmony_ci  [Response.prototype, "Response interface prototype object"],
151cb0ef41Sopenharmony_ci];
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cifor (const method of ["compileStreaming", "instantiateStreaming"]) {
181cb0ef41Sopenharmony_ci  for (const [argument, name = format_value(argument)] of invalidArguments) {
191cb0ef41Sopenharmony_ci    promise_test(t => {
201cb0ef41Sopenharmony_ci      return promise_rejects_js(t, TypeError, WebAssembly[method](argument));
211cb0ef41Sopenharmony_ci    }, `${method}: ${name}`);
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci    promise_test(t => {
241cb0ef41Sopenharmony_ci      const promise = Promise.resolve(argument);
251cb0ef41Sopenharmony_ci      return promise_rejects_js(t, TypeError, WebAssembly[method](argument));
261cb0ef41Sopenharmony_ci    }, `${method}: ${name} in a promise`);
271cb0ef41Sopenharmony_ci  }
281cb0ef41Sopenharmony_ci}
29

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