|
@@ -20,7 +20,7 @@
|
|
|
#include "shell/renderer/web_worker_observer.h"
|
|
|
#include "third_party/blink/public/web/web_document.h"
|
|
|
#include "third_party/blink/public/web/web_local_frame.h"
|
|
|
-#include "third_party/electron_node/src/node_native_module.h"
|
|
|
+#include "third_party/electron_node/src/node_native_module_env.h"
|
|
|
|
|
|
namespace electron {
|
|
|
|
|
@@ -67,9 +67,9 @@ void AtomRendererClient::RunScriptsAtDocumentEnd(
|
|
|
}
|
|
|
|
|
|
void AtomRendererClient::DidCreateScriptContext(
|
|
|
- v8::Handle<v8::Context> context,
|
|
|
+ v8::Handle<v8::Context> renderer_context,
|
|
|
content::RenderFrame* render_frame) {
|
|
|
- RendererClientBase::DidCreateScriptContext(context, render_frame);
|
|
|
+ RendererClientBase::DidCreateScriptContext(renderer_context, render_frame);
|
|
|
|
|
|
// TODO(zcbenz): Do not create Node environment if node integration is not
|
|
|
// enabled.
|
|
@@ -103,6 +103,9 @@ void AtomRendererClient::DidCreateScriptContext(
|
|
|
node::tracing::TraceEventHelper::SetAgent(node::CreateAgent());
|
|
|
|
|
|
// Setup node environment for each window.
|
|
|
+ v8::Local<v8::Context> context =
|
|
|
+ node::MaybeInitializeContext(renderer_context);
|
|
|
+ DCHECK(!context.IsEmpty());
|
|
|
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
|
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
|
|
// If we have disabled the site instance overrides we should prevent loading
|
|
@@ -209,7 +212,7 @@ void AtomRendererClient::SetupMainWorldOverrides(
|
|
|
env->process_object(),
|
|
|
GetContext(render_frame->GetWebFrame(), isolate)->Global()};
|
|
|
|
|
|
- node::per_process::native_module_loader.CompileAndCall(
|
|
|
+ node::native_module::NativeModuleEnv::CompileAndCall(
|
|
|
context, "electron/js2c/isolated_bundle", &isolated_bundle_params,
|
|
|
&isolated_bundle_args, nullptr);
|
|
|
}
|
|
@@ -234,7 +237,7 @@ void AtomRendererClient::SetupExtensionWorldOverrides(
|
|
|
GetContext(render_frame->GetWebFrame(), isolate)->Global(),
|
|
|
v8::Integer::New(isolate, world_id)};
|
|
|
|
|
|
- node::per_process::native_module_loader.CompileAndCall(
|
|
|
+ node::native_module::NativeModuleEnv::CompileAndCall(
|
|
|
context, "electron/js2c/content_script_bundle", &isolated_bundle_params,
|
|
|
&isolated_bundle_args, nullptr);
|
|
|
}
|