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

This commit is contained in:
Shelley Vohr
2020-05-14 07:08:34 -07:00
committed by GitHub
parent faf2871efe
commit 42ab97f905

View File

@@ -176,8 +176,11 @@ void ElectronRendererClient::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);