Skip to content

Commit

Permalink
fix: wasm codegen in script.runInNewContext
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 15, 2020
1 parent 111f915 commit 0c084be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion script/node-disabled-tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@
"parallel/test-v8-coverage",
"parallel/test-v8-flags",
"parallel/test-vm-basic",
"parallel/test-vm-codegen",
"parallel/test-vm-module-basic",
"parallel/test-vm-parse-abort-on-uncaught-exception",
"parallel/test-vm-sigint",
Expand Down
10 changes: 10 additions & 0 deletions shell/app/node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ void HostCleanupFinalizationGroupCallback(
env->RegisterFinalizationGroupForCleanup(group);
}

static bool AllowWasmCodeGenerationCallback(v8::Local<v8::Context> context,
v8::Local<v8::String>) {
v8::Local<v8::Value> wasm_code_gen = context->GetEmbedderData(
node::ContextEmbedderIndex::kAllowWasmCodeGeneration);
return wasm_code_gen->IsUndefined() || wasm_code_gen->IsTrue();
}

} // namespace

namespace electron {
Expand Down Expand Up @@ -161,6 +168,9 @@ int NodeMain(int argc, char* argv[]) {
isolate->SetHostCleanupFinalizationGroupCallback(
HostCleanupFinalizationGroupCallback);

isolate->SetAllowWasmCodeGenerationCallback(
AllowWasmCodeGenerationCallback);

gin_helper::Dictionary process(isolate, env->process_object());
#if defined(OS_WIN)
process.SetMethod("log", &ElectronBindings::Log);
Expand Down

0 comments on commit 0c084be

Please sign in to comment.