]> khamidou — GitHub mirrors - electron.git/commitdiff
Assign a new SiteInstance for guest
authorCheng Zhao <zcbenz@gmail.com>
Fri, 24 Oct 2014 12:20:56 +0000 (20:20 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 24 Oct 2014 12:20:56 +0000 (20:20 +0800)
atom/browser/api/atom_api_web_contents.cc

index deef2ff1480e9ac97939564e0726d455c23b6cf0..4ddf302467ba8478582bd5feb6b204253d66a5b4 100644 (file)
@@ -15,6 +15,7 @@
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/site_instance.h"
 #include "content/public/browser/web_contents.h"
 #include "native_mate/dictionary.h"
 #include "native_mate/object_template_builder.h"
@@ -44,7 +45,11 @@ WebContents::WebContents(const mate::Dictionary& options)
       auto_size_enabled_(false) {
   options.Get("guestInstanceId", &guest_instance_id_);
 
-  content::WebContents::CreateParams params(AtomBrowserContext::Get());
+  auto browser_context = AtomBrowserContext::Get();
+  content::SiteInstance* site_instance = content::SiteInstance::CreateForURL(
+      browser_context, GURL("chrome-guest://fake-host"));
+
+  content::WebContents::CreateParams params(browser_context, site_instance);
   bool is_guest;
   if (options.Get("isGuest", &is_guest) && is_guest)
     params.guest_delegate = this;