Merge pull request #6144 from electron/crash-release-renderer

Avoid calling Environment::GetCurrent for unjected contexts
This commit is contained in:
Cheng Zhao 2016-06-20 08:09:42 +00:00 committed by GitHub
commit 6bd1a2dec6

View file

@ -282,6 +282,11 @@ void AtomRendererClient::DidCreateScriptContext(
void AtomRendererClient::WillReleaseScriptContext( void AtomRendererClient::WillReleaseScriptContext(
v8::Handle<v8::Context> context, content::RenderFrame* render_frame) { v8::Handle<v8::Context> context, content::RenderFrame* render_frame) {
// Only allow node integration for the main frame, unless it is a devtools
// extension page.
if (!render_frame->IsMainFrame() && !IsDevToolsExtension(render_frame))
return;
node::Environment* env = node::Environment::GetCurrent(context); node::Environment* env = node::Environment::GetCurrent(context);
if (env) if (env)
mate::EmitEvent(env->isolate(), env->process_object(), "exit"); mate::EmitEvent(env->isolate(), env->process_object(), "exit");