Browse Source

fix: run Node.js at-exit callbacks in renderer proc (#23566)

Shelley Vohr 5 years ago
parent
commit
e90a928a14
1 changed files with 4 additions and 1 deletions
  1. 4 1
      shell/renderer/atom_renderer_client.cc

+ 4 - 1
shell/renderer/atom_renderer_client.cc

@@ -174,8 +174,11 @@ void AtomRendererClient::WillReleaseScriptContext(
   // avoid memory leaks
   auto* command_line = base::CommandLine::ForCurrentProcess();
   if (command_line->HasSwitch(switches::kNodeIntegrationInSubFrames) ||
-      command_line->HasSwitch(switches::kDisableElectronSiteInstanceOverrides))
+      command_line->HasSwitch(
+          switches::kDisableElectronSiteInstanceOverrides)) {
+    node::RunAtExit(env);
     node::FreeEnvironment(env);
+  }
 
   // ElectronBindings is tracking node environments.
   electron_bindings_->EnvironmentDestroyed(env);