summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-24 16:56:41 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-26 07:22:05 +0000
commitcdd438c3aa303e7c46e7e583e4366661323e4385 (patch)
tree40911de2e6b7e73d6e42496fd306b9aacb26ee18 /src/core
parent384d503d7a12c74762952e802c8cd41a60a88bc1 (diff)
Fix local->remote user navigation
Specifically allow user initiated navigation of the mainframe. Fixes: QTBUG-103778 Change-Id: I4e3d6b4fb606bd0c3cf66e090fba3c97c8c535b4 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit 2ba1f04b4589e5883a399b022b7795266c4d4646) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 0a7256c45..96cd36b3f 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -284,10 +284,23 @@ void InterceptedRequest::Restart()
// Check if non-local access is allowed
if (!allow_remote_ && remote_access_) {
- target_client_->OnComplete(network::URLLoaderCompletionStatus(net::ERR_NETWORK_ACCESS_DENIED));
- delete this;
- return;
+ bool granted_special_access = false;
+ switch (ui::PageTransition(request_.transition_type)) {
+ case ui::PAGE_TRANSITION_LINK:
+ case ui::PAGE_TRANSITION_TYPED:
+ if (blink::mojom::ResourceType(request_.resource_type) == blink::mojom::ResourceType::kMainFrame && request_.has_user_gesture)
+ granted_special_access = true; // allow normal explicit navigation
+ break;
+ default:
+ break;
+ }
+ if (!granted_special_access) {
+ target_client_->OnComplete(network::URLLoaderCompletionStatus(net::ERR_NETWORK_ACCESS_DENIED));
+ delete this;
+ return;
+ }
}
+
// Check if local access is allowed
if (!allow_local_ && local_access_) {
bool granted_special_access = false;