Changeset 199167 in webkit
- Timestamp:
- Apr 7, 2016 12:00:53 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r199164 r199167 1 2016-04-07 Brian Burg <bburg@apple.com> 2 3 CookieJar should support adding synthetic cookies for developer tools 4 https://bugs.webkit.org/show_bug.cgi?id=156091 5 <rdar://problem/25581340> 6 7 Reviewed by Timothy Hatcher. 8 9 This patch adds an API that can set an arbitrary cookie in cookie storage 10 in order to support developer tools and automated testing. It delegates storing 11 the cookie to a platform implementation. 12 13 No new tests because the code isn't used by any clients yet. 14 15 * loader/CookieJar.cpp: 16 (WebCore::addCookie): Added. 17 * loader/CookieJar.h: 18 19 * platform/Cookie.h: 20 Remove an outdated comment. This struct is used in many places. 21 22 * platform/CookiesStrategy.h: Add new method. 23 * platform/network/PlatformCookieJar.h: Add new method. 24 * platform/network/cf/CookieJarCFNet.cpp: 25 (WebCore::addCookie): Add a stub. 26 * platform/network/curl/CookieJarCurl.cpp: 27 (WebCore::addCookie): Add a stub. 28 * platform/network/mac/CookieJarMac.mm: 29 (WebCore::addCookie): Add an implementation that turns the WebCore::Cookie into 30 an NSHTTPCookie and converts it again to CFHTTPCookie if necessary. 31 32 * platform/network/soup/CookieJarSoup.cpp: 33 (WebCore::addCookie): Add a stub. 34 35 * platform/spi/cf/CFNetworkSPI.h: 36 Add -[NSHTTPCookie _CFHTTPCookie] SPI. 37 1 38 2016-04-07 Commit Queue <commit-queue@webkit.org> 2 39 -
trunk/Source/WebCore/loader/CookieJar.cpp
r198632 r199167 1 1 /* 2 * Copyright (C) 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 85 85 } 86 86 87 void addCookie(const Document* document, const URL& url, const Cookie& cookie) 88 { 89 platformStrategies()->cookiesStrategy()->addCookie(storageSession(document), url, cookie); 87 90 } 91 92 } -
trunk/Source/WebCore/loader/CookieJar.h
r172814 r199167 1 1 /* 2 * Copyright (C) 2003, 2006, 2008, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2008, 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 WEBCORE_EXPORT bool getRawCookies(const Document*, const URL&, Vector<Cookie>&); 49 49 WEBCORE_EXPORT void deleteCookie(const Document*, const URL&, const String& cookieName); 50 WEBCORE_EXPORT void addCookie(const Document*, const URL&, const Cookie&); 50 51 51 52 } -
trunk/Source/WebCore/platform/Cookie.h
r181709 r199167 31 31 32 32 namespace WebCore { 33 34 // This struct is currently only used to provide more cookies information35 // to the Web Inspector.36 33 37 34 struct Cookie { -
trunk/Source/WebCore/platform/CookiesStrategy.h
r156550 r199167 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 46 46 virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&) = 0; 47 47 virtual void deleteCookie(const NetworkStorageSession&, const URL&, const String& cookieName) = 0; 48 virtual void addCookie(const NetworkStorageSession&, const URL&, const Cookie&) = 0; 48 49 49 50 protected: -
trunk/Source/WebCore/platform/network/PlatformCookieJar.h
r187375 r199167 1 1 /* 2 * Copyright (C) 2003, 2006, 2008, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2006, 2008, 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 47 47 WEBCORE_EXPORT bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&); 48 48 WEBCORE_EXPORT void deleteCookie(const NetworkStorageSession&, const URL&, const String&); 49 WEBCORE_EXPORT void addCookie(const NetworkStorageSession&, const URL&, const Cookie&); 49 50 WEBCORE_EXPORT void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames); 50 51 WEBCORE_EXPORT void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames); -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r194318 r199167 1 1 /* 2 * Copyright (C) 2006, 2007, 2008, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008, 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 33 33 #include "URL.h" 34 34 #include "NetworkStorageSession.h" 35 #include "NotImplemented.h" 35 36 #include "SoftLinking.h" 36 37 #include <CFNetwork/CFHTTPCookiesPriv.h> … … 217 218 } 218 219 220 void addCookie(const NetworkStorageSession&, const URL&, const Cookie&) 221 { 222 // FIXME: implement this command. <https://webkit.org/b/156298> 223 notImplemented(); 224 } 225 219 226 void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames) 220 227 { -
trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp
r196223 r199167 21 21 22 22 #include "Cookie.h" 23 #include "NotImplemented.h" 23 24 #include "URL.h" 24 25 #include "ResourceHandleManager.h" … … 326 327 } 327 328 329 void addCookie(const NetworkStorageSession&, const URL&, const Cookie&) 330 { 331 // FIXME: implement this command. <https://webkit.org/b/156296> 332 notImplemented(); 333 } 334 328 335 void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames) 329 336 { -
trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm
r197518 r199167 32 32 #import "WebCoreSystemInterface.h" 33 33 34 namespace WebCore { 35 static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession&); 36 } 37 34 38 #if !USE(CFNETWORK) 35 39 … … 243 247 } 244 248 249 void addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie) 250 { 251 BEGIN_BLOCK_OBJC_EXCEPTIONS; 252 253 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage(); 254 255 // FIXME: existing APIs do not provide a way to set httpOnly without parsing headers from scratch. 256 257 NSURL *originURL = url; 258 NSHTTPCookie *httpCookie = [NSHTTPCookie cookieWithProperties:@{ 259 NSHTTPCookieName: cookie.name, 260 NSHTTPCookieValue: cookie.value, 261 NSHTTPCookieDomain: cookie.domain, 262 NSHTTPCookiePath: cookie.path, 263 NSHTTPCookieOriginURL: originURL, 264 NSHTTPCookieSecure: @(cookie.secure), 265 NSHTTPCookieDiscard: @(cookie.session), 266 NSHTTPCookieExpires: [NSDate dateWithTimeIntervalSince1970:cookie.expires / 1000.0], 267 }]; 268 269 #if !USE(CFNETWORK) 270 if (!cookieStorage) { 271 [WebCore::cookieStorage(session) setCookie:httpCookie]; 272 return; 273 } 274 #endif // !USE(CFNETWORK) 275 276 CFHTTPCookieStorageSetCookie(cookieStorage.get(), [httpCookie _CFHTTPCookie]); 277 278 END_BLOCK_OBJC_EXCEPTIONS; 279 } 280 245 281 void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames) 246 282 { -
trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp
r187375 r199167 29 29 #include "URL.h" 30 30 #include "NetworkingContext.h" 31 #include "NotImplemented.h" 31 32 #include "PlatformCookieJar.h" 32 33 #include "SoupNetworkSession.h" … … 190 191 soup_cookie_free(cookie); 191 192 } 193 } 194 195 void addCookie(const NetworkStorageSession&, const URL&, const Cookie&) 196 { 197 // FIXME: implement this command. <https://webkit.org/b/156295> 198 notImplemented(); 192 199 } 193 200 -
trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h
r198457 r199167 57 57 #endif // defined(__OBJC__) && PLATFORM(COCOA) 58 58 59 #else // PLATFORM(WIN) ||USE(APPLE_INTERNAL_SDK)59 #else // !PLATFORM(WIN) && !USE(APPLE_INTERNAL_SDK) 60 60 61 61 typedef CF_ENUM(int64_t, _TimingDataOptions) … … 70 70 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; 71 71 typedef const struct __CFData* CFDataRef; 72 typedef const struct OpaqueCFHTTPCookie* CFHTTPCookieRef; 72 73 typedef struct _CFURLConnection* CFURLConnectionRef; 73 74 typedef struct _CFURLCredentialStorage* CFURLCredentialStorageRef; … … 98 99 @end 99 100 101 @interface NSHTTPCookie () 102 - (CFHTTPCookieRef)_CFHTTPCookie; 103 @end 104 100 105 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) 101 106 @interface NSURLSessionConfiguration () … … 123 128 #endif // defined(__OBJC__) 124 129 125 #endif // PLATFORM(WIN) ||USE(APPLE_INTERNAL_SDK)130 #endif // !PLATFORM(WIN) && !USE(APPLE_INTERNAL_SDK) 126 131 127 132 EXTERN_C void CFURLRequestSetShouldStartSynchronously(CFURLRequestRef, Boolean); … … 153 158 154 159 EXTERN_C CFHTTPCookieStorageRef _CFHTTPCookieStorageGetDefault(CFAllocatorRef); 160 EXTERN_C void CFHTTPCookieStorageSetCookie(CFHTTPCookieStorageRef, CFHTTPCookieRef); 155 161 EXTERN_C void CFHTTPCookieStorageSetCookieAcceptPolicy(CFHTTPCookieStorageRef, CFHTTPCookieStorageAcceptPolicy); 156 162 EXTERN_C void _CFNetworkSetOverrideSystemProxySettings(CFDictionaryRef); -
trunk/Source/WebKit/mac/ChangeLog
r199109 r199167 1 2016-04-07 Brian Burg <bburg@apple.com> 2 3 CookieJar should support adding synthetic cookies for developer tools 4 https://bugs.webkit.org/show_bug.cgi?id=156091 5 <rdar://problem/25581340> 6 7 Reviewed by Timothy Hatcher. 8 9 * WebCoreSupport/WebPlatformStrategies.h: 10 * WebCoreSupport/WebPlatformStrategies.mm: 11 (WebPlatformStrategies::addCookie): 12 Add new method override. 13 1 14 2016-04-06 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h
r198177 r199167 1 1 /* 2 * Copyright (C) 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 57 57 bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override; 58 58 void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override; 59 59 void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&) override; 60 60 61 61 // WebCore::PluginStrategy -
trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
r198177 r199167 113 113 } 114 114 115 void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie) 116 { 117 WebCore::addCookie(session, url, cookie); 118 } 119 115 120 void WebPlatformStrategies::refreshPlugins() 116 121 { -
trunk/Source/WebKit/win/ChangeLog
r198655 r199167 1 2016-04-07 Brian Burg <bburg@apple.com> 2 3 CookieJar should support adding synthetic cookies for developer tools 4 https://bugs.webkit.org/show_bug.cgi?id=156091 5 <rdar://problem/25581340> 6 7 Reviewed by Timothy Hatcher. 8 9 * WebCoreSupport/WebPlatformStrategies.h: 10 * WebCoreSupport/WebPlatformStrategies.cpp: 11 Add new method override. 12 1 13 2016-03-24 Said Abou-Hallawa <sabouhallawa@apple,com> 2 14 -
trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp
r192995 r199167 1 1 /* 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 105 105 } 106 106 107 void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie) 108 { 109 WebCore::addCookie(session, url, cookie); 110 } 111 107 112 void WebPlatformStrategies::refreshPlugins() 108 113 { -
trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h
r192995 r199167 1 1 /* 2 * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 virtual bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&); 54 54 virtual void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&); 55 virtual void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&); 55 56 56 57 // WebCore::PluginStrategy -
trunk/Source/WebKit2/ChangeLog
r199118 r199167 1 2016-04-07 Brian Burg <bburg@apple.com> 2 3 CookieJar should support adding synthetic cookies for developer tools 4 https://bugs.webkit.org/show_bug.cgi?id=156091 5 <rdar://problem/25581340> 6 7 Reviewed by Timothy Hatcher. 8 9 Plumb the new method through the strategy and out to the network process. 10 11 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 12 (WebKit::NetworkConnectionToWebProcess::addCookie): 13 * NetworkProcess/NetworkConnectionToWebProcess.h: 14 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 15 * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: 16 (WebKit::WebPlatformStrategies::addCookie): 17 * WebProcess/WebCoreSupport/WebPlatformStrategies.h: 18 1 19 2016-04-06 Alex Christensen <achristensen@webkit.org> 2 20 -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
r199043 r199167 250 250 } 251 251 252 void NetworkConnectionToWebProcess::addCookie(SessionID sessionID, const URL& url, const Cookie& cookie) 253 { 254 WebCore::addCookie(storageSession(sessionID), url, cookie); 255 } 256 252 257 void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, const SandboxExtension::Handle& extensionHandle, const String& contentType) 253 258 { -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
r199043 r199167 87 87 void getRawCookies(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&); 88 88 void deleteCookie(WebCore::SessionID, const WebCore::URL&, const String& cookieName); 89 void addCookie(WebCore::SessionID, const WebCore::URL&, const WebCore::Cookie&); 89 90 90 91 void registerFileBlobURL(const WebCore::URL&, const String& path, const SandboxExtension::Handle&, const String& contentType); -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r199043 r199167 39 39 GetRawCookies(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url) -> (Vector<WebCore::Cookie> cookies) 40 40 DeleteCookie(WebCore::SessionID sessionID, WebCore::URL url, String cookieName) 41 AddCookie(WebCore::SessionID sessionID, WebCore::URL url, struct WebCore::Cookie cookie) 41 42 42 43 RegisterFileBlobURL(WebCore::URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r198177 r199167 1 1 /* 2 * Copyright (C) 2010, 2011, 2012, 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2011, 2012, 2015, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 156 156 } 157 157 158 void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie) 159 { 160 WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::AddCookie(SessionTracker::sessionID(session), url, cookie), 0); 161 } 162 158 163 // PluginStrategy 159 164 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h
r198177 r199167 1 1 /* 2 * Copyright (C) 2010, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2010, 2012, 2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 59 59 bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override; 60 60 void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override; 61 void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&) override; 61 62 62 63 // WebCore::PluginStrategy
Note: See TracChangeset
for help on using the changeset viewer.