diff --git a/renderer/atom_renderer_client.cc b/renderer/atom_renderer_client.cc index f42e31087bc4..cd2074696678 100644 --- a/renderer/atom_renderer_client.cc +++ b/renderer/atom_renderer_client.cc @@ -57,9 +57,17 @@ void AtomRendererClient::DidCreateScriptContext(WebKit::WebFrame* frame, atom_bindings_->BindToFrame(frame); } -void AtomRendererClient::WillReleaseScriptContext(WebKit::WebFrame* frame, - v8::Handle, - int world_id) { +void AtomRendererClient::WillReleaseScriptContext( + WebKit::WebFrame* frame, + v8::Handle context, + int world_id) { + node::Environment* env = node::Environment::GetCurrent(context); + if (env == NULL) { + LOG(ERROR) << "Encounter a non-node context when releasing script context"; + return; + } + + env->Dispose(); } } // namespace atom