From efa90d944170f0a2f98c482825b9809c77e7792c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 29 Oct 2018 15:54:04 +0100 Subject: Fix thirdParty setting for first party request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some first party requests has no site_for_cookies yet, and thus returns an empty string. The logic matches that of StaticCookiePolicy. Change-Id: I10caf978dc410639cd21fc2aa01eb2bf6dc67c1f Fixes: QTBUG-71393 Reviewed-by: Jüri Valdmann --- src/core/api/qwebenginecookiestore.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp index 9a07c7c7b..fa72265dc 100644 --- a/src/core/api/qwebenginecookiestore.cpp +++ b/src/core/api/qwebenginecookiestore.cpp @@ -196,7 +196,8 @@ bool QWebEngineCookieStorePrivate::canAccessCookies(const QUrl &firstPartyUrl, c if (!filterCallback) return true; - bool thirdParty = + // Empty first-party URL indicates a first-party request (see net/base/static_cookie_policy.cc) + bool thirdParty = !firstPartyUrl.isEmpty() && !net::registry_controlled_domains::SameDomainOrHost(toGurl(url), toGurl(firstPartyUrl), net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); -- cgit v1.2.3