Diff
Modified: trunk/LayoutTests/ChangeLog (239831 => 239832)
--- trunk/LayoutTests/ChangeLog 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/LayoutTests/ChangeLog 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1,3 +1,24 @@
+2019-01-10 John Wilander <wilan...@apple.com>
+
+ Override the session configuration for cookieAcceptPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=190925
+ <rdar://problem/45497382>
+
+ Reviewed by Alexey Proskuryakov and Alex Christensen.
+
+ * 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>.
+
2019-01-10 Miguel Gomez <mago...@igalia.com>
Unreviewed GTK+ gardening after r239824.
Modified: trunk/LayoutTests/TestExpectations (239831 => 239832)
--- trunk/LayoutTests/TestExpectations 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/LayoutTests/TestExpectations 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1990,6 +1990,9 @@
webkit.org/b/3652 http/tests/misc/link-rel-prefetch-and-subresource.html [ Skip ]
webkit.org/b/3652 http/tests/misc/prefetch-purpose.html [ Skip ]
+# First-party-only cookie policy only supported on Cocoa platforms.
+http/tests/cookies/only-accept-first-party-cookies.html [ Skip ]
+
# Disabled WPT tests
webkit.org/b/185939 imported/w3c/web-platform-tests/css/WOFF2 [ Skip ]
Added: trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies-expected.txt (0 => 239832)
--- trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies-expected.txt 2019-01-10 17:57:22 UTC (rev 239832)
@@ -0,0 +1,29 @@
+Tests the first-party-only cookie policy.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: '<!--frame1-->'
+--------
+Cookies are: test_cookie = 1
+
+--------
+Frame: '<!--frame2-->'
+--------
+Cookies are:
+
+--------
+Frame: '<!--frame3-->'
+--------
+Cookies are: test_cookie = 1
+
+--------
+Frame: '<!--frame4-->'
+--------
+
Added: trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies.html (0 => 239832)
--- trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies.html (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/only-accept-first-party-cookies.html 2019-01-10 17:57:22 UTC (rev 239832)
@@ -0,0 +1,73 @@
+<html>
+<head>
+ <script src=""
+ <script src=""
+ <script>
+ description("Tests the first-party-only cookie policy.");
+ jsTestIsAsync = true;
+
+ const iframeUrls = {
+ echoCookies : "http://localhost:8000/cookies/resources/echo-cookies.php",
+ resetCookies : "http://localhost:8000/cookies/resources/reset-cookies.html"
+ };
+
+ function injectThirdPartyIframe(url) {
+ let iframeElement = document.createElement("iframe");
+ iframeElement.src = ""
+ iframeElement._onload_ = runNextTestOrFinish;
+ document.body.appendChild(iframeElement);
+ }
+
+ function setCookieInRedirect(hashValue) {
+ document.location.href = "" + hashValue;
+ }
+
+ function runNextTestOrFinish() {
+ if (!window.testRunner) {
+ testFailed("No testRunner.");
+ finishJSTest();
+ }
+
+ switch (document.location.hash) {
+ case "":
+ testRunner.dumpChildFramesAsText();
+ document.location.hash = "1";
+ injectThirdPartyIframe(iframeUrls.resetCookies);
+ break;
+ case "#1":
+ setCookieInRedirect(2);
+ break;
+ case "#2":
+ document.location.hash = "3";
+ // Should see one cookie.
+ injectThirdPartyIframe(iframeUrls.echoCookies);
+ break;
+ case "#3":
+ document.location.hash = "4";
+ testRunner.setOnlyAcceptFirstPartyCookies(true);
+ // Should not see any cookies.
+ injectThirdPartyIframe(iframeUrls.echoCookies);
+ break;
+ case "#4":
+ document.location.hash = "5";
+ // Should see one cookie.
+ testRunner.setOnlyAcceptFirstPartyCookies(false);
+ injectThirdPartyIframe(iframeUrls.echoCookies);
+ break;
+ case "#5":
+ document.location.hash = "6";
+ injectThirdPartyIframe(iframeUrls.resetCookies);
+ break;
+ case "#6":
+ finishJSTest();
+ break;
+ default:
+ testFailed("Unknown location hash value.");
+ finishJSTest();
+ }
+ }
+ </script>
+</head>
+<body _onload_="runNextTestOrFinish()">
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/cookies/resources/reset-cookies.html (0 => 239832)
--- trunk/LayoutTests/http/tests/cookies/resources/reset-cookies.html (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/resources/reset-cookies.html 2019-01-10 17:57:22 UTC (rev 239832)
@@ -0,0 +1,10 @@
+<html>
+<head>
+ <script src=""
+</head>
+<body>
+ <script>
+ resetCookies();
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/cookies/resources/set-cookie-and-redirect-back.php (0 => 239832)
--- trunk/LayoutTests/http/tests/cookies/resources/set-cookie-and-redirect-back.php (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/resources/set-cookie-and-redirect-back.php 2019-01-10 17:57:22 UTC (rev 239832)
@@ -0,0 +1,10 @@
+<?php
+if ($_GET['redirectBackTo']) {
+ header("HTTP/1.0 302 Found");
+ setcookie("test_cookie", "1", time() + 86400);
+ header('Location: ' . $_GET['redirectBackTo']);
+} else {
+ header("HTTP/1.0 200 OK");
+ echo "FAILED: No redirectBackTo parameter found.\n";
+}
+?>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (239831 => 239832)
--- trunk/LayoutTests/platform/ios/TestExpectations 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2019-01-10 17:57:22 UTC (rev 239832)
@@ -3170,6 +3170,9 @@
http/tests/cookies/same-site [ Pass ]
+# FIXME: Mark as Pass once <rdar://problem/47165939> is fixed.
+http/tests/cookies/only-accept-first-party-cookies.html [ Skip ]
+
system-preview [ Pass ]
editing/selection/character-granularity-rect.html [ Pass ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (239831 => 239832)
--- trunk/LayoutTests/platform/mac/TestExpectations 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1726,6 +1726,9 @@
[ Mojave+ ] http/tests/cookies/same-site [ Pass ]
+# FIXME: Mark as Pass once <rdar://problem/47165939> is fixed.
+[ Mojave+ ] http/tests/cookies/only-accept-first-party-cookies.html [ Skip ]
+
# FIXME: Mark as Pass once the fix for <rdar://problem/42255251> is shipped.
[ Mojave+ ] http/tests/cookies/same-site/set-first-party-cross-site-cookies.php [ Skip ]
[ Mojave+ ] http/tests/cookies/same-site/set-first-party-same-site-cookies.php [ Skip ]
Modified: trunk/Source/WTF/ChangeLog (239831 => 239832)
--- trunk/Source/WTF/ChangeLog 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WTF/ChangeLog 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1,3 +1,14 @@
+2019-01-10 John Wilander <wilan...@apple.com>
+
+ Override the session configuration for cookieAcceptPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=190925
+ <rdar://problem/45497382>
+
+ Reviewed by Alexey Proskuryakov and Alex Christensen.
+
+ * wtf/Platform.h:
+ Definition of HAVE_CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY.
+
2019-01-10 Dominik Infuehr <dinfu...@igalia.com>
Enable DFG on ARM/Linux again
Modified: trunk/Source/WTF/wtf/Platform.h (239831 => 239832)
--- trunk/Source/WTF/wtf/Platform.h 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WTF/wtf/Platform.h 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1467,3 +1467,7 @@
#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
#define HAVE_AUTHORIZATION_STATUS_FOR_MEDIA_TYPE 1
#endif
+
+#if (PLATFORM(MAC) && (__MAC_OS_X_VERSION_MIN_REQUIRED == 101200 || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101404))) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000 && __IPHONE_OS_VERSION_MAX_ALLOWED >= 120200) || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 50000 && __WATCH_OS_VERSION_MAX_ALLOWED >= 50200) || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 120000 && __TV_OS_VERSION_MAX_ALLOWED >= 120200)
+#define HAVE_CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY 1
+#endif
Modified: trunk/Source/WebCore/PAL/ChangeLog (239831 => 239832)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1,3 +1,14 @@
+2019-01-10 John Wilander <wilan...@apple.com>
+
+ Override the session configuration for cookieAcceptPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=190925
+ <rdar://problem/45497382>
+
+ Reviewed by Alexey Proskuryakov and Alex Christensen.
+
+ * pal/spi/cf/CFNetworkSPI.h:
+ Declaration of _overrideSessionCookieAcceptPolicy on NSHTTPCookieStorage.
+
2019-01-07 Devin Rousso <drou...@apple.com>
Web Inspector: Network: show secure connection details per-request
Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (239831 => 239832)
--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h 2019-01-10 17:57:22 UTC (rev 239832)
@@ -126,6 +126,9 @@
#if HAVE(FOUNDATION_WITH_SAVE_COOKIES_WITH_COMPLETION_HANDLER)
- (void)_saveCookies:(dispatch_block_t) completionHandler;
#endif
+#if HAVE(CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY)
+@property (nonatomic, readwrite) BOOL _overrideSessionCookieAcceptPolicy;
+#endif
@end
@interface NSURLConnection ()
Modified: trunk/Source/WebKit/ChangeLog (239831 => 239832)
--- trunk/Source/WebKit/ChangeLog 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WebKit/ChangeLog 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1,3 +1,15 @@
+2019-01-10 John Wilander <wilan...@apple.com>
+
+ Override the session configuration for cookieAcceptPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=190925
+ <rdar://problem/45497382>
+
+ Reviewed by Alexey Proskuryakov and Alex Christensen.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (WebKit::NetworkSessionCocoa::NetworkSessionCocoa):
+ Now sets cookieStorage._overrideSessionCookieAcceptPolicy to YES.
+
2019-01-09 Matt Rajca <mra...@apple.com>
Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (239831 => 239832)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2019-01-10 17:57:22 UTC (rev 239832)
@@ -916,9 +916,21 @@
auto* storageSession = WebCore::NetworkStorageSession::storageSession(parameters.sessionID);
RELEASE_ASSERT(storageSession);
- if (CFHTTPCookieStorageRef storage = storageSession->cookieStorage().get())
- configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
+ NSHTTPCookieStorage* cookieStorage;
+ if (CFHTTPCookieStorageRef storage = storageSession->cookieStorage().get()) {
+ cookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
+ configuration.HTTPCookieStorage = cookieStorage;
+ } else
+ cookieStorage = storageSession->nsCookieStorage();
+
+#if HAVE(CFNETWORK_OVERRIDE_SESSION_COOKIE_ACCEPT_POLICY)
+ // We still need to check the selector since CFNetwork updates and WebKit updates are separate
+ // on older macOS.
+ if ([cookieStorage respondsToSelector:@selector(_overrideSessionCookieAcceptPolicy)])
+ cookieStorage._overrideSessionCookieAcceptPolicy = YES;
+#endif
+
m_sessionWithCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:true]);
m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
LOG(NetworkSession, "Created NetworkSession with cookieAcceptPolicy %lu", configuration.HTTPCookieStorage.cookieAcceptPolicy);
Modified: trunk/Tools/ChangeLog (239831 => 239832)
--- trunk/Tools/ChangeLog 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/ChangeLog 2019-01-10 17:57:22 UTC (rev 239832)
@@ -1,3 +1,28 @@
+2019-01-10 John Wilander <wilan...@apple.com>
+
+ Override the session configuration for cookieAcceptPolicy
+ https://bugs.webkit.org/show_bug.cgi?id=190925
+ <rdar://problem/45497382>
+
+ Reviewed by Alexey Proskuryakov and Alex Christensen.
+
+ 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):
+
2019-01-09 Matt Rajca <mra...@apple.com>
Put per-document autoplay behavior behind runtime website policies quirk instead of a compile time flag
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (239831 => 239832)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2019-01-10 17:57:22 UTC (rev 239832)
@@ -810,6 +810,17 @@
return JSValueMakeUndefined(context);
}
+static JSValueRef setOnlyAcceptFirstPartyCookiesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ controller->setOnlyAcceptFirstPartyCookies(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setAppCacheMaximumSizeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac implementation
@@ -2195,6 +2206,7 @@
{ "setNeedsStorageAccessFromFileURLsQuirk", setNeedsStorageAccessFromFileURLsQuirkCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAllowsAnySSLCertificate", setAllowsAnySSLCertificateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setOnlyAcceptFirstPartyCookies", setOnlyAcceptFirstPartyCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAudioResult", setAudioResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (239831 => 239832)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2019-01-10 17:57:22 UTC (rev 239832)
@@ -272,7 +272,8 @@
bool alwaysAcceptCookies() const { return m_alwaysAcceptCookies; }
void setAlwaysAcceptCookies(bool);
-
+ void setOnlyAcceptFirstPartyCookies(bool);
+
bool rejectsProtectionSpaceAndContinueForAuthenticationChallenges() const { return m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges; }
void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool value) { m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges = value; }
Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (239831 => 239832)
--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2019-01-10 17:57:22 UTC (rev 239832)
@@ -72,6 +72,7 @@
#import <WebKit/WebStorageManagerPrivate.h>
#import <WebKit/WebView.h>
#import <WebKit/WebViewPrivate.h>
+#import <pal/spi/cf/CFNetworkSPI.h>
#import <wtf/HashMap.h>
#import <wtf/RetainPtr.h>
#import <wtf/WallTime.h>
@@ -400,6 +401,15 @@
[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:cookieAcceptPolicy];
}
+void TestRunner::setOnlyAcceptFirstPartyCookies(bool onlyAcceptFirstPartyCookies)
+{
+ if (onlyAcceptFirstPartyCookies)
+ m_alwaysAcceptCookies = NO;
+
+ NSHTTPCookieAcceptPolicy cookieAcceptPolicy = onlyAcceptFirstPartyCookies ? static_cast<NSHTTPCookieAcceptPolicy>(NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain) : NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+ [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:cookieAcceptPolicy];
+}
+
void TestRunner::setAppCacheMaximumSize(unsigned long long size)
{
[WebApplicationCache setMaximumSize:size];
Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (239831 => 239832)
--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2019-01-10 17:57:22 UTC (rev 239832)
@@ -397,6 +397,12 @@
m_alwaysAcceptCookies = alwaysAcceptCookies;
}
+void TestRunner::setOnlyAcceptFirstPartyCookies(bool onlyAcceptFirstPartyCookies)
+{
+ // FIXME: Implement.
+ fprintf(testResult, "ERROR: TestRunner::setOnlyAcceptFirstPartyCookies() not implemented\n");
+}
+
void TestRunner::setAppCacheMaximumSize(unsigned long long size)
{
COMPtr<IWebApplicationCache> applicationCache;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (239831 => 239832)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2019-01-10 17:57:22 UTC (rev 239832)
@@ -187,6 +187,7 @@
// Cookies testing
void setAlwaysAcceptCookies(boolean accept);
+ void setOnlyAcceptFirstPartyCookies(boolean accept);
void overridePreference(DOMString preference, DOMString value);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (239831 => 239832)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2019-01-10 17:57:22 UTC (rev 239832)
@@ -926,6 +926,15 @@
WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
}
+void TestRunner::setOnlyAcceptFirstPartyCookies(bool accept)
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetOnlyAcceptFirstPartyCookies"));
+
+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(accept));
+
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
double TestRunner::preciseTime()
{
return WallTime::now().secondsSinceEpoch().seconds();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (239831 => 239832)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2019-01-10 17:57:22 UTC (rev 239832)
@@ -294,6 +294,7 @@
// Cookies testing
void setAlwaysAcceptCookies(bool);
+ void setOnlyAcceptFirstPartyCookies(bool);
// Custom full screen behavior.
void setHasCustomFullScreenBehavior(bool value) { m_customFullScreenBehavior = value; }
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (239831 => 239832)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-01-10 17:32:24 UTC (rev 239831)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2019-01-10 17:57:22 UTC (rev 239832)
@@ -874,6 +874,14 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetOnlyAcceptFirstPartyCookies")) {
+ WKBooleanRef accept = static_cast<WKBooleanRef>(messageBody);
+ WKHTTPCookieAcceptPolicy policy = WKBooleanGetValue(accept) ? kWKHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain : kWKHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+ // FIXME: This updates the policy in WebProcess and in NetworkProcess asynchronously, which might break some tests' expectations.
+ WKCookieManagerSetHTTPCookieAcceptPolicy(WKContextGetCookieManager(TestController::singleton().context()), policy);
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "SetCustomUserAgent")) {
WKStringRef userAgent = static_cast<WKStringRef>(messageBody);
WKPageSetCustomUserAgent(TestController::singleton().mainWebView()->page(), userAgent);