|
@@ -330,6 +330,12 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
|
|
// Whether to enable DevTools.
|
|
|
options.Get("devTools", &enable_devtools_);
|
|
|
|
|
|
+ // BrowserViews are not attached to a window initially so they should start
|
|
|
+ // off as hidden. This is also important for compositor recycling. See:
|
|
|
+ // https://github.com/electron/electron/pull/21372
|
|
|
+ bool initially_shown = type_ != Type::BROWSER_VIEW;
|
|
|
+ options.Get(options::kShow, &initially_shown);
|
|
|
+
|
|
|
// Obtain the session.
|
|
|
std::string partition;
|
|
|
mate::Handle<api::Session> session;
|
|
@@ -382,6 +388,7 @@ WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
|
|
#endif
|
|
|
} else {
|
|
|
content::WebContents::CreateParams params(session->browser_context());
|
|
|
+ params.initially_hidden = !initially_shown;
|
|
|
web_contents = content::WebContents::Create(params);
|
|
|
}
|
|
|
|