summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-13 16:37:47 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-05-13 14:53:47 +0000
commit550cf262a8dfe97db2acb5034ffc966cefdd50c0 (patch)
tree0ab9d1330dce10da68d39800d1b1655aaa77092a
parentaa85bb793f42116f451b36b87aa975272fdc0ad7 (diff)
Add missing new certificate error type
Adds the new certificate error CertificateValidityTooLong and adds asserts to ensure this list is kept up to date in future Chromium updates. Change-Id: I6066296c0a09cabcca446f1d0b3e3d458b3f158e Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
-rw-r--r--src/core/certificate_error_controller.cpp19
-rw-r--r--src/core/certificate_error_controller.h3
-rw-r--r--src/webengine/api/qquickwebenginecertificateerror.cpp1
-rw-r--r--src/webengine/api/qquickwebenginecertificateerror_p.h1
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.cpp1
-rw-r--r--src/webenginewidgets/api/qwebenginecertificateerror.h1
6 files changed, 26 insertions, 0 deletions
diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp
index 2875193d1..65bba733a 100644
--- a/src/core/certificate_error_controller.cpp
+++ b/src/core/certificate_error_controller.cpp
@@ -40,6 +40,7 @@
#include "certificate_error_controller.h"
#include "certificate_error_controller_p.h"
+#include <net/base/net_errors.h>
#include <net/cert/x509_certificate.h>
#include <net/ssl/ssl_info.h>
#include <ui/base/l10n/l10n_util.h>
@@ -51,6 +52,22 @@ QT_BEGIN_NAMESPACE
using namespace QtWebEngineCore;
+ASSERT_ENUMS_MATCH(CertificateErrorController::SslPinnedKeyNotInCertificateChain, net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateCommonNameInvalid, net::ERR_CERT_BEGIN)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateCommonNameInvalid, net::ERR_CERT_COMMON_NAME_INVALID)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateDateInvalid, net::ERR_CERT_DATE_INVALID)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateAuthorityInvalid, net::ERR_CERT_AUTHORITY_INVALID)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateContainsErrors, net::ERR_CERT_CONTAINS_ERRORS)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateUnableToCheckRevocation, net::ERR_CERT_UNABLE_TO_CHECK_REVOCATION)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateRevoked, net::ERR_CERT_REVOKED)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateInvalid, net::ERR_CERT_INVALID)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateWeakSignatureAlgorithm, net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateNonUniqueName, net::ERR_CERT_NON_UNIQUE_NAME)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateWeakKey, net::ERR_CERT_WEAK_KEY)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateNameConstraintViolation, net::ERR_CERT_NAME_CONSTRAINT_VIOLATION)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateValidityTooLong, net::ERR_CERT_VALIDITY_TOO_LONG)
+ASSERT_ENUMS_MATCH(CertificateErrorController::CertificateErrorEnd, net::ERR_CERT_END)
+
void CertificateErrorControllerPrivate::accept(bool accepted)
{
callback.Run(accepted);
@@ -155,6 +172,8 @@ QString CertificateErrorController::errorString() const
return getQStringForMessageId(IDS_CERT_ERROR_WEAK_KEY_DESCRIPTION);
case CertificateNameConstraintViolation:
return getQStringForMessageId(IDS_CERT_ERROR_NAME_CONSTRAINT_VIOLATION_DESCRIPTION);
+ case CertificateValidityTooLong:
+ return getQStringForMessageId(IDS_CERT_ERROR_VALIDITY_TOO_LONG_DESCRIPTION);
case CertificateUnableToCheckRevocation: // Deprecated in Chromium.
default:
break;
diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h
index 481d65ac8..27f18946f 100644
--- a/src/core/certificate_error_controller.h
+++ b/src/core/certificate_error_controller.h
@@ -70,6 +70,9 @@ public:
CertificateNonUniqueName = -210,
CertificateWeakKey = -211,
CertificateNameConstraintViolation = -212,
+ CertificateValidityTooLong = -213,
+
+ CertificateErrorEnd = -214 // not an error, just an enum boundary
};
CertificateError error() const;
diff --git a/src/webengine/api/qquickwebenginecertificateerror.cpp b/src/webengine/api/qquickwebenginecertificateerror.cpp
index 561d1daf4..cf8b8bbbc 100644
--- a/src/webengine/api/qquickwebenginecertificateerror.cpp
+++ b/src/webengine/api/qquickwebenginecertificateerror.cpp
@@ -177,6 +177,7 @@ QUrl QQuickWebEngineCertificateError::url() const
\value CertificateNonUniqueName The host name specified in the certificate is not unique.
\value CertificateWeakKey The certificate contains a weak key.
\value CertificateNameConstraintViolation The certificate claimed DNS names that are in violation of name constraints.
+ \value CertificateValidityTooLong The certificate has a validity period that is too long
*/
QQuickWebEngineCertificateError::Error QQuickWebEngineCertificateError::error() const
{
diff --git a/src/webengine/api/qquickwebenginecertificateerror_p.h b/src/webengine/api/qquickwebenginecertificateerror_p.h
index e19331b06..d04dc2c62 100644
--- a/src/webengine/api/qquickwebenginecertificateerror_p.h
+++ b/src/webengine/api/qquickwebenginecertificateerror_p.h
@@ -83,6 +83,7 @@ public:
CertificateNonUniqueName = -210,
CertificateWeakKey = -211,
CertificateNameConstraintViolation = -212,
+ CertificateValidityTooLong = -213,
};
Q_ENUM(Error)
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
index 7d0c79de1..ebe3cdbec 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp
@@ -99,6 +99,7 @@ QWebEngineCertificateError::~QWebEngineCertificateError()
\value CertificateNonUniqueName The host name specified in the certificate is not unique.
\value CertificateWeakKey The certificate contains a weak key.
\value CertificateNameConstraintViolation The certificate claimed DNS names that are in violation of name constraints.
+ \value CertificateValidityTooLong The certificate has a validity period that is too long. (Added in Qt 5.7)
*/
/*!
diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/webenginewidgets/api/qwebenginecertificateerror.h
index 34c95d010..7cb6341bc 100644
--- a/src/webenginewidgets/api/qwebenginecertificateerror.h
+++ b/src/webenginewidgets/api/qwebenginecertificateerror.h
@@ -69,6 +69,7 @@ public:
CertificateNonUniqueName = -210,
CertificateWeakKey = -211,
CertificateNameConstraintViolation = -212,
+ CertificateValidityTooLong = -213,
};
Error error() const;