fix: wasm codegen in script.runInNewContext (#23146)

This commit is contained in:
Shelley Vohr
2020-04-20 12:01:30 -07:00
committed by GitHub
parent f0a34a2f91
commit 6f4412a317
2 changed files with 15 additions and 1 deletions

View File

@@ -205,7 +205,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",

View File

@@ -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)
@@ -99,6 +110,10 @@ int NodeMain(int argc, char* argv[]) {
node::BootstrapEnvironment(env);
gin_helper::Dictionary process(isolate, env->process_object());
isolate->SetAllowWasmCodeGenerationCallback(
AllowWasmCodeGenerationCallback);
#if defined(OS_WIN)
process.SetMethod("log", &ElectronBindings::Log);
#endif