Index: content/renderer/dom_automation_controller.cc |
diff --git a/content/renderer/dom_automation_controller.cc b/content/renderer/dom_automation_controller.cc |
index da6907202083d8144151b72d7f728b90485613ce..2443022910b0196f38282ba2537d5483512f64b6 100644 |
--- a/content/renderer/dom_automation_controller.cc |
+++ b/content/renderer/dom_automation_controller.cc |
@@ -58,6 +58,29 @@ gin::ObjectTemplateBuilder DomAutomationController::GetObjectTemplateBuilder( |
void DomAutomationController::OnDestruct() {} |
+void DomAutomationController::DidCreateScriptContext( |
+ v8::Local<v8::Context> context, |
+ int extension_group, |
+ int world_id) { |
+ // Add the domAutomationController to isolated worlds as well. |
+ v8::Isolate* isolate = blink::mainThreadIsolate(); |
+ v8::HandleScope handle_scope(isolate); |
+ if (context.IsEmpty()) |
+ return; |
+ |
+ v8::Context::Scope context_scope(context); |
+ |
+ // Resuse this object instead of creating others. |
+ gin::Handle<DomAutomationController> controller = |
+ gin::CreateHandle(isolate, this); |
+ if (controller.IsEmpty()) |
+ return; |
+ |
+ v8::Local<v8::Object> global = context->Global(); |
+ global->Set(gin::StringToV8(isolate, "domAutomationController"), |
+ controller.ToV8()); |
+} |
+ |
bool DomAutomationController::SendMsg(const gin::Arguments& args) { |
if (!render_frame()) |
return false; |