2017-04-18 01:31:16 +00:00
|
|
|
// 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.
|
|
|
|
|
2021-06-01 12:46:36 +00:00
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
2017-04-18 01:31:16 +00:00
|
|
|
|
2017-10-25 14:12:49 +00:00
|
|
|
let buffer = (() => {
|
|
|
|
let builder = new WasmModuleBuilder();
|
2017-04-18 01:31:16 +00:00
|
|
|
builder.addFunction("f", kSig_i_v)
|
|
|
|
.addBody([kExprI32Const, 42])
|
|
|
|
.exportAs("f");
|
|
|
|
return builder.toBuffer();
|
|
|
|
})();
|
|
|
|
|
2017-10-25 14:12:49 +00:00
|
|
|
var module = new WebAssembly.Module(buffer);
|
|
|
|
var wrapper = [module];
|
2017-04-18 01:31:16 +00:00
|
|
|
|
2017-10-25 14:12:49 +00:00
|
|
|
try {
|
|
|
|
assertPromiseResult(
|
|
|
|
WebAssembly.instantiateStreaming(wrapper),
|
|
|
|
assertUnreachable, assertUnreachable);
|
|
|
|
} catch (e) {
|
|
|
|
assertTrue(e instanceof TypeError);
|
|
|
|
}
|
2017-06-06 04:10:53 +00:00
|
|
|
|
2017-10-25 14:12:49 +00:00
|
|
|
try {
|
|
|
|
assertPromiseResult(
|
|
|
|
WebAssembly.compileStreaming(wrapper),
|
|
|
|
assertUnreachable, assertUnreachable);
|
|
|
|
} catch (e) {
|
|
|
|
assertTrue(e instanceof TypeError);
|
|
|
|
}
|