Bug 76793 - [Qt] Implement SSL error handling QML API.
Summary: [Qt] Implement SSL error handling QML API.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexander Færøy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-21 16:49 PST by Alexander Færøy
Modified: 2019-05-02 16:23 PDT (History)
5 users (show)

See Also:


Attachments
Patch (17.48 KB, patch)
2012-01-21 16:52 PST, Alexander Færøy
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Færøy 2012-01-21 16:49:22 PST
We need a way of handling insecure/invalid certificates instead of just dropping the connection.
Comment 1 Alexander Færøy 2012-01-21 16:52:52 PST
Created attachment 123462 [details]
Patch
Comment 2 Simon Hausmann 2012-01-23 04:26:57 PST
Comment on attachment 123462 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=123462&action=review

> Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp:500
> +bool QQuickWebViewPrivate::handleCertificateVerificationRequest(const QString& hostname)
> +{
> +    if (!certificateVerificationDialog)
> +        return false;
> +
> +    Q_Q(QQuickWebView);
> +    QtDialogRunner dialogRunner;
> +    if (!dialogRunner.initForCertificateVerification(certificateVerificationDialog, q, hostname))
> +        return false;
> +
> +    setViewInAttachedProperties(dialogRunner.dialog());
> +
> +    disableMouseEvents();
> +    dialogRunner.exec();
> +    enableMouseEvents();
> +
> +    return dialogRunner.wasAccepted();
> +}

Just a thought, but is this boiler-plate code something that can be centralized, either via a template or perhaps a macro?
Comment 3 WebKit Review Bot 2012-01-23 17:54:52 PST
Comment on attachment 123462 [details]
Patch

Clearing flags on attachment: 123462

Committed r105670: <http://trac.webkit.org/changeset/105670>
Comment 4 WebKit Review Bot 2012-01-23 17:54:57 PST
All reviewed patches have been landed.  Closing bug.
Comment 5 Sravan 2012-08-07 12:30:05 PDT
HI Alex,

Is there a test(.qml) implemented some where that tests this API?( I was expecting it to be in WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml, but its not there ).

I am trying to use this API, in a .qml file but i don't see my qml changes on browser. I have built Qt5 webkit2 almost a week ago and i think that version is good enough to use your changes.

I am just trying to use this API in following ways in a main.qml as

import QtQuick 2.0
import QtWebKit 3.0
import QtWebKit.experimental 1.0

Rectangle {
id: root
.
.
.
.
.
.

                                                             experimental.certificateVerificationDialog: CertificateVerificationDialog{ }
.
.
.
.
.

}

and my CertificateVerificationDialog.qml is as follows


  import QtQuick 2.0

  Rectangle {
    id: cvdPage
    width:600; height:400
    color: "Black"

    Text {
      id: message
      x: 10; y: 10
      wrapMode : Text.WordWrap
      text: "Certificate Verification Failed, what do u want to do?"
      color: "white"
      font.bold: true; font.pixelSize: 18;
    }

    Rectangle {
      id: backButton
      width: cvdPage.width/3 ; height: cvdPage.height/5
      color: "Green"
      anchors.top: message.bottom
      x: 10;
      Text {
          id: backButtonText
          anchors.verticalCenter : parent.verticalCenter
          anchors.horizontalCenter : parent.horizontalCenter
          text: "Back to Safety"; color: "white"
          font.bold: true; font.pixelSize: 16;
      }

      MouseArea {
          id: backButtonMouseArea
          anchors.fill: parent
          onClicked: console.log(backButtonText.text + " clicked" )
      }
    }
    Rectangle {
      id: proceedButton
      width: cvdPage.width/3 ; height: cvdPage.height/5
      color: "Red"
      anchors.top: message.bottom
      anchors.left: backButton.right
      anchors.leftMargin: 15

      Text {
          id: proceedButtonText
          anchors.verticalCenter : parent.verticalCenter
          anchors.horizontalCenter : parent.horizontalCenter
          text: "Proceed anyway"; color: "white"
          font.bold: true; font.pixelSize: 16;
      }

      MouseArea {
            id: backButtonMouseArea
          anchors.fill: parent
          onClicked: console.log(backButtonText.text + " clicked" )
      }
    }
    Rectangle {
      id: proceedButton
      width: cvdPage.width/3 ; height: cvdPage.height/5
      color: "Red"
      anchors.top: message.bottom
      anchors.left: backButton.right
      anchors.leftMargin: 15

      Text {
          id: proceedButtonText
          anchors.verticalCenter : parent.verticalCenter
          anchors.horizontalCenter : parent.horizontalCenter
          text: "Proceed anyway"; color: "white"
          font.bold: true; font.pixelSize: 16;
      }

      MouseArea {
          id: proceedButtonMouseArea
          anchors.fill: parent
          onClicked: console.log(proceedButtonText.text + " clicked" )
      }
    }
  }

P.S: Please neglect the onClicked handlers, i just have to implement webView.goBack and webView.load functions once i see basic connection up and running.

Please let me know if i am missing something in order to make use of certificateVerificationDialog API that you have implemented for QML.
Comment 6 Sravan 2012-08-08 16:49:49 PDT
Hi Alex,

Can you please confirm if this API is working on Qt5 WebKit2?.