Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (204326 => 204327)
--- trunk/Source/WebCore/CMakeLists.txt 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-08-10 07:01:32 UTC (rev 204327)
@@ -2355,6 +2355,7 @@
platform/network/HTTPParsers.cpp
platform/network/MIMEHeader.cpp
platform/network/NetworkStateNotifier.cpp
+ platform/network/NetworkStorageSession.cpp
platform/network/ParsedContentRange.cpp
platform/network/ParsedContentType.cpp
platform/network/ProtectionSpaceBase.cpp
Modified: trunk/Source/WebCore/ChangeLog (204326 => 204327)
--- trunk/Source/WebCore/ChangeLog 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/ChangeLog 2016-08-10 07:01:32 UTC (rev 204327)
@@ -1,3 +1,39 @@
+2016-08-09 Alex Christensen <achristen...@webkit.org>
+
+ Move NetworkStorageSession management to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160173
+
+ Reviewed by Brady Eidson.
+
+ No new tests. No change in behaviour.
+ Just moving the mapping from SessionID to NetworkStorageSession so we can use it from WebCore.
+ I need this so we can get to the NetworkStorageSession from SocketStreamHandle without requiring a NetworkingContext.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * loader/CookieJar.cpp:
+ * platform/network/NetworkStorageSession.cpp: Added.
+ (WebCore::globalSessionMap):
+ (WebCore::NetworkStorageSession::storageSession):
+ (WebCore::NetworkStorageSession::destroySession):
+ (WebCore::NetworkStorageSession::forEach):
+ Moved from forEachNetworkStorageSession and fixed the FIXME. This function now includes the default NetworkStorageSession.
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/NetworkingContext.h:
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::NetworkStorageSession::defaultStorageSession):
+ (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
+ (WebCore::NetworkStorageSession::cookieStorage):
+ (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
+ * platform/network/cf/SocketStreamHandleCFNet.cpp:
+ * platform/network/soup/CookieJarSoup.cpp:
+ * platform/network/soup/NetworkStorageSessionSoup.cpp:
+ (WebCore::NetworkStorageSession::defaultStorageSession):
+ (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
+ (WebCore::NetworkStorageSession::switchToNewTestingSession):
+ (WebCore::NetworkStorageSession::createPrivateBrowsingSession): Deleted.
+ * platform/network/soup/ResourceHandleSoup.cpp:
+
2016-08-09 Chris Dumez <cdu...@apple.com>
Optimization in Node.replaceChild() is not spec-compliant
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204326 => 204327)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-10 07:01:32 UTC (rev 204327)
@@ -2397,6 +2397,7 @@
5B30695E18B3D3450099D5E8 /* WebGLDrawBuffers.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B30695B18B3D3450099D5E8 /* WebGLDrawBuffers.h */; };
5B7A208D2E12979B4AE19DE6 /* RenderMathMLSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DBFCB0EBFF5CD77EBEB35395 /* RenderMathMLSpace.cpp */; };
5B7A208D2E12979B4AE19E6F /* RenderMathMLPadded.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DBFCB0EBFF5CD77EBEB3595F /* RenderMathMLPadded.cpp */; };
+ 5C3C856D1D5A7ADE0088B9EC /* NetworkStorageSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3C856C1D5A7AD30088B9EC /* NetworkStorageSession.cpp */; };
5C4304B0191AC908000E2BC0 /* EXTShaderTextureLOD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4304AD191AC908000E2BC0 /* EXTShaderTextureLOD.cpp */; };
5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304AE191AC908000E2BC0 /* EXTShaderTextureLOD.h */; };
5C4304B5191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C4304B3191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp */; };
@@ -9754,6 +9755,7 @@
5C39305F1AA0F6A90029C816 /* DFABytecodeCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFABytecodeCompiler.h; sourceTree = "<group>"; };
5C3930601AA0F6A90029C816 /* DFABytecodeInterpreter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DFABytecodeInterpreter.cpp; sourceTree = "<group>"; };
5C3930611AA0F6A90029C816 /* DFABytecodeInterpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFABytecodeInterpreter.h; sourceTree = "<group>"; };
+ 5C3C856C1D5A7AD30088B9EC /* NetworkStorageSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStorageSession.cpp; sourceTree = "<group>"; };
5C4304AD191AC908000E2BC0 /* EXTShaderTextureLOD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTShaderTextureLOD.cpp; sourceTree = "<group>"; };
5C4304AE191AC908000E2BC0 /* EXTShaderTextureLOD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTShaderTextureLOD.h; sourceTree = "<group>"; };
5C4304AF191AC908000E2BC0 /* EXTShaderTextureLOD.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTShaderTextureLOD.idl; sourceTree = "<group>"; };
@@ -17871,6 +17873,7 @@
656B84D70AEA1CE900A095B4 /* network */ = {
isa = PBXGroup;
children = (
+ 5C3C856C1D5A7AD30088B9EC /* NetworkStorageSession.cpp */,
B2F34FE70E82F81700F627CD /* cf */,
7E7DE1FE195CEF2D0035363B /* cocoa */,
4497D58C0EBA854F00A10552 /* ios */,
@@ -28898,6 +28901,7 @@
514C766D0CE923A1007EF3CD /* CredentialBase.cpp in Sources */,
3792917D1987678F00F4B661 /* CredentialCocoa.mm in Sources */,
51A052341058774F00CC9E95 /* CredentialStorage.cpp in Sources */,
+ 5C3C856D1D5A7ADE0088B9EC /* NetworkStorageSession.cpp in Sources */,
7EE6846512D26E3800E79415 /* CredentialStorageCFNet.cpp in Sources */,
E1B4CD2510B322E200BFFD7E /* CredentialStorageMac.mm in Sources */,
2D481F00146B5C4C00AA7834 /* CrossfadeGeneratedImage.cpp in Sources */,
Modified: trunk/Source/WebCore/loader/CookieJar.cpp (204326 => 204327)
--- trunk/Source/WebCore/loader/CookieJar.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/loader/CookieJar.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -30,6 +30,7 @@
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
#include "PlatformCookieJar.h"
#include "PlatformStrategies.h"
Added: trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (0 => 204327)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkStorageSession.h"
+
+#include "SessionID.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>& NetworkStorageSession::globalSessionMap()
+{
+ static NeverDestroyed<HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>> map;
+ return map;
+}
+
+NetworkStorageSession* NetworkStorageSession::storageSession(SessionID sessionID)
+{
+ if (sessionID == SessionID::defaultSessionID())
+ return &defaultStorageSession();
+ return globalSessionMap().get(sessionID);
+}
+
+void NetworkStorageSession::destroySession(SessionID sessionID)
+{
+ globalSessionMap().remove(sessionID);
+}
+
+void NetworkStorageSession::forEach(std::function<void(const WebCore::NetworkStorageSession&)> functor)
+{
+ functor(defaultStorageSession());
+ for (auto& storageSession : globalSessionMap().values())
+ functor(*storageSession);
+}
+
+}
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (204326 => 204327)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2016-08-10 07:01:32 UTC (rev 204327)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef NetworkStorageSession_h
-#define NetworkStorageSession_h
+#pragma once
#include "CredentialStorage.h"
#include "SessionID.h"
@@ -45,7 +44,10 @@
WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
public:
WEBCORE_EXPORT static NetworkStorageSession& defaultStorageSession();
- WEBCORE_EXPORT static std::unique_ptr<NetworkStorageSession> createPrivateBrowsingSession(SessionID, const String& identifierBase = String());
+ WEBCORE_EXPORT static NetworkStorageSession* storageSession(SessionID);
+ WEBCORE_EXPORT static void ensurePrivateBrowsingSession(SessionID, const String& identifierBase = String());
+ WEBCORE_EXPORT static void destroySession(SessionID);
+ WEBCORE_EXPORT static void forEach(std::function<void(const WebCore::NetworkStorageSession&)>);
WEBCORE_EXPORT static void switchToNewTestingSession();
@@ -72,6 +74,7 @@
#endif
private:
+ static HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>& globalSessionMap();
SessionID m_sessionID;
#if PLATFORM(COCOA) || USE(CFNETWORK)
@@ -89,5 +92,3 @@
String cookieStoragePartition(const URL& firstPartyForCookies, const URL& resource);
}
-
-#endif // NetworkStorageSession_h
Modified: trunk/Source/WebCore/platform/network/NetworkingContext.h (204326 => 204327)
--- trunk/Source/WebCore/platform/network/NetworkingContext.h 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/NetworkingContext.h 2016-08-10 07:01:32 UTC (rev 204327)
@@ -17,12 +17,11 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef NetworkingContext_h
-#define NetworkingContext_h
+#pragma once
-#include "NetworkStorageSession.h"
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
+#include <wtf/text/WTFString.h>
#if PLATFORM(COCOA)
#include <wtf/SchedulePair.h>
@@ -38,6 +37,7 @@
namespace WebCore {
+class NetworkStorageSession;
class ResourceError;
class ResourceRequest;
@@ -69,5 +69,3 @@
};
}
-
-#endif // NetworkingContext_h
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -72,8 +72,10 @@
return *defaultNetworkStorageSession();
}
-std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(SessionID sessionID, const String& identifierBase)
+void NetworkStorageSession::ensurePrivateBrowsingSession(SessionID sessionID, const String& identifierBase)
{
+ if (globalSessionMap().contains(sessionID))
+ return;
RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString();
#if PLATFORM(COCOA)
@@ -82,7 +84,7 @@
auto session = std::make_unique<NetworkStorageSession>(sessionID, adoptCF(wkCreatePrivateStorageSession(cfIdentifier.get(), defaultNetworkStorageSession()->platformSession())));
#endif
- return session;
+ globalSessionMap().add(sessionID, WTFMove(session));
}
RetainPtr<CFHTTPCookieStorageRef> NetworkStorageSession::cookieStorage() const
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -37,6 +37,7 @@
#include "FrameLoader.h"
#include "HTTPHeaderNames.h"
#include "Logging.h"
+#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
#include "ResourceError.h"
#include "ResourceHandleClient.h"
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -28,6 +28,7 @@
#if USE(CFNETWORK)
+#include "CFNetworkSPI.h"
#include "FormDataStreamCFNet.h"
#include "NetworkingContext.h"
#include "ResourceHandle.h"
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -35,6 +35,7 @@
#include "Credential.h"
#include "CredentialStorage.h"
#include "Logging.h"
+#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
#include "ProtectionSpace.h"
#include "Settings.h"
Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -26,10 +26,11 @@
#include "Cookie.h"
#include "GUniquePtrSoup.h"
-#include "URL.h"
+#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
#include "PlatformCookieJar.h"
#include "SoupNetworkSession.h"
+#include "URL.h"
#include <wtf/DateMath.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/CString.h>
Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -60,10 +60,12 @@
return *defaultSession();
}
-std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(SessionID sessionID, const String&)
+void NetworkStorageSession::ensurePrivateBrowsingSession(SessionID sessionID, const String&)
{
auto session = std::make_unique<NetworkStorageSession>(sessionID, SoupNetworkSession::createPrivateBrowsingSession());
- return session;
+ ASSERT(sessionID != SessionID::defaultSessionID());
+ ASSERT(!globalSessionMap().contains(sessionID));
+ globalSessionMap().add(sessionID, WTFMove(session));
}
void NetworkStorageSession::switchToNewTestingSession()
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (204326 => 204327)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -38,8 +38,8 @@
#include "HTTPParsers.h"
#include "LocalizedStrings.h"
#include "MIMETypeRegistry.h"
+#include "NetworkStorageSession.h"
#include "NetworkingContext.h"
-#include "NotImplemented.h"
#include "ResourceError.h"
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
Modified: trunk/Source/WebKit/mac/ChangeLog (204326 => 204327)
--- trunk/Source/WebKit/mac/ChangeLog 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-08-10 07:01:32 UTC (rev 204327)
@@ -1,3 +1,16 @@
+2016-08-09 Alex Christensen <achristen...@webkit.org>
+
+ Move NetworkStorageSession management to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160173
+
+ Reviewed by Brady Eidson.
+
+ * WebCoreSupport/WebFrameNetworkingContext.mm:
+ (WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+ (WebFrameNetworkingContext::destroyPrivateBrowsingSession):
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ * WebView/WebView.mm:
+
2016-08-09 Anders Carlsson <ander...@apple.com>
Instantiate WebKit plug-ins at layout time, instead of at style resolution time
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm (204326 => 204327)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -44,22 +44,13 @@
using namespace WebCore;
-static std::unique_ptr<NetworkStorageSession>& privateSession()
-{
- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;
- return session;
-}
-
NetworkStorageSession& WebFrameNetworkingContext::ensurePrivateBrowsingSession()
{
ASSERT(isMainThread());
- if (privateSession())
- return *privateSession();
+ NetworkStorageSession::ensurePrivateBrowsingSession(SessionID::legacyPrivateSessionID(), [[NSBundle mainBundle] bundleIdentifier]);
- privateSession() = NetworkStorageSession::createPrivateBrowsingSession(SessionID::legacyPrivateSessionID(), [[NSBundle mainBundle] bundleIdentifier]);
-
- return *privateSession();
+ return *NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID());
}
void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
@@ -66,7 +57,7 @@
{
ASSERT(isMainThread());
- privateSession() = nullptr;
+ NetworkStorageSession::destroySession(SessionID::legacyPrivateSessionID());
}
bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
@@ -107,7 +98,7 @@
{
ASSERT(isMainThread());
if (frame() && frame()->page()->sessionID().isEphemeral()) {
- if (NetworkStorageSession* session = privateSession().get())
+ if (NetworkStorageSession* session = NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID()))
return *session;
// Some requests may still be coming shortly before WebCore updates the session ID and after WebKit destroys the private browsing session.
LOG_ERROR("Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (204326 => 204327)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -31,6 +31,7 @@
#import <WebCore/BlobRegistryImpl.h>
#import <WebCore/Color.h>
#import <WebCore/MainFrame.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/Page.h>
#import <WebCore/PageGroup.h>
#import <WebCore/PlatformCookieJar.h>
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (204326 => 204327)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -158,6 +158,7 @@
#import <WebCore/MemoryCache.h>
#import <WebCore/MemoryPressureHandler.h>
#import <WebCore/NSURLFileTypeMappingsSPI.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/NodeList.h>
#import <WebCore/Notification.h>
#import <WebCore/NotificationController.h>
Modified: trunk/Source/WebKit/win/ChangeLog (204326 => 204327)
--- trunk/Source/WebKit/win/ChangeLog 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/win/ChangeLog 2016-08-10 07:01:32 UTC (rev 204327)
@@ -1,3 +1,22 @@
+2016-08-09 Alex Christensen <achristen...@webkit.org>
+
+ Move NetworkStorageSession management to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160173
+
+ Reviewed by Brady Eidson.
+
+ * WebCoreSupport/WebFrameNetworkingContext.cpp:
+ (identifierBase):
+ (WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
+ (WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+ (WebFrameNetworkingContext::destroyPrivateBrowsingSession):
+ (WebFrameNetworkingContext::blockedError):
+ (WebFrameNetworkingContext::storageSession):
+ (privateSession): Deleted.
+ * WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebPlatformStrategies::createPasteboardStrategy):
+ (WebPlatformStrategies::createBlobRegistry):
+
2016-08-09 Anders Carlsson <ander...@apple.com>
Instantiate WebKit plug-ins at layout time, instead of at style resolution time
Modified: trunk/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp (204326 => 204327)
--- trunk/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -41,12 +41,6 @@
using namespace WebCore;
-static std::unique_ptr<NetworkStorageSession>& privateSession()
-{
- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;
- return session;
-}
-
static String& identifierBase()
{
static NeverDestroyed<String> base;
@@ -59,8 +53,8 @@
if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage())
CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
- if (privateSession())
- CFHTTPCookieStorageSetCookieAcceptPolicy(privateSession()->cookieStorage().get(), policy);
+ if (auto privateSession = NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID()))
+ CFHTTPCookieStorageSetCookieAcceptPolicy(privateSession->cookieStorage().get(), policy);
}
#endif
@@ -76,8 +70,8 @@
#if USE(CFNETWORK)
ASSERT(isMainThread());
- if (privateSession())
- return *privateSession();
+ if (auto privateSession = NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID()))
+ return *privateSession;
String base;
if (identifierBase().isNull()) {
@@ -87,10 +81,10 @@
} else
base = identifierBase();
- privateSession() = NetworkStorageSession::createPrivateBrowsingSession(SessionID::legacyPrivateSessionID(), base);
+ NetworkStorageSession::ensurePrivateBrowsingSession(SessionID::legacyPrivateSessionID(), base);
#endif
- return *privateSession();
+ return *NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID());
}
void WebFrameNetworkingContext::destroyPrivateBrowsingSession()
@@ -97,7 +91,7 @@
{
ASSERT(isMainThread());
- privateSession() = nullptr;
+ NetworkStorageSession::destroySession(SessionID::legacyPrivateSessionID());
}
ResourceError WebFrameNetworkingContext::blockedError(const ResourceRequest& request) const
@@ -110,7 +104,7 @@
ASSERT(isMainThread());
if (frame() && frame()->page()->usesEphemeralSession())
- return *privateSession();
+ return *NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID());
return NetworkStorageSession::defaultStorageSession();
}
Modified: trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp (204326 => 204327)
--- trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -29,6 +29,7 @@
#include "WebFrameNetworkingContext.h"
#include "WebResourceLoadScheduler.h"
#include <WebCore/BlobRegistryImpl.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/Page.h>
#include <WebCore/PageGroup.h>
#include <WebCore/PlatformCookieJar.h>
@@ -60,7 +61,7 @@
PasteboardStrategy* WebPlatformStrategies::createPasteboardStrategy()
{
- return 0;
+ return nullptr;
}
BlobRegistry* WebPlatformStrategies::createBlobRegistry()
Modified: trunk/Source/WebKit2/ChangeLog (204326 => 204327)
--- trunk/Source/WebKit2/ChangeLog 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-10 07:01:32 UTC (rev 204327)
@@ -1,3 +1,57 @@
+2016-08-09 Alex Christensen <achristen...@webkit.org>
+
+ Move NetworkStorageSession management to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160173
+
+ Reviewed by Brady Eidson.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::storageSession):
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::fetchWebsiteData):
+ (WebKit::NetworkProcess::deleteWebsiteData):
+ (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
+ * NetworkProcess/NetworkSession.h:
+ (WebKit::NetworkSession::sessionID):
+ NetworkSessions no longer own NetworkStorageSessions, but they should still have the same lifetime.
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]):
+ (WebKit::NetworkSession::setSourceApplicationAuditTokenData):
+ (WebKit::NetworkSession::create):
+ (WebKit::NetworkSession::defaultSession):
+ (WebKit::NetworkSession::NetworkSession):
+ (WebKit::NetworkSession::networkStorageSession):
+ (WebKit::NetworkSession::clearCredentials):
+ * NetworkProcess/mac/RemoteNetworkingContext.mm:
+ (WebKit::RemoteNetworkingContext::storageSession):
+ (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
+ * Shared/SessionTracker.cpp:
+ (WebKit::SessionTracker::networkSession):
+ (WebKit::SessionTracker::setSession):
+ (WebKit::SessionTracker::destroySession):
+ (WebKit::SessionTracker::storageSession): Deleted.
+ (WebKit::staticStorageSessionMap): Deleted.
+ (WebKit::SessionTracker::sessionID): Deleted.
+ (WebKit::SessionTracker::forEachNetworkStorageSession): Deleted.
+ * Shared/SessionTracker.h:
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::cookiesForDOM):
+ (WebKit::WebPlatformStrategies::setCookiesFromDOM):
+ (WebKit::WebPlatformStrategies::cookiesEnabled):
+ (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue):
+ (WebKit::WebPlatformStrategies::getRawCookies):
+ (WebKit::WebPlatformStrategies::deleteCookie):
+ (WebKit::WebPlatformStrategies::addCookie):
+ * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm:
+ (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+ (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
+ (WebKit::WebFrameNetworkingContext::storageSession):
+ * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp:
+ (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+ (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ * WebProcess/WebProcess.cpp:
+
2016-08-09 Anders Carlsson <ander...@apple.com>
Fix iOS build.
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (204326 => 204327)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -38,7 +38,7 @@
#include "RemoteNetworkingContext.h"
#include "SessionTracker.h"
#include "WebCoreArgumentCoders.h"
-#include <WebCore/NotImplemented.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PingHandle.h>
#include <WebCore/PlatformCookieJar.h>
#include <WebCore/ResourceLoaderOptions.h>
@@ -179,8 +179,7 @@
static NetworkStorageSession& storageSession(SessionID sessionID)
{
if (sessionID.isEphemeral()) {
- NetworkStorageSession* privateStorageSession = SessionTracker::storageSession(sessionID);
- if (privateStorageSession)
+ if (auto* privateStorageSession = NetworkStorageSession::storageSession(sessionID))
return *privateStorageSession;
// Some requests with private browsing mode requested may still be coming shortly after NetworkProcess was told to destroy its session.
// FIXME: Find a way to track private browsing sessions more rigorously.
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (204326 => 204327)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -52,6 +52,7 @@
#include <WebCore/DNS.h>
#include <WebCore/DiagnosticLoggingClient.h>
#include <WebCore/LogInitialization.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PlatformCookieJar.h>
#include <WebCore/ResourceRequest.h>
#include <WebCore/RuntimeApplicationChecks.h>
@@ -380,7 +381,7 @@
}));
if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
- if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
getHostnamesWithCookies(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithCookies);
}
@@ -395,13 +396,13 @@
{
#if PLATFORM(COCOA)
if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
- if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
clearHSTSCache(*networkStorageSession, modifiedSince);
}
#endif
if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
- if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
deleteAllCookiesModifiedSince(*networkStorageSession, modifiedSince);
}
@@ -454,7 +455,7 @@
void NetworkProcess::deleteWebsiteDataForOrigins(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID)
{
if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
- if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
+ if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
deleteCookiesForHostnames(*networkStorageSession, cookieHostNames);
}
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (204326 => 204327)
--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h 2016-08-10 07:01:32 UTC (rev 204327)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef NetworkSession_h
-#define NetworkSession_h
+#pragma once
#if PLATFORM(COCOA)
OBJC_CLASS NSURLSession;
@@ -55,7 +54,7 @@
Ephemeral
};
- static Ref<NetworkSession> create(Type, WebCore::SessionID, CustomProtocolManager*, std::unique_ptr<WebCore::NetworkStorageSession>);
+ static Ref<NetworkSession> create(Type, WebCore::SessionID, CustomProtocolManager*);
static NetworkSession& defaultSession();
~NetworkSession();
@@ -62,7 +61,6 @@
void invalidateAndCancel();
WebCore::SessionID sessionID() const { return m_sessionID; }
- WebCore::NetworkStorageSession& networkStorageSession();
static void setCustomProtocolManager(CustomProtocolManager*);
#if PLATFORM(COCOA)
@@ -78,10 +76,10 @@
DownloadID takeDownloadID(NetworkDataTask::TaskIdentifier);
private:
- NetworkSession(Type, WebCore::SessionID, CustomProtocolManager*, std::unique_ptr<WebCore::NetworkStorageSession>);
+ NetworkSession(Type, WebCore::SessionID, CustomProtocolManager*);
+ WebCore::NetworkStorageSession& networkStorageSession();
WebCore::SessionID m_sessionID;
- std::unique_ptr<WebCore::NetworkStorageSession> m_networkStorageSession;
HashMap<NetworkDataTask::TaskIdentifier, NetworkDataTask*> m_dataTaskMapWithCredentials;
HashMap<NetworkDataTask::TaskIdentifier, NetworkDataTask*> m_dataTaskMapWithoutCredentials;
@@ -96,5 +94,3 @@
};
} // namespace WebKit
-
-#endif // NetworkSession_h
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (204326 => 204327)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -186,7 +186,7 @@
WebCore::URL urlToStore;
if (authenticationChallenge.failureResponse().httpStatusCode() == 401)
urlToStore = authenticationChallenge.failureResponse().url();
- if (auto storageSession = WebKit::SessionTracker::storageSession(sessionID))
+ if (auto storageSession = WebCore::NetworkStorageSession::storageSession(sessionID))
storageSession->credentialStorage().set(nonPersistentCredential, authenticationChallenge.protectionSpace(), urlToStore);
else
ASSERT_NOT_REACHED();
@@ -345,21 +345,20 @@
globalSourceApplicationAuditTokenData() = data;
}
-Ref<NetworkSession> NetworkSession::create(Type type, WebCore::SessionID sessionID, CustomProtocolManager* customProtocolManager, std::unique_ptr<WebCore::NetworkStorageSession> networkStorageSession)
+Ref<NetworkSession> NetworkSession::create(Type type, WebCore::SessionID sessionID, CustomProtocolManager* customProtocolManager)
{
- return adoptRef(*new NetworkSession(type, sessionID, customProtocolManager, WTFMove(networkStorageSession)));
+ return adoptRef(*new NetworkSession(type, sessionID, customProtocolManager));
}
NetworkSession& NetworkSession::defaultSession()
{
ASSERT(isMainThread());
- static NetworkSession* session = &NetworkSession::create(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID(), globalCustomProtocolManager().get(), nullptr).leakRef();
+ static NetworkSession* session = &NetworkSession::create(NetworkSession::Type::Normal, WebCore::SessionID::defaultSessionID(), globalCustomProtocolManager().get()).leakRef();
return *session;
}
-NetworkSession::NetworkSession(Type type, WebCore::SessionID sessionID, CustomProtocolManager* customProtocolManager, std::unique_ptr<WebCore::NetworkStorageSession> networkStorageSession)
+NetworkSession::NetworkSession(Type type, WebCore::SessionID sessionID, CustomProtocolManager* customProtocolManager)
: m_sessionID(sessionID)
- , m_networkStorageSession(WTFMove(networkStorageSession))
{
relaxAdoptionRequirement();
@@ -380,14 +379,16 @@
setCollectsTimingData();
#endif
- if (m_networkStorageSession) {
- ASSERT(type == Type::Ephemeral);
- if (CFHTTPCookieStorageRef storage = m_networkStorageSession->cookieStorage().get())
- configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
- } else {
+ if (sessionID == WebCore::SessionID::defaultSessionID()) {
ASSERT(type == Type::Normal);
if (CFHTTPCookieStorageRef storage = WebCore::NetworkStorageSession::defaultStorageSession().cookieStorage().get())
configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
+ } else {
+ ASSERT(type == Type::Ephemeral);
+ auto* storageSession = WebCore::NetworkStorageSession::storageSession(sessionID);
+ RELEASE_ASSERT(storageSession);
+ if (CFHTTPCookieStorageRef storage = storageSession->cookieStorage().get())
+ configuration.HTTPCookieStorage = [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:storage] autorelease];
}
m_sessionWithCredentialStorageDelegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:*this withCredentials:true]);
@@ -412,9 +413,9 @@
WebCore::NetworkStorageSession& NetworkSession::networkStorageSession()
{
- if (!m_networkStorageSession)
- return WebCore::NetworkStorageSession::defaultStorageSession();
- return *m_networkStorageSession;
+ auto* storageSession = WebCore::NetworkStorageSession::storageSession(m_sessionID);
+ RELEASE_ASSERT(storageSession);
+ return *storageSession;
}
void NetworkSession::clearCredentials()
Modified: trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm (204326 => 204327)
--- trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -31,6 +31,7 @@
#import "NetworkSession.h"
#import "SessionTracker.h"
#import "WebErrors.h"
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/ResourceError.h>
#import <WebKitSystemInterface.h>
#import <wtf/MainThread.h>
@@ -57,8 +58,7 @@
NetworkStorageSession& RemoteNetworkingContext::storageSession() const
{
- NetworkStorageSession* session = SessionTracker::storageSession(m_sessionID);
- if (session)
+ if (auto session = NetworkStorageSession::storageSession(m_sessionID))
return *session;
// Some requests may still be coming shortly after NetworkProcess was told to destroy its session.
LOG_ERROR("Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
@@ -84,7 +84,7 @@
{
ASSERT(sessionID.isEphemeral());
- if (SessionTracker::storageSession(sessionID))
+ if (NetworkStorageSession::storageSession(sessionID))
return;
String base;
@@ -93,13 +93,11 @@
else
base = SessionTracker::getIdentifierBase();
- auto networkStorageSession = NetworkStorageSession::createPrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
+ NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
#if USE(NETWORK_SESSION)
- auto networkSession = NetworkSession::create(NetworkSession::Type::Ephemeral, sessionID, NetworkProcess::singleton().supplement<CustomProtocolManager>(), WTFMove(networkStorageSession));
+ auto networkSession = NetworkSession::create(NetworkSession::Type::Ephemeral, sessionID, NetworkProcess::singleton().supplement<CustomProtocolManager>());
SessionTracker::setSession(sessionID, WTFMove(networkSession));
-#else
- SessionTracker::setSession(sessionID, WTFMove(networkStorageSession));
#endif
}
Modified: trunk/Source/WebKit2/Shared/SessionTracker.cpp (204326 => 204327)
--- trunk/Source/WebKit2/Shared/SessionTracker.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/Shared/SessionTracker.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -71,48 +71,11 @@
return staticSessionMap().get(sessionID);
}
-NetworkStorageSession* SessionTracker::storageSession(SessionID sessionID)
-{
- auto session = SessionTracker::networkSession(sessionID);
- if (!session)
- return nullptr;
- return &session->networkStorageSession();
-}
-#else
-static HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>& staticStorageSessionMap()
-{
- ASSERT(RunLoop::isMain());
-
- static NeverDestroyed<HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>> map;
- return map;
-}
-
-NetworkStorageSession* SessionTracker::storageSession(SessionID sessionID)
-{
- if (sessionID == SessionID::defaultSessionID())
- return &NetworkStorageSession::defaultStorageSession();
- return staticStorageSessionMap().get(sessionID);
-}
-#endif
-
-SessionID SessionTracker::sessionID(const NetworkStorageSession& session)
-{
- return session.sessionID();
-}
-
-#if USE(NETWORK_SESSION)
void SessionTracker::setSession(SessionID sessionID, Ref<NetworkSession>&& session)
{
ASSERT(sessionID != SessionID::defaultSessionID());
staticSessionMap().set(sessionID, WTFMove(session));
}
-#else
-void SessionTracker::setSession(SessionID sessionID, std::unique_ptr<NetworkStorageSession> storageSession)
-{
- ASSERT(storageSession);
- ASSERT(sessionID != SessionID::defaultSessionID());
- staticStorageSessionMap().set(sessionID, WTFMove(storageSession));
-}
#endif
void SessionTracker::destroySession(SessionID sessionID)
@@ -122,21 +85,8 @@
auto session = staticSessionMap().take(sessionID);
if (session)
session->invalidateAndCancel();
-#else
- staticStorageSessionMap().remove(sessionID);
#endif
+ NetworkStorageSession::destroySession(sessionID);
}
-void SessionTracker::forEachNetworkStorageSession(std::function<void(const WebCore::NetworkStorageSession&)> functor)
-{
-#if USE(NETWORK_SESSION)
- for (auto& session : staticSessionMap().values())
- functor(session->networkStorageSession());
-#else
- for (auto& networkStorageSession : staticStorageSessionMap().values())
- functor(*networkStorageSession);
-#endif
-}
-
-
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/SessionTracker.h (204326 => 204327)
--- trunk/Source/WebKit2/Shared/SessionTracker.h 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/Shared/SessionTracker.h 2016-08-10 07:01:32 UTC (rev 204327)
@@ -44,26 +44,12 @@
public:
static const String& getIdentifierBase();
static void setIdentifierBase(const String&);
-
- static WebCore::NetworkStorageSession* storageSession(WebCore::SessionID);
- // FIXME: Remove uses of this as it is just a member access into NetworkStorageSession.
- static WebCore::SessionID sessionID(const WebCore::NetworkStorageSession&);
-
#if USE(NETWORK_SESSION)
static void setSession(WebCore::SessionID, Ref<NetworkSession>&&);
-#else
- static void setSession(WebCore::SessionID, std::unique_ptr<WebCore::NetworkStorageSession>);
+ static NetworkSession* networkSession(WebCore::SessionID);
#endif
static void destroySession(WebCore::SessionID);
-
-#if USE(NETWORK_SESSION)
- // FIXME: A NetworkSession and a NetworkStorageSession should be the same object once NETWORK_SESSION is used by default.
- static NetworkSession* networkSession(WebCore::SessionID);
-#endif
-
- // FIXME: This does not include the default network storage sesion in it's iteration.
- static void forEachNetworkStorageSession(std::function<void(const WebCore::NetworkStorageSession&)>);
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (204326 => 204327)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -108,7 +108,7 @@
String WebPlatformStrategies::cookiesForDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
String result;
- if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))
return String();
return result;
}
@@ -115,13 +115,13 @@
void WebPlatformStrategies::setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstParty, const URL& url, const String& cookieString)
{
- WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(SessionTracker::sessionID(session), firstParty, url, cookieString), 0);
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(session.sessionID(), firstParty, url, cookieString), 0);
}
bool WebPlatformStrategies::cookiesEnabled(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
bool result;
- if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))
return false;
return result;
}
@@ -128,7 +128,7 @@
String WebPlatformStrategies::cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const URL& firstParty, const URL& url)
{
- return cookieRequestHeaderFieldValue(SessionTracker::sessionID(session), firstParty, url);
+ return cookieRequestHeaderFieldValue(session.sessionID(), firstParty, url);
}
String WebPlatformStrategies::cookieRequestHeaderFieldValue(SessionID sessionID, const URL& firstParty, const URL& url)
@@ -141,7 +141,7 @@
bool WebPlatformStrategies::getRawCookies(const NetworkStorageSession& session, const URL& firstParty, const URL& url, Vector<Cookie>& rawCookies)
{
- if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(SessionTracker::sessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
+ if (!WebProcess::singleton().networkConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(session.sessionID(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))
return false;
return true;
}
@@ -148,12 +148,12 @@
void WebPlatformStrategies::deleteCookie(const NetworkStorageSession& session, const URL& url, const String& cookieName)
{
- WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(SessionTracker::sessionID(session), url, cookieName), 0);
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.sessionID(), url, cookieName), 0);
}
void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
{
- WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::AddCookie(SessionTracker::sessionID(session), url, cookie), 0);
+ WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::AddCookie(session.sessionID(), url, cookie), 0);
}
#if PLATFORM(COCOA)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (204326 => 204327)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -49,7 +49,7 @@
{
ASSERT(sessionID.isEphemeral());
- if (SessionTracker::storageSession(sessionID))
+ if (WebCore::NetworkStorageSession::storageSession(sessionID))
return;
String base;
@@ -58,12 +58,10 @@
else
base = SessionTracker::getIdentifierBase();
- auto networkStorageSession = NetworkStorageSession::createPrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
+ NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
#if USE(NETWORK_SESSION)
- auto networkSession = NetworkSession::create(NetworkSession::Type::Ephemeral, sessionID, nullptr, WTFMove(networkStorageSession));
+ auto networkSession = NetworkSession::create(NetworkSession::Type::Ephemeral, sessionID, nullptr);
SessionTracker::setSession(sessionID, WTFMove(networkSession));
-#else
- SessionTracker::setSession(sessionID, WTFMove(networkStorageSession));
#endif
}
@@ -71,10 +69,7 @@
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:static_cast<NSHTTPCookieAcceptPolicy>(policy)];
- if (RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage())
- CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
-
- SessionTracker::forEachNetworkStorageSession([&] (const NetworkStorageSession& networkStorageSession) {
+ NetworkStorageSession::forEach([&] (const NetworkStorageSession& networkStorageSession) {
CFHTTPCookieStorageSetCookieAcceptPolicy(networkStorageSession.cookieStorage().get(), policy);
});
}
@@ -110,7 +105,7 @@
{
ASSERT(RunLoop::isMain());
if (frame()) {
- if (auto* storageSession = SessionTracker::storageSession(frame()->page()->sessionID()))
+ if (auto* storageSession = WebCore::NetworkStorageSession::storageSession(frame()->page()->sessionID()))
return *storageSession;
// Some requests may still be coming shortly after WebProcess was told to destroy its session.
LOG_ERROR("Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp (204326 => 204327)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -45,10 +45,10 @@
{
ASSERT(isMainThread());
- if (SessionTracker::storageSession(sessionID))
+ if (NetworkStorageSession::storageSession(sessionID))
return;
- SessionTracker::setSession(sessionID, NetworkStorageSession::createPrivateBrowsingSession(sessionID, String::number(sessionID.sessionID())));
+ NetworkStorageSession::ensurePrivateBrowsingSession(sessionID, String::number(sessionID.sessionID()));
}
void WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy policy)
@@ -69,10 +69,7 @@
SoupCookieJar* cookieJar = WebCore::soupCookieJar();
soup_cookie_jar_set_accept_policy(cookieJar, soupPolicy);
- SoupNetworkSession& soupSession = NetworkStorageSession::defaultStorageSession().soupNetworkSession();
- soup_cookie_jar_set_accept_policy(soupSession.cookieJar(), soupPolicy);
-
- SessionTracker::forEachNetworkStorageSession([&] (const NetworkStorageSession& session) {
+ NetworkStorageSession::forEach([&] (const NetworkStorageSession& session) {
soup_cookie_jar_set_accept_policy(session.soupNetworkSession().cookieJar(), soupPolicy);
});
}
@@ -85,7 +82,7 @@
NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
if (frame() && frame()->page()->usesEphemeralSession())
- return *SessionTracker::storageSession(SessionID::legacyPrivateSessionID());
+ return *NetworkStorageSession::storageSession(SessionID::legacyPrivateSessionID());
return NetworkStorageSession::defaultStorageSession();
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (204326 => 204327)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2016-08-10 07:01:32 UTC (rev 204327)
@@ -70,6 +70,7 @@
#import <WebCore/KeyboardEvent.h>
#import <WebCore/MIMETypeRegistry.h>
#import <WebCore/MainFrame.h>
+#import <WebCore/NetworkStorageSession.h>
#import <WebCore/NetworkingContext.h>
#import <WebCore/Page.h>
#import <WebCore/PageOverlayController.h>
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (204326 => 204327)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-10 05:44:31 UTC (rev 204326)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-08-10 07:01:32 UTC (rev 204327)
@@ -86,6 +86,7 @@
#include <WebCore/MainFrame.h>
#include <WebCore/MemoryCache.h>
#include <WebCore/MemoryPressureHandler.h>
+#include <WebCore/NetworkStorageSession.h>
#include <WebCore/Page.h>
#include <WebCore/PageCache.h>
#include <WebCore/PageGroup.h>