diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2020-07-03 13:40:28 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2020-07-03 19:02:56 +0000 |
commit | f41dbaad0f0b554b3168df5456e57c3016bd5e43 (patch) | |
tree | 04e2316fec2581f216c0028f288d5c6db8651235 /src | |
parent | 7b5cb517da57f76437872a891c07fffd1779b6a4 (diff) |
Reject permission request with invalid origin
At least Push API is supposed to be disabled in incognito mode, which
results in permission request with empty origin.
Fixes: QTBUG-85116
Change-Id: Ie587013d135bf92a84779e6da87e12374f99bfdd
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/permission_manager_qt.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 862a1c262..ece74b123 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -200,6 +200,11 @@ int PermissionManagerQt::RequestPermission(content::PermissionType permission, bool /*user_gesture*/, base::OnceCallback<void(blink::mojom::PermissionStatus)> callback) { + if (requesting_origin.is_empty()) { + std::move(callback).Run(blink::mojom::PermissionStatus::DENIED); + return content::PermissionController::kNoPendingOperation; + } + WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt *>( content::WebContents::FromRenderFrameHost(frameHost)->GetDelegate()); Q_ASSERT(contentsDelegate); @@ -231,6 +236,11 @@ int PermissionManagerQt::RequestPermissions(const std::vector<content::Permissio bool /*user_gesture*/, base::OnceCallback<void(const std::vector<blink::mojom::PermissionStatus>&)> callback) { + if (requesting_origin.is_empty()) { + std::move(callback).Run(std::vector<blink::mojom::PermissionStatus>(permissions.size(), blink::mojom::PermissionStatus::DENIED)); + return content::PermissionController::kNoPendingOperation; + } + WebContentsDelegateQt *contentsDelegate = static_cast<WebContentsDelegateQt *>( content::WebContents::FromRenderFrameHost(frameHost)->GetDelegate()); Q_ASSERT(contentsDelegate); |