Skip to content

Commit

Permalink
Fix ESM loader registration in non-browser procs
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Sep 14, 2020
1 parent b598570 commit 79a00ae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions shell/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,10 @@ node::Environment* NodeBindings::CreateEnvironment(
uint64_t flags = node::EnvironmentFlags::kDefaultFlags |
node::EnvironmentFlags::kNoInitializeInspector;
if (browser_env_ != BrowserEnvironment::BROWSER) {
// Only one ESM loader can be registered per isolate -
// in renderer processes this should be blink. We need to tell Node.js
// not to register its handler (overriding blinks) in non-browser processes.
flags |= node::EnvironmentFlags::kNoRegisterESMLoader;
v8::TryCatch try_catch(context->GetIsolate());
env = node::CreateEnvironment(isolate_data_, context, args, exec_args,
(node::EnvironmentFlags::Flags)flags);
Expand Down

0 comments on commit 79a00ae

Please sign in to comment.