content::RenderView* render_view,
AtomRendererClient* renderer_client)
: content::RenderViewObserver(render_view),
+ renderer_client_(renderer_client),
document_created_(false) {
// Initialise resource for directory listing.
net::NetModule::SetResourceProvider(NetResourceProvider);
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
- v8::Local<v8::Context> context = frame->mainWorldScriptContext();
+ v8::Local<v8::Context> context = renderer_client_->GetContext();
v8::Context::Scope context_scope(context);
// Only emit IPC event for context with node integration.
const base::string16& channel,
const base::ListValue& args);
+ AtomRendererClient* renderer_client_;
+
// Whether the document object has been created.
bool document_created_;
}
}
+v8::Local<v8::Context> AtomRendererClient::GetContext() {
+ return node_bindings_->uv_env()->context();
+}
+
void AtomRendererClient::WillReleaseScriptContext(
v8::Handle<v8::Context> context, content::RenderFrame* render_frame) {
// Only allow node integration for the main frame, unless it is a devtools