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

This commit is contained in:
Shelley Vohr 2020-04-16 18:46:09 -07:00 committed by GitHub
parent 2541d62486
commit 8b2e863a30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

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

View file

@ -85,6 +85,13 @@ void HostCleanupFinalizationGroupCallback(
env->RegisterFinalizationGroupForCleanup(group);
}
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 {
@ -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);