Title: [186850] trunk/Source/WebKit2
Revision
186850
Author
[email protected]
Date
2015-07-15 11:02:50 -0700 (Wed, 15 Jul 2015)

Log Message

[Mac][WK2] Videos should only have access to cookies when -[NSURLRequest HTTPShouldHandleCookies] is YES
https://bugs.webkit.org/show_bug.cgi?id=146763
<rdar://problem/21736994>

Reviewed by Darin Adler.

We should only fetch cookies from the Network process when -[NSURLRequest HTTPShouldHandleCookies] is YES.
This makes us more closely match the behavior of the CFNetwork implementation of
-[__NSURLSessionLocal {_copyCookiesForRequestUsingAllAppropriateStorageSemantics, _getCookieHeadersForTask:completionHandler}].

* Shared/mac/CookieStorageShim.mm:
(-[WKNSURLSessionLocal _copyCookiesForRequestUsingAllAppropriateStorageSemantics:]):
(-[WKNSURLSessionLocal _getCookieHeadersForTask:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (186849 => 186850)


--- trunk/Source/WebKit2/ChangeLog	2015-07-15 17:52:11 UTC (rev 186849)
+++ trunk/Source/WebKit2/ChangeLog	2015-07-15 18:02:50 UTC (rev 186850)
@@ -1,3 +1,19 @@
+2015-07-15  Daniel Bates  <[email protected]>
+
+        [Mac][WK2] Videos should only have access to cookies when -[NSURLRequest HTTPShouldHandleCookies] is YES
+        https://bugs.webkit.org/show_bug.cgi?id=146763
+        <rdar://problem/21736994>
+
+        Reviewed by Darin Adler.
+
+        We should only fetch cookies from the Network process when -[NSURLRequest HTTPShouldHandleCookies] is YES.
+        This makes us more closely match the behavior of the CFNetwork implementation of
+        -[__NSURLSessionLocal {_copyCookiesForRequestUsingAllAppropriateStorageSemantics, _getCookieHeadersForTask:completionHandler}].
+
+        * Shared/mac/CookieStorageShim.mm:
+        (-[WKNSURLSessionLocal _copyCookiesForRequestUsingAllAppropriateStorageSemantics:]):
+        (-[WKNSURLSessionLocal _getCookieHeadersForTask:completionHandler:]):
+
 2015-07-14  Enrica Casucci  <[email protected]>
 
         [iOS] Add support for updateSelectionWithExtentPoint:withBoundary.

Modified: trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm (186849 => 186850)


--- trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm	2015-07-15 17:52:11 UTC (rev 186849)
+++ trunk/Source/WebKit2/Shared/mac/CookieStorageShim.mm	2015-07-15 18:02:50 UTC (rev 186850)
@@ -47,6 +47,7 @@
 
 SOFT_LINK_FRAMEWORK(CFNetwork)
 SOFT_LINK(CFNetwork, CFURLRequestGetURL, CFURLRef, (CFURLRequestRef request), (request))
+SOFT_LINK(CFNetwork, CFURLRequestShouldHandleHTTPCookies, Boolean, (CFURLRequestRef request), (request))
 
 using namespace WebCore;
 
@@ -108,6 +109,8 @@
 @implementation WKNSURLSessionLocal
 - (CFDictionaryRef)_copyCookiesForRequestUsingAllAppropriateStorageSemantics:(CFURLRequestRef) request
 {
+    if (!CFURLRequestShouldHandleHTTPCookies(request))
+        return nullptr;
     return WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL(nullptr, CFURLRequestGetURL(request));
 }
 
@@ -117,6 +120,11 @@
     if (!completionHandler)
         return;
 
+    if (![[task currentRequest] HTTPShouldHandleCookies]) {
+        completionHandler(nullptr);
+        return;
+    }
+
     RetainPtr<NSURLSessionTask> strongTask = task;
     CompletionHandlerBlock completionHandlerCopy = [completionHandler copy];
     RunLoop::main().dispatch([strongTask, completionHandlerCopy] {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to