]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix creating window in <webview>
authorCheng Zhao <zcbenz@gmail.com>
Fri, 24 Oct 2014 14:14:12 +0000 (22:14 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 24 Oct 2014 14:14:12 +0000 (22:14 +0800)
atom/browser/api/atom_api_web_contents.cc

index caddb2b3e6504967e52885017946444701299c2e..c221a28580aa4512c201facf625a786cdab99b11 100644 (file)
@@ -170,7 +170,14 @@ void WebContents::WillAttach(content::WebContents* embedder_web_contents,
 
 content::WebContents* WebContents::CreateNewGuestWindow(
     const content::WebContents::CreateParams& create_params) {
-  return nullptr;
+  auto web_contents = content::WebContents::Create(create_params);
+  // TODO Currently we just retain the web_contents on V8's heap, which will be
+  // garbage collected later, we should provide a way to let users make use of
+  // this WebContents.
+  mate::Handle<WebContents> managed = CreateFrom(
+      v8::Isolate::GetCurrent(), web_contents);
+  managed->storage_.reset(web_contents);
+  return web_contents;
 }
 
 void WebContents::DidAttach() {