Modified: branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog (187041 => 187042)
--- branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog 2015-07-20 22:52:25 UTC (rev 187041)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/ChangeLog 2015-07-20 23:23:12 UTC (rev 187042)
@@ -1,3 +1,19 @@
+2015-07-20 Lucas Forschler <lforsch...@apple.com>
+
+ Merge r186895
+
+ 2015-07-16 Brady Eidson <beid...@apple.com>
+
+ WebKit document.cookie mis-parsing.
+ rdar://problem/21715050 and https://bugs.webkit.org/show_bug.cgi?id=146976
+
+ Reviewed by Sam Weinig.
+
+ * platform/network/cf/CookieJarCFNet.cpp:
+ (WebCore::createCookies): Use new SPI if available.
+ (WebCore::setCookiesFromDOM):
+ * platform/spi/cf/CFNetworkSPI.h:
+
2015-07-17 Andy Estes <aes...@apple.com>
Merge r186982. rdar://problem/21709404
Modified: branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (187041 => 187042)
--- branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2015-07-20 22:52:25 UTC (rev 187041)
+++ branches/safari-600.1.4.17-branch/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2015-07-20 23:23:12 UTC (rev 187042)
@@ -47,6 +47,12 @@
};
#endif
+#ifdef __cplusplus
+extern "C" CFArrayRef _CFHTTPParsedCookiesWithResponseHeaderFields(CFAllocatorRef inAllocator, CFDictionaryRef headerFields, CFURLRef inURL);
+#else
+extern CFArrayRef _CFHTTPParsedCookiesWithResponseHeaderFields(CFAllocatorRef inAllocator, CFDictionaryRef headerFields, CFURLRef inURL);
+#endif
+
namespace WebCore {
static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie");
@@ -112,6 +118,15 @@
#endif
}
+static CFArrayRef createCookies(CFDictionaryRef headerFields, CFURLRef url)
+{
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000)
+ return _CFHTTPParsedCookiesWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+#else
+ return CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault, headerFields, url);
+#endif
+}
+
void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value)
{
// <rdar://problem/5632883> CFHTTPCookieStorage stores an empty cookie, which would be sent as "Cookie: =".
@@ -130,10 +145,8 @@
(const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
- headerFieldsCF.get(), urlCF.get()));
-
- CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
+ RetainPtr<CFArrayRef> unfilteredCookies = adoptCF(createCookies(headerFieldsCF.get(), urlCF.get()));
+ CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(unfilteredCookies.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
}
String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)