Skip to content

Commit

Permalink
fix: wasm codegen in script.runInNewContext (#23147)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 20, 2020
1 parent 941c72f commit 25f5d76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion script/node-disabled-tests.json
Expand Up @@ -166,7 +166,6 @@
"parallel/test-v8-flags",
"parallel/test-v8-coverage",
"parallel/test-vm-basic",
"parallel/test-vm-codegen",
"parallel/test-vm-parse-abort-on-uncaught-exception",
"parallel/test-vm-syntax-error-message",
"parallel/test-warn-sigprof",
Expand Down
15 changes: 15 additions & 0 deletions shell/app/node_main.cc
Expand Up @@ -29,6 +29,17 @@
#include "shell/common/crash_reporter/crash_reporter_win.h"
#endif

namespace {

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 {

#if !defined(OS_LINUX)
Expand Down Expand Up @@ -93,6 +104,10 @@ int NodeMain(int argc, char* argv[]) {
node::BootstrapEnvironment(env);

gin_helper::Dictionary process(gin_env.isolate(), env->process_object());

gin_env.isolate()->SetAllowWasmCodeGenerationCallback(
AllowWasmCodeGenerationCallback);

#if defined(OS_WIN)
process.SetMethod("log", &ElectronBindings::Log);
#endif
Expand Down

0 comments on commit 25f5d76

Please sign in to comment.