Skip to content

Commit 95e0b7d

Browse files
committed
Force close the new-instance window
1 parent b875d09 commit 95e0b7d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/api/dispatcher_host.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,18 @@ void DispatcherHost::OnCreateShell(const std::string& url,
256256
WebContents* web_contents = content::WebContentsImpl::CreateWithOpener(
257257
create_params,
258258
static_cast<content::WebContentsImpl*>(base_web_contents));
259-
content::Shell::Create(base_web_contents,
260-
GURL(url),
261-
new_manifest.get(),
262-
web_contents);
259+
content::Shell* new_shell =
260+
content::Shell::Create(base_web_contents,
261+
GURL(url),
262+
new_manifest.get(),
263+
web_contents);
263264

264-
if (new_renderer)
265+
if (new_renderer) {
265266
browser_context->set_pinning_renderer(true);
267+
// since the new-instance shell is always bound
268+
// there would be 'Close' event cannot reach dest
269+
new_shell->set_force_close(true);
270+
}
266271

267272
*routing_id = web_contents->GetRoutingID();
268273

0 commit comments

Comments
 (0)