diff options
author | Paulo Pinheiro <paulovap.os@gmail.com> | 2015-02-25 22:00:57 -0300 |
---|---|---|
committer | Paulo Pinheiro <paulovap.os@gmail.com> | 2015-03-04 20:14:03 +0000 |
commit | 378fbbcbc9c65d1462ea6994f1f680412531a043 (patch) | |
tree | 05aa071b3ea4e4edf47df676e821697288873079 /examples/webengine | |
parent | 5b1f762887b2332cea0d71f1f57b29f710c4cb15 (diff) |
Quick: Fix handling of multiple certificate errors per request
This patch enables Quick API to handle multiple certificate errors per
requests and update the example projects. Chromium 40 branch raise an
certificate error for every resource loaded in a request (.js, .css, .html)
instead of only one (previous behavior), so requests with more than one
certificate error were automatically rejected.
Change-Id: Ibaa3027cd6e7f22b5dc51dcd52f76ccf5ea162d3
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
Diffstat (limited to 'examples/webengine')
-rw-r--r-- | examples/webengine/quicknanobrowser/BrowserWindow.qml | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/examples/webengine/quicknanobrowser/BrowserWindow.qml b/examples/webengine/quicknanobrowser/BrowserWindow.qml index 3465e0da6..f451c8c07 100644 --- a/examples/webengine/quicknanobrowser/BrowserWindow.qml +++ b/examples/webengine/quicknanobrowser/BrowserWindow.qml @@ -290,10 +290,8 @@ ApplicationWindow { } onCertificateError: { - sslDialog.certError = error - sslDialog.text = "Certificate Error: " + error.description - sslDialog.visible = true error.defer() + sslDialog.enqueue(error) } onNewViewRequested: { @@ -316,14 +314,33 @@ ApplicationWindow { MessageDialog { id: sslDialog - property var certError - - standardButtons: StandardButton.Cancel | StandardButton.Ok - visible: false - title: "Do you want to accept this certificate?" + property var certErrors: [] + icon: StandardIcon.Warning + standardButtons: StandardButton.No | StandardButton.Yes + title: "Server's certificate not trusted" + text: "Do you wish to continue?" + detailedText: "If you wish so, you may continue with an unverified certificate. " + + "Accepting an unverified certificate means " + + "you may not be connected with the host you tried to connect to.\n" + + "Do you wish to override the security check and continue?" + onYes: { + certErrors.shift().ignoreCertificateError() + presentError() + } + onNo: reject() + onRejected: reject() - onAccepted: certError.ignoreCertificateError() - onRejected: certError.rejectCertificate() + function reject(){ + certErrors.shift().rejectCertificate() + presentError() + } + function enqueue(error){ + certErrors.push(error) + presentError() + } + function presentError(){ + visible = certErrors.length > 0 + } } DownloadView { id: downloadView |