Popups must share the parent context to avoid crashes on parent browser destruction (issue #2162)

This commit is contained in:
Marshall Greenblatt
2017-05-04 17:53:27 -04:00
parent 4a193051a9
commit 5b9fb7e4ec
17 changed files with 448 additions and 390 deletions

View File

@ -2286,16 +2286,14 @@ void CefBrowserHostImpl::WebContentsCreated(
CefRefPtr<CefBrowserHostImpl> opener = GetBrowserForContents(source_contents);
DCHECK(opener.get());
// Popups must share the same BrowserContext as the parent.
CefBrowserContext* browser_context =
static_cast<CefBrowserContext*>(new_contents->GetBrowserContext());
DCHECK(browser_context);
CefRefPtr<CefRequestContext> request_context =
CefRequestContextImpl::CreateForBrowserContext(browser_context).get();
DCHECK(request_context.get());
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
settings, client, new_contents, info, opener, false, request_context,
std::move(platform_delegate));
settings, client, new_contents, info, opener, false,
browser_context->GetCefRequestContext(), std::move(platform_delegate));
}
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(