mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
chrome: Enforce matching context for new user and incognito profiles
Selecting a new user or incognito profile via Chrome UI may result in the creation of a new Profile object. If that occurs, we should find or create a matching CefBrowserContext and CefRequestContext instead of reusing an existing mismatched context (e.g. using the original context for an incognito window would be a mismatch). If a new CefRequestContext will be created the client can now implement CefBrowserProcessHandler::GetDefaultRequestContextHandler() to provide the handler for that context. To test with a new user profile: 1. Click "Profile" icon, select "Add". Now you have 2+ profiles. 2. Click "Profile" icon, select the other user name to create a new window using the other user profile. 3. The new window should launch successfully. To test with a new incognito profile: 1. Select "New Incognito window" from the 3-dot menu. 2. The new window should launch successfully. To test DevTools window creation for the new profile: 1. Right-click in the new window, select Inspect. 2. The DevTools window should launch successfully.
This commit is contained in:
@ -601,6 +601,10 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
static_cast<CefBrowserPlatformDelegateChrome*>(platform_delegate_.get())
|
||||
->set_chrome_browser(browser);
|
||||
if (browser_) {
|
||||
// We expect the Browser and CefRequestContext to have the same Profile.
|
||||
CHECK_EQ(browser_->profile(),
|
||||
request_context()->GetBrowserContext()->AsProfile());
|
||||
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
} else {
|
||||
host_window_handle_ = kNullWindowHandle;
|
||||
|
Reference in New Issue
Block a user