Changeset 162166 in webkit
- Timestamp:
- Jan 16, 2014, 4:33:35 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r162164 r162166 1 2014-01-16 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain 4 https://bugs.webkit.org/show_bug.cgi?id=127139 5 6 Reviewed by Brady Eidson. 7 8 * platform/ios/WebCoreSystemInterfaceIOS.mm: 9 * platform/mac/WebCoreSystemInterface.h: 10 * platform/mac/WebCoreSystemInterface.mm: 11 Pass first party URL down, because reading cookies depends on it when this policy 12 in in action. 13 14 * platform/network/cf/CookieJarCFNet.cpp: 15 (WebCore::copyCookiesForURLWithFirstPartyURL): 16 (WebCore::cookiesForDOM): 17 (WebCore::cookieRequestHeaderFieldValue): 18 (WebCore::cookiesEnabled): 19 (WebCore::getRawCookies): 20 Use a new CFNetwork API that takes first party URL. 21 22 * platform/network/mac/CookieJarMac.mm: 23 (WebCore::cookiesForDOM): 24 (WebCore::cookieRequestHeaderFieldValue): 25 (WebCore::cookiesEnabled): 26 (WebCore::getRawCookies): 27 (WebCore::deleteCookie): 28 Pass first party URL (and null in deleteCookie, as there is none). 29 30 * platform/network/mac/ResourceHandleMac.mm: 31 (WebCore::ResourceHandle::platformLoadResourceSynchronously): 32 Removed a call to shouldRelaxThirdPartyCookiePolicy(), which no longer exists 33 in trunk. 34 1 35 2014-01-16 Andy Estes <aestes@apple.com> 2 36 -
trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm
r162114 r162166 105 105 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned); 106 106 NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef); 107 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL * );107 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *); 108 108 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *); 109 109 void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h
r161796 r162166 313 313 extern void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned); 314 314 extern NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef); 315 extern NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL * );315 extern NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *); 316 316 extern void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *); 317 317 extern void (*wkDeleteHTTPCookie)(CFHTTPCookieStorageRef, NSHTTPCookie *); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
r161796 r162166 174 174 void (*wkSetHTTPCookieAcceptPolicy)(CFHTTPCookieStorageRef, unsigned); 175 175 NSArray *(*wkHTTPCookies)(CFHTTPCookieStorageRef); 176 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL * );176 NSArray *(*wkHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSURL *, NSURL *); 177 177 void (*wkSetHTTPCookiesForURL)(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *); 178 178 void (*wkDeleteAllHTTPCookies)(CFHTTPCookieStorageRef); -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r156550 r162166 42 42 #endif 43 43 44 enum { 45 CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain = 3; 46 }; 47 44 48 namespace WebCore { 45 49 … … 94 98 } 95 99 100 static RetainPtr<CFArrayRef> copyCookiesForURLWithFirstPartyURL(const NetworkStorageSession& session, const URL& firstParty, const URL& url) 101 { 102 bool secure = url.protocolIs("https"); 103 104 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100) 105 RetainPtr<CFArrayRef> cookiesCF = adoptCF(_CFHTTPCookieStorageCopyCookiesForURLWithMainDocumentURL(session.cookieStorage().get(), url.createCFURL().get(), firstParty.createCFURL().get(), secure)); 106 #else 107 // _CFHTTPCookieStorageCopyCookiesForURLWithMainDocumentURL is not available on other platforms. 108 UNUSED_PARAM(firstParty); 109 RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), url.createCFURL().get(), secure)); 110 #endif 111 } 112 96 113 void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& value) 97 114 { … … 118 135 } 119 136 120 String cookiesForDOM(const NetworkStorageSession& session, const URL&, const URL& url) 121 { 122 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 123 124 bool secure = url.protocolIs("https"); 125 RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure)); 137 String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url) 138 { 139 RetainPtr<CFArrayRef> cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url); 126 140 RetainPtr<CFDictionaryRef> headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get())); 127 141 return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF); 128 142 } 129 143 130 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& url) 131 { 132 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 133 134 bool secure = url.protocolIs("https"); 135 RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure)); 144 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url) 145 { 146 RetainPtr<CFArrayRef> cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url); 136 147 RetainPtr<CFDictionaryRef> headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get())); 137 148 return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF); … … 141 152 { 142 153 CFHTTPCookieStorageAcceptPolicy policy = CFHTTPCookieStorageGetCookieAcceptPolicy(session.cookieStorage().get()); 143 return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicy Always;144 } 145 146 bool getRawCookies(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& url, Vector<Cookie>& rawCookies)154 return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways; 155 } 156 157 bool getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies) 147 158 { 148 159 rawCookies.clear(); 149 160 150 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 151 152 bool sendSecureCookies = url.protocolIs("https"); 153 RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies)); 161 RetainPtr<CFArrayRef> cookiesCF = copyCookiesForURLWithFirstPartyURL(session, firstParty, url); 154 162 155 163 CFIndex count = CFArrayGetCount(cookiesCF.get()); -
trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm
r156550 r162166 36 36 #import "WebCoreSystemInterface.h" 37 37 38 enum { 39 NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3 40 }; 41 38 42 namespace WebCore { 39 43 … … 62 66 } 63 67 64 String cookiesForDOM(const NetworkStorageSession& session, const URL& , const URL& url)68 String cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url) 65 69 { 66 70 BEGIN_BLOCK_OBJC_EXCEPTIONS; 67 71 68 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);72 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url); 69 73 return [[NSHTTPCookie requestHeaderFieldsWithCookies:filterCookies(cookies).get()] objectForKey:@"Cookie"]; 70 74 … … 73 77 } 74 78 75 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& url)79 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url) 76 80 { 77 81 BEGIN_BLOCK_OBJC_EXCEPTIONS; 78 82 79 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);83 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url); 80 84 return [[NSHTTPCookie requestHeaderFieldsWithCookies:cookies] objectForKey:@"Cookie"]; 81 85 … … 111 115 112 116 NSHTTPCookieAcceptPolicy cookieAcceptPolicy = static_cast<NSHTTPCookieAcceptPolicy>(wkGetHTTPCookieAcceptPolicy(session.cookieStorage().get())); 113 return cookieAcceptPolicy == NSHTTPCookieAcceptPolicyAlways || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain ;117 return cookieAcceptPolicy == NSHTTPCookieAcceptPolicyAlways || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain || cookieAcceptPolicy == NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain; 114 118 115 119 END_BLOCK_OBJC_EXCEPTIONS; … … 117 121 } 118 122 119 bool getRawCookies(const NetworkStorageSession& session, const URL& /*firstParty*/, const URL& url, Vector<Cookie>& rawCookies)123 bool getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies) 120 124 { 121 125 rawCookies.clear(); 122 126 BEGIN_BLOCK_OBJC_EXCEPTIONS; 123 127 124 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), url);128 NSArray *cookies = wkHTTPCookiesForURL(session.cookieStorage().get(), firstParty, url); 125 129 NSUInteger count = [cookies count]; 126 130 rawCookies.reserveCapacity(count); … … 140 144 BEGIN_BLOCK_OBJC_EXCEPTIONS; 141 145 142 NSURL *cookieURL = url;143 146 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage(); 144 NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), cookieURL);147 NSArray *cookies = wkHTTPCookiesForURL(cookieStorage.get(), 0, url); 145 148 146 149 NSString *cookieNameString = cookieName; -
trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm
r161796 r162166 387 387 handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate. 388 388 storedCredentials == AllowStoredCredentials, 389 shouldRelaxThirdPartyCookiePolicy(context, request.url()),390 389 handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()), 391 390 SchedulingBehavior::Synchronous, -
trunk/Source/WebKit/mac/ChangeLog
r162162 r162166 1 2014-01-16 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain 4 https://bugs.webkit.org/show_bug.cgi?id=127139 5 6 Reviewed by Brady Eidson. 7 8 * WebView/WebPreferences.mm: (-[WebPreferences _synchronizeWebStoragePolicyWithCookiePolicy]): 9 Handle the new case. 10 1 11 2014-01-16 Daniel Bates <dabates@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebPreferences.mm
r162094 r162166 50 50 #import <wtf/RunLoop.h> 51 51 52 enum { 53 NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3 54 }; 55 52 56 using namespace WebCore; 53 57 … … 2313 2317 - (void)_synchronizeWebStoragePolicyWithCookiePolicy 2314 2318 { 2319 // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions. 2320 2315 2321 NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy]; 2316 2322 WebStorageBlockingPolicy storageBlockingPolicy; … … 2320 2326 break; 2321 2327 case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: 2328 case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain: 2322 2329 storageBlockingPolicy = WebBlockThirdPartyStorage; 2323 2330 break; -
trunk/Source/WebKit2/ChangeLog
r162163 r162166 1 2014-01-16 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain 4 https://bugs.webkit.org/show_bug.cgi?id=127139 5 6 Reviewed by Brady Eidson. 7 8 * Shared/HTTPCookieAcceptPolicy.h: 9 * UIProcess/API/C/WKAPICast.h: 10 (WebKit::toHTTPCookieAcceptPolicy): 11 (WebKit::toAPI): 12 * UIProcess/API/C/WKCookieManager.h: 13 Added the policy to appropriate switches and enums. 14 1 15 2014-01-16 Jeffrey Pfau <jpfau@apple.com> 2 16 -
trunk/Source/WebKit2/Shared/HTTPCookieAcceptPolicy.h
r95901 r162166 33 33 HTTPCookieAcceptPolicyNever = 1, 34 34 HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2, 35 HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3, 35 36 }; 36 37 typedef unsigned HTTPCookieAcceptPolicy; -
trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h
r162141 r162166 393 393 case kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: 394 394 return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; 395 case kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain: 396 return HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain; 395 397 } 396 398 … … 408 410 case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain: 409 411 return kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain; 412 case HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain: 413 return kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain; 410 414 } 411 415 -
trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.h
r160104 r162166 36 36 kWKHTTPCookieAcceptPolicyAlways = 0, 37 37 kWKHTTPCookieAcceptPolicyNever = 1, 38 kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2 38 kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain = 2, 39 kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3 39 40 }; 40 41 typedef uint32_t WKHTTPCookieAcceptPolicy; -
trunk/WebKitLibraries/ChangeLog
r162129 r162166 1 2014-01-16 Alexey Proskuryakov <ap@apple.com> 2 3 [Mac] [iOS] Add support for CFHTTPCookieStorageAcceptPolicyExclusivelyFromMainDocumentDomain 4 https://bugs.webkit.org/show_bug.cgi?id=127139 5 6 Reviewed by Brady Eidson. 7 8 * WebKitSystemInterface.h: 9 * libWebKitSystemInterfaceLion.a: 10 * libWebKitSystemInterfaceMavericks.a: 11 * libWebKitSystemInterfaceMountainLion.a: 12 Update WebKitSystemInterface. 13 1 14 2014-01-16 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/WebKitLibraries/WebKitSystemInterface.h
r161796 r162166 173 173 CTLineRef WKCreateCTLineWithUniCharProvider(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); 174 174 175 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090175 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 176 176 enum { 177 177 WKCTFontTransformApplyShaping = (1 << 0), … … 182 182 183 183 bool WKCTFontTransformGlyphs(CTFontRef font, CGGlyph glyphs[], CGSize advances[], CFIndex count, WKCTFontTransformOptions options); 184 #endif 184 #endif // TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 185 185 186 186 CTTypesetterRef WKCreateCTTypesetterWithUniCharProviderAndOptions(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); … … 188 188 CGSize WKCTRunGetInitialAdvance(CTRunRef); 189 189 190 #if !TARGET_IPHONE_SIMULATOR190 #if (TARGET_OS_IPHONE && TARGET_OS_EMBEDDED) || MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 191 191 CGContextRef WKIOSurfaceContextCreate(IOSurfaceRef, unsigned width, unsigned height, CGColorSpaceRef); 192 192 CGImageRef WKIOSurfaceContextCreateImage(CGContextRef context); … … 276 276 void WKSetHTTPCookieAcceptPolicy(CFHTTPCookieStorageRef, unsigned policy); 277 277 NSArray *WKHTTPCookies(CFHTTPCookieStorageRef); 278 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL * );278 NSArray *WKHTTPCookiesForURL(CFHTTPCookieStorageRef, NSURL *, NSURL *); 279 279 void WKSetHTTPCookiesForURL(CFHTTPCookieStorageRef, NSArray *, NSURL *, NSURL *); 280 280 void WKDeleteAllHTTPCookies(CFHTTPCookieStorageRef); … … 536 536 void WKCFNetworkSetOverrideSystemProxySettings(CFDictionaryRef); 537 537 538 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080538 #if TARGET_OS_IPHONE || MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 539 539 bool WKIsPublicSuffix(NSString *domain); 540 540
Note:
See TracChangeset
for help on using the changeset viewer.