mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
browser(webkit): respect first party url in intercepted set-cookie (soup) (#9320)
This commit is contained in:
parent
97b6a344ac
commit
ec7ae4e96b
@ -1,2 +1,2 @@
|
||||
1555
|
||||
Changed: yurys@chromium.org Mon Oct 4 22:10:59 PDT 2021
|
||||
1556
|
||||
Changed: yurys@chromium.org Tue 05 Oct 2021 12:17:40 PM PDT
|
||||
|
@ -8601,26 +8601,34 @@ index 4b9491c11543f2b60f12d36e9e6a0cbaae34a72e..e907fc00a2a426384ce1e471847911c9
|
||||
|
||||
SocketStreamHandleImpl::~SocketStreamHandleImpl()
|
||||
diff --git a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
||||
index 5b32534e2bcaf1701331e9541013b8a5c38c4d36..efee59ab00e99bc0e5d4374cc0a474461c2c1386 100644
|
||||
index 5b32534e2bcaf1701331e9541013b8a5c38c4d36..44ca33a774629841214ab3233f8a064557976e78 100644
|
||||
--- a/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
||||
+++ b/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
|
||||
@@ -408,6 +408,22 @@ void NetworkStorageSession::setCookie(const Cookie& cookie)
|
||||
@@ -408,6 +408,30 @@ void NetworkStorageSession::setCookie(const Cookie& cookie)
|
||||
soup_cookie_jar_add_cookie(cookieStorage(), cookie.toSoupCookie());
|
||||
}
|
||||
|
||||
+void NetworkStorageSession::setCookiesFromResponse(const URL&, const URL& url, const String& setCookieValue)
|
||||
+void NetworkStorageSession::setCookiesFromResponse(const URL& firstParty, const URL& url, const String& setCookieValue)
|
||||
+{
|
||||
+ auto origin = urlToSoupURI(url);
|
||||
+ if (!origin)
|
||||
+ return;
|
||||
+
|
||||
+ auto firstPartyURI = urlToSoupURI(firstParty);
|
||||
+ if (!firstPartyURI)
|
||||
+ return;
|
||||
+
|
||||
+ for (auto& cookieString : setCookieValue.split('\n')) {
|
||||
+ GUniquePtr<SoupCookie> cookie(soup_cookie_parse(cookieString.utf8().data(), origin.get()));
|
||||
+
|
||||
+ if (!cookie)
|
||||
+ continue;
|
||||
+
|
||||
+ soup_cookie_jar_add_cookie(cookieStorage(), cookie.release());
|
||||
+#if SOUP_CHECK_VERSION(2, 67, 1)
|
||||
+ soup_cookie_jar_add_cookie_full(cookieStorage(), cookie.release(), origin.get(), firstPartyURI.get());
|
||||
+#else
|
||||
+ soup_cookie_jar_add_cookie_with_first_party(cookieStorage(), firstPartyURI.get(), cookie.release());
|
||||
+#endif
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
Loading…
x
Reference in New Issue
Block a user