fix: only focus a webContents if the window was not initially hidden (#25292)
This commit is contained in:
parent
d305fe7d30
commit
a6b9f9d8e5
4 changed files with 17 additions and 6 deletions
|
@ -474,8 +474,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
// 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);
|
||||
initially_shown_ = type_ != Type::BROWSER_VIEW;
|
||||
options.Get(options::kShow, &initially_shown_);
|
||||
|
||||
// Obtain the session.
|
||||
std::string partition;
|
||||
|
@ -531,7 +531,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|||
#endif
|
||||
} else {
|
||||
content::WebContents::CreateParams params(session->browser_context());
|
||||
params.initially_hidden = !initially_shown;
|
||||
params.initially_hidden = !initially_shown_;
|
||||
web_contents = content::WebContents::Create(params);
|
||||
}
|
||||
|
||||
|
@ -2732,6 +2732,10 @@ v8::Local<v8::Value> WebContents::Debugger(v8::Isolate* isolate) {
|
|||
return v8::Local<v8::Value>::New(isolate, debugger_);
|
||||
}
|
||||
|
||||
bool WebContents::WasInitiallyShown() {
|
||||
return initially_shown_;
|
||||
}
|
||||
|
||||
void WebContents::GrantOriginAccess(const GURL& url) {
|
||||
content::ChildProcessSecurityPolicy::GetInstance()->GrantCommitOrigin(
|
||||
web_contents()->GetMainFrame()->GetProcess()->GetID(),
|
||||
|
@ -2925,6 +2929,7 @@ v8::Local<v8::ObjectTemplate> WebContents::FillObjectTemplate(
|
|||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||
.SetProperty("devToolsWebContents", &WebContents::DevToolsWebContents)
|
||||
.SetProperty("debugger", &WebContents::Debugger)
|
||||
.SetProperty("_initiallyShown", &WebContents::WasInitiallyShown)
|
||||
.Build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue