Override the session configuration for cookieAcceptPolicy
authorryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 17:57:22 +0000 (17:57 +0000)
committerryanhaddad@apple.com <ryanhaddad@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Jan 2019 17:57:22 +0000 (17:57 +0000)
commitb2cb1ba7d1e8021ce75b6c4d2e06ecd86665352e
treea44e6ef14a62c407ea0b3809d75d651dff1c0716
parent2de7a99f30d0b5e83551e9bc7dc033ec55472c00
Override the session configuration for cookieAcceptPolicy
https://bugs.webkit.org/show_bug.cgi?id=190925
<rdar://problem/45497382>

Patch by John Wilander <wilander@apple.com> on 2019-01-10
Reviewed by Alexey Proskuryakov and Alex Christensen.

Source/WebCore/PAL:

* pal/spi/cf/CFNetworkSPI.h:
    Declaration of _overrideSessionCookieAcceptPolicy on NSHTTPCookieStorage.

Source/WebKit:

* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
    Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES.

Source/WTF:

* wtf/Platform.h:
    Definition of HAVE_CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY.

Tools:

Test infrastructure for setting a first-party-only cookie policy.

* DumpRenderTree/TestRunner.cpp:
(setOnlyAcceptFirstPartyCookiesCallback):
(TestRunner::staticFunctions):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setOnlyAcceptFirstPartyCookies):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setOnlyAcceptFirstPartyCookies):
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setOnlyAcceptFirstPartyCookies):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

LayoutTests:

* TestExpectations:
    Skipped since this cookie policy is only supported on Cocoa platforms.
* http/tests/cookies/only-accept-first-party-cookies-expected.txt: Added.
* http/tests/cookies/only-accept-first-party-cookies.html: Added.
* http/tests/cookies/resources/reset-cookies.html: Added.
    To support reset of third-party cookies in an iframe.
* http/tests/cookies/resources/set-cookie-and-redirect-back.php: Added.
    A simple bounce to set a cookie.
* platform/ios/TestExpectations:
    Skipped for now. Will be fixed in <rdar://problem/47165939>.
* platform/mac/TestExpectations:
    Skipped for now. Will be fixed in <rdar://problem/47165939>.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/cookies/only-accept-first-party-cookies-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/cookies/only-accept-first-party-cookies.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/reset-cookies.html [new file with mode: 0644]
LayoutTests/http/tests/cookies/resources/set-cookie-and-redirect-back.php [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac/TestExpectations
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp
Tools/DumpRenderTree/TestRunner.h
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/DumpRenderTree/win/TestRunnerWin.cpp
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/TestInvocation.cpp