diff --git a/cef3/libcef/browser/browser_main.cc b/cef3/libcef/browser/browser_main.cc index 78202c1b6..95a82f3e7 100644 --- a/cef3/libcef/browser/browser_main.cc +++ b/cef3/libcef/browser/browser_main.cc @@ -93,16 +93,19 @@ int CefBrowserMainParts::PreCreateThreads() { void CefBrowserMainParts::PreMainMessageLoopRun() { browser_context_.reset(new CefBrowserContext()); - // Initialize the request context getter. - _Context->set_request_context(browser_context_->GetRequestContext()); - - // Initialize proxy configuration service. + // Initialize the proxy configuration service. This needs to occur before + // CefURLRequestContextGetter::GetURLRequestContext() is called for the + // first time. ChromeProxyConfigService* chrome_proxy_config_service = ProxyServiceFactory::CreateProxyConfigService(); proxy_config_service_.reset(chrome_proxy_config_service); pref_proxy_config_tracker_->SetChromeProxyConfigService( chrome_proxy_config_service); + // Initialize the request context getter. This indirectly triggers a call + // to CefURLRequestContextGetter::GetURLRequestContext() on the IO thread. + _Context->set_request_context(browser_context_->GetRequestContext()); + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { std::string port_str =