Diff
Modified: trunk/LayoutTests/ChangeLog (201966 => 201967)
--- trunk/LayoutTests/ChangeLog 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/LayoutTests/ChangeLog 2016-06-11 11:09:54 UTC (rev 201967)
@@ -1,3 +1,15 @@
+2016-06-10 Antti Koivisto <[email protected]>
+
+ Vary:Cookie validation doesn't work in private browsing
+ https://bugs.webkit.org/show_bug.cgi?id=158616
+
+ Reviewed by Darin Adler.
+
+ * http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt:
+ * http/tests/cache/disk-cache/disk-cache-vary-cookie.html:
+
+ Exapand the existing test to cover memory cache and private browsing.
+
2016-06-10 Benjamin Poulain <[email protected]>
Add support for passive event listeners on touch events
Modified: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt (201966 => 201967)
--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie-expected.txt 2016-06-11 11:09:54 UTC (rev 201967)
@@ -1,8 +1,9 @@
-Test that Vary: Cookie in response is handled by the disk cache.
+Test that Vary: Cookie in response is handled by caches.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+Testing disk cache
Setting cookie and loading
response headers: {"Cache-control":"max-age=100"}
response source: Network
@@ -31,6 +32,64 @@
response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
response source: Disk cache
+Testing memory cache
+Setting cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Network
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
+Changing cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
+Testing memory cache in private browsing
+Setting cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Network
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
+Changing cookie and loading
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Network
+
+Loading again
+response headers: {"Cache-control":"max-age=100"}
+response source: Memory cache
+
+response headers: {"Vary":"Cookie","Cache-control":"max-age=100"}
+response source: Memory cache
+
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html (201966 => 201967)
--- trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/disk-cache-vary-cookie.html 2016-06-11 11:09:54 UTC (rev 201967)
@@ -3,32 +3,48 @@
<body>
<script>
-var tests =
-[
- { responseHeaders: {'Cache-control': 'max-age=100'} },
- { responseHeaders: {'Vary': 'Cookie', 'Cache-control': 'max-age=100'} },
-];
-description("Test that Vary: Cookie in response is handled by the disk cache.");
+description("Test that Vary: Cookie in response is handled by caches.");
-debug("Setting cookie and loading");
-document.cookie = "cookie=value";
-loadResources(tests, function () {
- printResults(tests);
- debug("Loading again");
- loadResources(tests, function () {
+function testCookies(testDiskCache, completionHandler)
+{
+ var tests = [
+ { responseHeaders: {'Cache-control': 'max-age=100'} },
+ { responseHeaders: {'Vary': 'Cookie', 'Cache-control': 'max-age=100'} },
+ ];
+
+ var options = { "ClearMemoryCache" : testDiskCache };
+ debug("Setting cookie and loading");
+ document.cookie = "cookie=" + Math.floor((Math.random() * 1000000000000));
+ loadResourcesWithOptions(tests, options, function () {
printResults(tests);
- debug("Changing cookie and loading");
- document.cookie = "cookie=othervalue";
- loadResources(tests, function () {
+ debug("Loading again");
+ loadResourcesWithOptions(tests, options, function () {
printResults(tests);
- debug("Loading again");
- loadResources(tests, function () {
- printResults(tests);
- finishJSTest();
+ debug("Changing cookie and loading");
+ document.cookie = "cookie" + Math.floor((Math.random() * 1000000000000));
+ loadResourcesWithOptions(tests, options, function () {
+ printResults(tests);
+ debug("Loading again");
+ loadResourcesWithOptions(tests, options, function () {
+ printResults(tests);
+ completionHandler();
+ });
});
});
});
+}
+
+debug("Testing disk cache");
+testCookies(true, function () {
+ debug("Testing memory cache");
+ testCookies(false, function () {
+ debug("Testing memory cache in private browsing");
+ testRunner.setPrivateBrowsingEnabled(true);
+ testCookies(false, function () {
+ finishJSTest();
+ });
+ });
});
</script>
Modified: trunk/Source/WebCore/CMakeLists.txt (201966 => 201967)
--- trunk/Source/WebCore/CMakeLists.txt 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-06-11 11:09:54 UTC (rev 201967)
@@ -2338,6 +2338,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 (201966 => 201967)
--- trunk/Source/WebCore/ChangeLog 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/ChangeLog 2016-06-11 11:09:54 UTC (rev 201967)
@@ -1,3 +1,55 @@
+2016-06-10 Antti Koivisto <[email protected]>
+
+ Vary:Cookie validation doesn't work in private browsing
+ https://bugs.webkit.org/show_bug.cgi?id=158616
+ rdar://problem/26755067
+
+ Reviewed by Darin Adler.
+
+ This wasn't implemented because there was no way to get NetworkStorageSession from
+ a SessionID on WebCore side.
+
+ The patch adds a simple WebCore level weak map that allows getting NetworkStorageSessions
+ from SessionID. This seemed like the cleanest way to do this without a big refactoring
+ around the currently WebKit2 level SessionTracker.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/network/CacheValidation.cpp:
+ (WebCore::headerValueForVary):
+
+ Get NetworkStorageSession from SessionID for cookies
+
+ (WebCore::verifyVaryingRequestHeaders):
+ * platform/network/NetworkStorageSession.cpp: Added.
+
+ Add platform independent .cpp for NetworkStorageSession.
+ Implement a weak map for SessionID -> NetworkStorageSession.
+
+ (WebCore::sessionsMap):
+ (WebCore::NetworkStorageSession::NetworkStorageSession):
+ (WebCore::NetworkStorageSession::~NetworkStorageSession):
+ (WebCore::NetworkStorageSession::forSessionID):
+
+ Get NetworkStorageSession for sessionID.
+
+ * platform/network/NetworkStorageSession.h:
+ (WebCore::NetworkStorageSession::sessionID):
+ (WebCore::NetworkStorageSession::credentialStorage):
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::NetworkStorageSession::NetworkStorageSession):
+
+ Call to common constructor.
+
+ (WebCore::defaultNetworkStorageSession):
+ * platform/network/soup/NetworkStorageSessionSoup.cpp:
+ (WebCore::NetworkStorageSession::NetworkStorageSession):
+
+ Call to common constructor.
+
+ (WebCore::defaultSession):
+ (WebCore::NetworkStorageSession::~NetworkStorageSession): Deleted.
+
2016-06-10 Ada Chan <[email protected]>
Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201966 => 201967)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-11 11:09:54 UTC (rev 201967)
@@ -6733,6 +6733,7 @@
E4E9B11D1814569C003ACCDF /* SimpleLineLayoutFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */; };
E4F9EEF2156D9FFA00D23E7E /* StyleSheetContents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4F9EEF0156D84C400D23E7E /* StyleSheetContents.cpp */; };
E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E4FD02041D0AF2C100D8E57E /* NetworkStorageSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4FD02031D0AF2C100D8E57E /* NetworkStorageSession.cpp */; };
E51A81DF17298D7700BFCA61 /* JSPerformance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E51A81DE17298D7700BFCA61 /* JSPerformance.cpp */; };
E526AF3F1727F8F200E41781 /* Performance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E526AF3E1727F8F200E41781 /* Performance.cpp */; };
E55F497A151B888000BB67DB /* LengthFunctions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E55F4979151B888000BB67DB /* LengthFunctions.cpp */; };
@@ -14818,6 +14819,7 @@
E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFunctions.h; sourceTree = "<group>"; };
E4F9EEF0156D84C400D23E7E /* StyleSheetContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheetContents.cpp; sourceTree = "<group>"; };
E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSheetContents.h; sourceTree = "<group>"; };
+ E4FD02031D0AF2C100D8E57E /* NetworkStorageSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkStorageSession.cpp; sourceTree = "<group>"; };
E51A81DE17298D7700BFCA61 /* JSPerformance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPerformance.cpp; sourceTree = "<group>"; };
E526AF3E1727F8F200E41781 /* Performance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Performance.cpp; sourceTree = "<group>"; };
E55F4979151B888000BB67DB /* LengthFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthFunctions.cpp; sourceTree = "<group>"; };
@@ -17806,6 +17808,7 @@
628D214B12131ED10055DCFC /* NetworkingContext.h */,
1A7FA61A0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp */,
1A7FA6180DDA3B3A0028F8A5 /* NetworkStateNotifier.h */,
+ E4FD02031D0AF2C100D8E57E /* NetworkStorageSession.cpp */,
E13EF3421684ECF40034C83F /* NetworkStorageSession.h */,
CDCD41E51C3DDB0900965D99 /* ParsedContentRange.cpp */,
CDCD41E61C3DDB0900965D99 /* ParsedContentRange.h */,
@@ -32190,6 +32193,7 @@
A55639D21C6F09E700806D8E /* WorkerConsoleClient.cpp in Sources */,
A3E2643014748991005A8588 /* WorkerEventQueue.cpp in Sources */,
2E4346480F546A8200B0F1BA /* WorkerGlobalScope.cpp in Sources */,
+ E4FD02041D0AF2C100D8E57E /* NetworkStorageSession.cpp in Sources */,
418C395A1C8DD6990051C8A3 /* WorkerGlobalScopeFetch.cpp in Sources */,
5185FCB31BB4C4E80012898F /* WorkerGlobalScopeIndexedDatabase.cpp in Sources */,
97F8E665151D4A4B00D2D181 /* WorkerGlobalScopeNotifications.cpp in Sources */,
Modified: trunk/Source/WebCore/platform/network/CacheValidation.cpp (201966 => 201967)
--- trunk/Source/WebCore/platform/network/CacheValidation.cpp 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/platform/network/CacheValidation.cpp 2016-06-11 11:09:54 UTC (rev 201967)
@@ -338,11 +338,7 @@
// We could fetch the cookie when making the request but that seems overkill as the case is very rare and it
// is a blocking operation. This should be sufficient to cover reasonable cases.
if (headerName == httpHeaderNameString(HTTPHeaderName::Cookie)) {
- if (sessionID != SessionID::defaultSessionID()) {
- // FIXME: Don't know how to get the cookie. There should be a global way to get NetworkStorageSession from sessionID.
- return "";
- }
- auto& session = NetworkStorageSession::defaultStorageSession();
+ auto& session = NetworkStorageSession::forSessionID(sessionID);
auto* cookieStrategy = platformStrategies() ? platformStrategies()->cookiesStrategy() : nullptr;
if (!cookieStrategy)
return cookieRequestHeaderFieldValue(session, request.firstPartyForCookies(), request.url());
@@ -374,10 +370,6 @@
// FIXME: Vary: * in response would ideally trigger a cache delete instead of a store.
if (varyingRequestHeader.first == "*")
return false;
- if (sessionID != SessionID::defaultSessionID() && varyingRequestHeader.first == httpHeaderNameString(HTTPHeaderName::Cookie)) {
- // FIXME: See the comment in headerValueForVary.
- return false;
- }
String headerValue = headerValueForVary(request, varyingRequestHeader.first, sessionID);
if (headerValue != varyingRequestHeader.second)
return false;
Added: trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (0 => 201967)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (rev 0)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2016-06-11 11:09:54 UTC (rev 201967)
@@ -0,0 +1,90 @@
+/*
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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 <wtf/HashMap.h>
+#include <wtf/MainThread.h>
+#include <wtf/NeverDestroyed.h>
+
+#if USE(SOUP)
+#include "SoupNetworkSession.h"
+#endif
+
+namespace WebCore {
+
+static std::unique_ptr<NetworkStorageSession>& defaultSession()
+{
+ ASSERT(isMainThread());
+ static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;
+ return session;
+}
+
+static HashMap<SessionID, NetworkStorageSession*>& sessionsMap()
+{
+ static NeverDestroyed<HashMap<SessionID, NetworkStorageSession*>> map;
+ return map;
+}
+
+NetworkStorageSession::NetworkStorageSession(SessionID sessionID)
+ : m_sessionID(sessionID)
+{
+ if (sessionID == SessionID::defaultSessionID())
+ return;
+ ASSERT(!sessionsMap().contains(sessionID));
+ sessionsMap().add(sessionID, this);
+}
+
+NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
+{
+ if (!defaultSession())
+ defaultSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), nullptr);
+ return *defaultSession();
+}
+
+NetworkStorageSession::~NetworkStorageSession()
+{
+ if (m_sessionID == SessionID::defaultSessionID())
+ return;
+ ASSERT(sessionsMap().contains(m_sessionID));
+ sessionsMap().remove(m_sessionID);
+}
+
+NetworkStorageSession& NetworkStorageSession::forSessionID(SessionID sessionID)
+{
+ if (sessionID == SessionID::defaultSessionID())
+ return defaultStorageSession();
+
+ ASSERT(sessionsMap().contains(sessionID));
+ return *sessionsMap().get(sessionID);
+}
+
+void NetworkStorageSession::replaceDefaultSession(std::unique_ptr<NetworkStorageSession> newDefaultSession)
+{
+ defaultSession() = WTFMove(newDefaultSession);
+}
+
+};
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (201966 => 201967)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2016-06-11 11:09:54 UTC (rev 201967)
@@ -37,7 +37,6 @@
namespace WebCore {
-class NetworkingContext;
class ResourceRequest;
class SoupNetworkSession;
@@ -49,37 +48,37 @@
WEBCORE_EXPORT static void switchToNewTestingSession();
+ static NetworkStorageSession& forSessionID(SessionID);
+
+ WEBCORE_EXPORT ~NetworkStorageSession();
+
SessionID sessionID() const { return m_sessionID; }
CredentialStorage& credentialStorage() { return m_credentialStorage; }
#if PLATFORM(COCOA) || USE(CFNETWORK)
- NetworkStorageSession(SessionID, RetainPtr<CFURLStorageSessionRef>);
+ NetworkStorageSession(SessionID, RetainPtr<CFURLStorageSessionRef>&&);
// May be null, in which case a Foundation default should be used.
CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
WEBCORE_EXPORT RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const;
#elif USE(SOUP)
NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>);
- ~NetworkStorageSession();
SoupNetworkSession& soupNetworkSession() const;
void setSoupNetworkSession(std::unique_ptr<SoupNetworkSession>);
-#else
- NetworkStorageSession(SessionID, NetworkingContext*);
- ~NetworkStorageSession();
-
- NetworkingContext* context() const;
#endif
private:
+ explicit NetworkStorageSession(SessionID);
+
+ static void replaceDefaultSession(std::unique_ptr<NetworkStorageSession>);
+
SessionID m_sessionID;
#if PLATFORM(COCOA) || USE(CFNETWORK)
RetainPtr<CFURLStorageSessionRef> m_platformSession;
#elif USE(SOUP)
std::unique_ptr<SoupNetworkSession> m_session;
-#else
- RefPtr<NetworkingContext> m_context;
#endif
CredentialStorage m_credentialStorage;
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (201966 => 201967)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2016-06-11 11:09:54 UTC (rev 201967)
@@ -41,37 +41,23 @@
namespace WebCore {
-NetworkStorageSession::NetworkStorageSession(SessionID sessionID, RetainPtr<CFURLStorageSessionRef> platformSession)
- : m_sessionID(sessionID)
- , m_platformSession(platformSession)
+NetworkStorageSession::NetworkStorageSession(SessionID sessionID, RetainPtr<CFURLStorageSessionRef>&& platformSession)
+ : NetworkStorageSession(sessionID)
{
+ m_platformSession = WTFMove(platformSession);
}
-static std::unique_ptr<NetworkStorageSession>& defaultNetworkStorageSession()
-{
- ASSERT(isMainThread());
- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;
- return session;
-}
-
void NetworkStorageSession::switchToNewTestingSession()
{
// Session name should be short enough for shared memory region name to be under the limit, otehrwise sandbox rules won't work (see <rdar://problem/13642852>).
String sessionName = String::format("WebKit Test-%u", static_cast<uint32_t>(getCurrentProcessID()));
#if PLATFORM(COCOA)
- defaultNetworkStorageSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), adoptCF(wkCreatePrivateStorageSession(sessionName.createCFString().get())));
+ replaceDefaultSession(std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), adoptCF(wkCreatePrivateStorageSession(sessionName.createCFString().get()))));
#else
- defaultNetworkStorageSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), adoptCF(wkCreatePrivateStorageSession(sessionName.createCFString().get(), defaultNetworkStorageSession()->platformSession())));
+ replaceDefaultSession(std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), adoptCF(wkCreatePrivateStorageSession(sessionName.createCFString().get(), defaultNetworkStorageSession()->platformSession()))));
#endif
}
-NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
-{
- if (!defaultNetworkStorageSession())
- defaultNetworkStorageSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), nullptr);
- return *defaultNetworkStorageSession();
-}
-
std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(SessionID sessionID, const String& identifierBase)
{
RetainPtr<CFStringRef> cfIdentifier = String(identifierBase + ".PrivateBrowsing").createCFString();
@@ -79,7 +65,7 @@
#if PLATFORM(COCOA)
auto session = std::make_unique<NetworkStorageSession>(sessionID, adoptCF(wkCreatePrivateStorageSession(cfIdentifier.get())));
#else
- auto session = std::make_unique<NetworkStorageSession>(sessionID, adoptCF(wkCreatePrivateStorageSession(cfIdentifier.get(), defaultNetworkStorageSession()->platformSession())));
+ auto session = std::make_unique<NetworkStorageSession>(sessionID, adoptCF(wkCreatePrivateStorageSession(cfIdentifier.get(), defaultStorageSession().platformSession())));
#endif
return session;
Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (201966 => 201967)
--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2016-06-11 06:01:48 UTC (rev 201966)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2016-06-11 11:09:54 UTC (rev 201967)
@@ -37,29 +37,11 @@
namespace WebCore {
NetworkStorageSession::NetworkStorageSession(SessionID sessionID, std::unique_ptr<SoupNetworkSession> session)
- : m_sessionID(sessionID)
- , m_session(WTFMove(session))
+ : NetworkStorageSession(sessionID)
{
+ m_session = WTFMove(session);
}
-NetworkStorageSession::~NetworkStorageSession()
-{
-}
-
-static std::unique_ptr<NetworkStorageSession>& defaultSession()
-{
- ASSERT(isMainThread());
- static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;
- return session;
-}
-
-NetworkStorageSession& NetworkStorageSession::defaultStorageSession()
-{
- if (!defaultSession())
- defaultSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), nullptr);
- return *defaultSession();
-}
-
std::unique_ptr<NetworkStorageSession> NetworkStorageSession::createPrivateBrowsingSession(SessionID sessionID, const String&)
{
auto session = std::make_unique<NetworkStorageSession>(sessionID, SoupNetworkSession::createPrivateBrowsingSession());
@@ -68,7 +50,7 @@
void NetworkStorageSession::switchToNewTestingSession()
{
- defaultSession() = std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), SoupNetworkSession::createTestingSession());
+ replaceDefaultSession(std::make_unique<NetworkStorageSession>(SessionID::defaultSessionID(), SoupNetworkSession::createTestingSession()));
}
SoupNetworkSession& NetworkStorageSession::soupNetworkSession() const