Diff
Modified: trunk/Source/WebKit/ChangeLog (229479 => 229480)
--- trunk/Source/WebKit/ChangeLog 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/ChangeLog 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,3 +1,36 @@
+2018-03-09 Brent Fulgham <[email protected]>
+
+ Remove cookie API access from WebContent Process
+ https://bugs.webkit.org/show_bug.cgi?id=183519
+ <rdar://problem/35368802>
+
+ Reviewed by Alex Christensen.
+
+ All cookie access is now handled in the Network Process. However, there are vestiges of the original logic that used CFNetwork APIs in the WebContent process.
+
+ This patch removes CFNetwork calls from the WebProcess code paths, since they serve no purpose in modern WebKit.
+
+ No tests because this is a code cleanup with no expected change in behavior.
+
+ * NetworkProcess/Cookies/mac/WebCookieManagerMac.mm:
+ (WebKit::WebCookieManager::platformSetHTTPCookieAcceptPolicy): Moved from WebFrameNetworkingContext.
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+ (WebKit::NetworkProcess::setSharedHTTPCookieStorage): Moved from ChildProcess, since this should only be
+ called in the NetworkProcess.
+ * Shared/ChildProcess.h:
+ * Shared/mac/ChildProcessMac.mm:
+ (WebKit::ChildProcess::setSharedHTTPCookieStorage): Deleted.
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h:
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+ (WebKit::WebFrameNetworkingContext::ensureWebsiteDataStoreSession): Remove CFNetwork code. This version of
+ 'ensureWebsiteDataStoreSession' is needed to maintain a dictionary on the WebProcess side so we can refer to
+ the same network session in both the WebContent and Network processes.
+ (WebKit::WebFrameNetworkingContext::webFrameLoaderClient const):
+ (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): Deleted.
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeWebProcess): Remove calls to CFNetwork.
+
2018-03-09 Youenn Fablet <[email protected]>
ServiceWorkerClientFetch should send data to its resource loader once the didReceiveResponse completion handler is called
Modified: trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm (229479 => 229480)
--- trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm 2018-03-09 21:31:02 UTC (rev 229480)
@@ -26,7 +26,10 @@
#import "config.h"
#import "WebCookieManager.h"
+#import "NetworkSession.h"
#import "WebFrameNetworkingContext.h"
+#import <WebCore/NetworkStorageSession.h>
+#import <pal/spi/cf/CFNetworkSPI.h>
using namespace WebCore;
@@ -34,7 +37,12 @@
void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
{
- WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(policy);
+ [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)];
+
+ NetworkStorageSession::forEach([&] (const NetworkStorageSession& networkStorageSession) {
+ if (auto cookieStorage = networkStorageSession.cookieStorage())
+ CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
+ });
}
HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (229479 => 229480)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -235,6 +235,10 @@
// Platform Helpers
void platformSetURLCacheSize(unsigned urlCacheMemoryCapacity, uint64_t urlCacheDiskCapacity);
+#if PLATFORM(MAC)
+ static void setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier);
+#endif
+
// Connections to WebProcesses.
Vector<RefPtr<NetworkConnectionToWebProcess>> m_webProcessConnections;
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (229479 => 229480)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
#import "config.h"
#import "NetworkProcess.h"
+#import "CookieStorageUtilsCF.h"
#import "NetworkCache.h"
#import "NetworkProcessCreationParameters.h"
#import "NetworkResourceLoader.h"
@@ -204,6 +205,13 @@
clearNSURLCache(m_clearCacheDispatchGroup, modifiedSince, WTFMove(completionHandler));
}
+#if PLATFORM(MAC)
+void NetworkProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier)
+{
+ [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorageFromIdentifyingData(identifier).get()]).get()];
+}
+#endif
+
void NetworkProcess::setCookieStoragePartitioningEnabled(bool enabled)
{
WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled(enabled);
Modified: trunk/Source/WebKit/Shared/ChildProcess.h (229479 => 229480)
--- trunk/Source/WebKit/Shared/ChildProcess.h 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/Shared/ChildProcess.h 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -91,10 +91,6 @@
virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&);
virtual void initializeConnection(IPC::Connection*);
-#if PLATFORM(MAC)
- static void setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier);
-#endif
-
virtual bool shouldTerminate() = 0;
virtual void terminate();
Modified: trunk/Source/WebKit/Shared/mac/ChildProcessMac.mm (229479 => 229480)
--- trunk/Source/WebKit/Shared/mac/ChildProcessMac.mm 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/Shared/mac/ChildProcessMac.mm 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,6 @@
#import "ChildProcess.h"
#import "CodeSigning.h"
-#import "CookieStorageUtilsCF.h"
#import "QuarantineSPI.h"
#import "SandboxInitializationParameters.h"
#import <WebCore/FileSystem.h>
@@ -36,7 +35,6 @@
#import <WebCore/SystemVersion.h>
#import <mach/mach.h>
#import <mach/task.h>
-#import <pal/spi/cf/CFNetworkSPI.h>
#import <pwd.h>
#import <stdlib.h>
#import <sysexits.h>
@@ -203,11 +201,6 @@
}
}
-void ChildProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier)
-{
- [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorageFromIdentifyingData(identifier).get()]).get()];
-}
-
#if USE(APPKIT)
void ChildProcess::stopNSAppRunLoop()
{
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h (229479 => 229480)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,7 +25,6 @@
#pragma once
-#include "HTTPCookieAcceptPolicy.h"
#include "WebFrame.h"
#include <WebCore/FrameNetworkingContext.h>
#include <pal/SessionID.h>
@@ -44,8 +43,6 @@
// FIXME: remove platform-specific code and use SessionTracker
static void ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&&);
- static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy);
-
WebFrameLoaderClient* webFrameLoaderClient() const;
private:
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (229479 => 229480)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2018-03-09 21:31:02 UTC (rev 229480)
@@ -26,7 +26,6 @@
#include "config.h"
#include "WebFrameNetworkingContext.h"
-#include "CookieStorageUtilsCF.h"
#include "NetworkSession.h"
#include "SessionTracker.h"
#include "WebPage.h"
@@ -39,7 +38,6 @@
#include <WebCore/Page.h>
#include <WebCore/ResourceError.h>
#include <WebCore/Settings.h>
-#include <pal/spi/cf/CFNetworkSPI.h>
using namespace WebCore;
@@ -57,26 +55,9 @@
else
base = SessionTracker::getIdentifierBase();
- if (!sessionID.isEphemeral())
- SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle);
-
- RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage;
- if (!sessionID.isEphemeral() && !parameters.uiProcessCookieStorageIdentifier.isEmpty())
- uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
-
- NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()), WTFMove(uiProcessCookieStorage));
+ NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
}
-void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
-{
- [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)];
-
- NetworkStorageSession::forEach([&] (const NetworkStorageSession& networkStorageSession) {
- if (auto cookieStorage = networkStorageSession.cookieStorage())
- CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
- });
-}
-
bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
{
return frame() && frame()->settings().localFileContentSniffingEnabled();
@@ -119,7 +100,7 @@
WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
{
if (!frame())
- return 0;
+ return nullptr;
return toWebFrameLoaderClient(frame()->loader().client());
}
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (229479 => 229480)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2018-03-09 21:14:58 UTC (rev 229479)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2018-03-09 21:31:02 UTC (rev 229480)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,7 +64,6 @@
#import <algorithm>
#import <dispatch/dispatch.h>
#import <objc/runtime.h>
-#import <pal/spi/cf/CFNetworkSPI.h>
#import <pal/spi/cocoa/LaunchServicesSPI.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
#import <pal/spi/cocoa/pthreadSPI.h>
@@ -148,10 +147,6 @@
JSC::processConfigFile(_javascript_ConfigFile.latin1().data(), "com.apple.WebKit.WebContent", parameters.uiProcessBundleIdentifier.latin1().data());
}
-#if PLATFORM(MAC)
- setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
-#endif
-
auto urlCache = adoptNS([[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil]);
[NSURLCache setSharedURLCache:urlCache.get()];
@@ -183,8 +178,6 @@
[NSApplication _accessibilityInitialize];
#endif
- _CFNetworkSetATSContext(parameters.networkATSContext.get());
-
#if TARGET_OS_IPHONE
// Priority decay on iOS 9 is impacting page load time so we fix the priority of the WebProcess' main thread (rdar://problem/22003112).
pthread_set_fixedpriority_self();