Add http:// prefix to browser creation URLs if necessary (issue #2427)

This commit is contained in:
Cristian Amarie 2018-06-15 20:14:47 +00:00 committed by Marshall Greenblatt
parent b25374c8e7
commit 3c3045a5cb
1 changed files with 6 additions and 0 deletions

View File

@ -268,6 +268,12 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
create_params.window_info.reset(new CefWindowInfo(windowInfo)); create_params.window_info.reset(new CefWindowInfo(windowInfo));
create_params.client = client; create_params.client = client;
create_params.url = GURL(url.ToString()); create_params.url = GURL(url.ToString());
if (!url.empty() &&
!create_params.url.is_valid() &&
!create_params.url.has_scheme()) {
std::string new_url = std::string("http://") + url.ToString();
create_params.url = GURL(new_url);
}
create_params.settings = settings; create_params.settings = settings;
create_params.request_context = request_context; create_params.request_context = request_context;