Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-67279

QtWebEngine prompts for location permission three times

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.10.1
    • WebEngine
    • OSX Sierra, using clang 64bit
    • 747470873e66ad619378ed9a34a94a4c275d1312

    Description

      The attached zip is the simplebrowser example from Qt 5.10.1 with very minor changes. The feature request signal is connected to a slot that always unconditionally grants whatever feature is requested. Also the initial URL is set to https://maps.google.com

      The problem can be illustrated by clicking the compass icon in the bottom right ("show my current location"). The slot attempts to grant permission as follows:

      void WebPage::handleFeaturePermissionRequested(const QUrl &securityOrigin, QWebEnginePage::Feature feature)
      {
          // hgroover: make this browser promiscuous - share location with any website
          qDebug() << "Granting request" << feature << "for" << securityOrigin;
          // This seems it should allow the request to complete
          setFeaturePermission( securityOrigin, feature, QWebEnginePage::PermissionGrantedByUser);
      }
      

      The slot is invoked as expected and the setFeaturePermission() call is completed.

      The user is presented with 3 successive prompts:

      “simplebrowser” would like to use your current location. [Don't allow] [Allow]

      After clicking allow three times, the location request goes through.

      The apparently defective behavior is why I am prompted three times?

      Desired behavior would be to handle this prompt myself and use setFeaturePermission() to communicate the results of the user interaction. However, it seems that setFeaturePermission() only allows the browser to prompt for permission. Running the unmodified simplebrowser example, clicking on current location does nothing.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            andysh Andy Shaw
            hgroover Henry Groover
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes