Fix a DCHECK failure in WebsiteSettings::Init()

Replace DCHECK with conditions and set the connection status as
unencrypted, if the security_style is unknown / HTTPS without a
certificate / not HTTPS.

BUG=344891

Review URL: https://codereview.chromium.org/172173004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269560 0039d316-1c4b-4281-b951-d872f2087c98
parent 2abb8d6d
......@@ -435,13 +435,18 @@ void WebsiteSettings::Init(Profile* profile,
// weakly encrypted connections.
site_connection_status_ = SITE_CONNECTION_STATUS_UNKNOWN;
if (!ssl.cert_id) {
// Not HTTPS.
DCHECK_EQ(ssl.security_style, content::SECURITY_STYLE_UNAUTHENTICATED);
if (ssl.security_style == content::SECURITY_STYLE_UNAUTHENTICATED)
site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED;
else
site_connection_status_ = SITE_CONNECTION_STATUS_ENCRYPTED_ERROR;
if (ssl.security_style == content::SECURITY_STYLE_UNKNOWN) {
// Page is still loading, so SSL status is not yet available. Say nothing.
DCHECK_EQ(ssl.security_bits, -1);
site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED;
site_connection_details_.assign(l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
subject_name));
} else if (ssl.security_style == content::SECURITY_STYLE_UNAUTHENTICATED) {
// HTTPS without a certificate, or not HTTPS.
DCHECK(!ssl.cert_id);
site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED;
site_connection_details_.assign(l10n_util::GetStringFUTF16(
IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment