summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/wasm/wasm-api-overloading.js
blob: 0ae9db5d3a31ee863bb7bc4506c4a2d29c6ef702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

load("test/mjsunit/wasm/wasm-module-builder.js");

let buffer = (() => {
  let builder = new WasmModuleBuilder();
  builder.addFunction("f", kSig_i_v)
    .addBody([kExprI32Const, 42])
    .exportAs("f");
  return builder.toBuffer();
})();

var module = new WebAssembly.Module(buffer);
var wrapper = [module];

try {
  assertPromiseResult(
    WebAssembly.instantiateStreaming(wrapper),
    assertUnreachable, assertUnreachable);
} catch (e) {
  assertTrue(e instanceof TypeError);
}

try {
  assertPromiseResult(
    WebAssembly.compileStreaming(wrapper),
    assertUnreachable, assertUnreachable);
} catch (e) {
  assertTrue(e instanceof TypeError);
}