diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-30 13:38:45 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-05-05 12:50:08 +0200 |
commit | 45a3e4c5b6e3953a8afcfafcfc83eef23b6400aa (patch) | |
tree | 056e7e2cb003fdc10651180ef2ff9a7f63ef812c /src | |
parent | 53498cb73392a222a113ae257f24f91e6d912518 (diff) |
Document early feature reply for Notification
Make it easier to get right by normalizing the origin and test it.
Task-number: QTBUG-83476
Change-Id: Ie4562e937cbcca5a1cf24e00d340a3ac2e9e2210
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/permission_manager_qt.cpp | 7 | ||||
-rw-r--r-- | src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 16a7b25bf..2f9543769 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -112,8 +112,13 @@ PermissionManagerQt::~PermissionManagerQt() { } -void PermissionManagerQt::permissionRequestReply(const QUrl &origin, ProfileAdapter::PermissionType type, bool reply) +void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter::PermissionType type, bool reply) { + // Normalize the QUrl to GURL origin form. + const GURL gorigin = toGurl(url).GetOrigin(); + const QUrl origin = gorigin.is_empty() ? url : toQt(gorigin); + if (origin.isEmpty()) + return; QPair<QUrl, ProfileAdapter::PermissionType> key(origin, type); m_permissions[key] = reply; blink::mojom::PermissionStatus status = reply ? blink::mojom::PermissionStatus::GRANTED : blink::mojom::PermissionStatus::DENIED; diff --git a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc index 7701b9b3d..9d5c41713 100644 --- a/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc +++ b/src/webenginewidgets/doc/src/qwebenginepage_lgpl.qdoc @@ -805,9 +805,10 @@ Sets the permission for the web site identified by \a securityOrigin to use \a feature to \a policy. - \note Call this method on the featurePermissionRequested() signal, as it is - meant to serve pending feature requests only. Setting feature permissions - ahead of a request has no effect. + \note This method is primarily for calling after a featurePermissionRequested() signal has been emitted + to trigger the feature permission response. It can also be called before a request has been emitted, + but will only set a granted permission for passive checks, mainly for Notification APIs that can check + if permission has already been granted before explicitly requesting it. \sa featurePermissionRequested(), featurePermissionRequestCanceled() */ |