Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
[AOT] Make sure AOT can handle input bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
hydai authored and dm4 committed Oct 14, 2020
1 parent 4dacbaf commit ec2ec41
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssvm",
"version": "0.5.0",
"version": "0.5.1",
"description": "Second State WebAssembly VM for Node.js Addon",
"keywords": [
"wasm",
Expand Down
11 changes: 9 additions & 2 deletions ssvmaddon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,17 @@ void SSVMAddon::EnableWasmBindgen(const Napi::CallbackInfo &Info) {
Napi::Env Env = Info.Env();
Napi::HandleScope Scope(Env);

if ((IMode == InputMode::FilePath && !(VM->loadWasm(InputPath)))
|| (IMode == InputMode::WasmBytecode && !(VM->loadWasm(InputBytecode)))) {
if (IMode == InputMode::FilePath && !(VM->loadWasm(InputPath))) {
napi_throw_error(Info.Env(), "Error", "Wasm bytecode/file cannot be loaded correctly.");
return;
} else if (IMode == InputMode::WasmBytecode) {
if (EnableAOT && !(VM->loadWasm(InputPath))) {
napi_throw_error(Info.Env(), "Error", "Wasm bytecode/file cannot be loaded correctly.");
return;
} else if (!EnableAOT && !(VM->loadWasm(InputBytecode))) {
napi_throw_error(Info.Env(), "Error", "Wasm bytecode/file cannot be loaded correctly.");
return;
}
}

if (!(VM->validate())) {
Expand Down

0 comments on commit ec2ec41

Please sign in to comment.