Changeset 162271 in webkit
- Timestamp:
- Jan 18, 2014 1:14:42 PM (10 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 31 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/CMakeLists.txt
r162245 r162271 205 205 Shared/SecurityOriginData.cpp 206 206 Shared/SessionState.cpp 207 Shared/SessionTracker.cpp 207 208 Shared/ShareableBitmap.cpp 208 209 Shared/ShareableResource.cpp … … 294 295 295 296 UIProcess/APINavigationData.cpp 297 UIProcess/APISession.cpp 296 298 UIProcess/BackingStore.cpp 297 299 UIProcess/DrawingAreaProxy.cpp -
trunk/Source/WebKit2/ChangeLog
r162264 r162271 1 2014-01-18 Martin Hock <mhock@apple.com> 2 3 Flesh out session APIs (still not enabled at API level). 4 https://bugs.webkit.org/show_bug.cgi?id=126918 5 6 Reviewed by Alexey Proskuryakov. 7 8 * CMakeLists.txt: 9 * GNUmakefile.list.am: 10 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 11 (WebKit::storageSession): 12 (WebKit::NetworkConnectionToWebProcess::startDownload): 13 (WebKit::NetworkConnectionToWebProcess::cookiesForDOM): 14 (WebKit::NetworkConnectionToWebProcess::setCookiesFromDOM): 15 (WebKit::NetworkConnectionToWebProcess::cookiesEnabled): 16 (WebKit::NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue): 17 (WebKit::NetworkConnectionToWebProcess::getRawCookies): 18 (WebKit::NetworkConnectionToWebProcess::deleteCookie): 19 * NetworkProcess/NetworkConnectionToWebProcess.h: 20 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 21 * NetworkProcess/NetworkProcess.cpp: 22 (WebKit::NetworkProcess::initializeNetworkProcess): 23 (WebKit::NetworkProcess::ensurePrivateBrowsingSession): 24 (WebKit::NetworkProcess::destroyPrivateBrowsingSession): 25 * NetworkProcess/NetworkProcess.h: 26 * NetworkProcess/NetworkProcess.messages.in: 27 * NetworkProcess/RemoteNetworkingContext.h: 28 * NetworkProcess/mac/RemoteNetworkingContext.mm: 29 (WebKit::RemoteNetworkingContext::storageSession): 30 (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): 31 * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp: 32 (WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession): 33 * Shared/SessionTracker.cpp: Copied from Source/WebKit2/UIProcess/APISession.cpp. 34 (WebKit::sessionMap): 35 (WebKit::identifierBase): 36 (WebKit::SessionTracker::getSessionMap): 37 (WebKit::SessionTracker::getIdentifierBase): 38 (WebKit::SessionTracker::session): 39 (WebKit::SessionTracker::destroySession): 40 (WebKit::SessionTracker::setIdentifierBase): 41 * Shared/SessionTracker.h: Copied from Source/WebKit2/UIProcess/APISession.h. 42 (WebKit::SessionTracker::isEphemeralID): 43 * Shared/mac/CookieStorageShim.cpp: 44 (WebKit::webKitCookieStorageCopyRequestHeaderFieldsForURL): 45 * UIProcess/APISession.cpp: 46 (API::generateID): 47 (API::Session::defaultSession): 48 (API::Session::legacyPrivateSession): 49 (API::Session::Session): 50 (API::Session::create): 51 (API::Session::isEphemeral): 52 (API::Session::getID): 53 * UIProcess/APISession.h: 54 * UIProcess/WebContext.cpp: 55 (WebKit::WebContext::setAnyPageGroupMightHavePrivateBrowsingEnabled): 56 (WebKit::WebContext::createNewWebProcess): 57 (WebKit::WebContext::createWebPage): 58 * UIProcess/WebContext.h: 59 * UIProcess/WebPageProxy.cpp: 60 (WebKit::WebPageProxy::create): 61 (WebKit::WebPageProxy::WebPageProxy): 62 * UIProcess/WebPageProxy.h: 63 (WebKit::WebPageProxy::sessionID): 64 * UIProcess/WebProcessProxy.cpp: 65 (WebKit::WebProcessProxy::createWebPage): 66 * UIProcess/WebProcessProxy.h: 67 * WebKit2.xcodeproj/project.pbxproj: 68 * WebProcess/InjectedBundle/InjectedBundle.cpp: 69 (WebKit::InjectedBundle::setPrivateBrowsingEnabled): 70 * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: 71 (WebKit::legacySessionID): 72 (WebKit::WebPlatformStrategies::cookiesForDOM): 73 (WebKit::WebPlatformStrategies::setCookiesFromDOM): 74 (WebKit::WebPlatformStrategies::cookiesEnabled): 75 (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): 76 (WebKit::WebPlatformStrategies::getRawCookies): 77 (WebKit::WebPlatformStrategies::deleteCookie): 78 * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h: 79 * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: 80 (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): 81 (WebKit::WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts): 82 (WebKit::WebFrameNetworkingContext::storageSession): 83 * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp: 84 (WebKit::WebFrameNetworkingContext::ensurePrivateBrowsingSession): 85 (WebKit::WebFrameNetworkingContext::storageSession): 86 * WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h: 87 * WebProcess/WebProcess.cpp: 88 (WebKit::WebProcess::initializeWebProcess): 89 (WebKit::WebProcess::ensurePrivateBrowsingSession): 90 (WebKit::WebProcess::destroyPrivateBrowsingSession): 91 * WebProcess/WebProcess.h: 92 * WebProcess/WebProcess.messages.in: 93 1 94 2014-01-18 Brian Burg <bburg@apple.com> 2 95 -
trunk/Source/WebKit2/GNUmakefile.list.am
r162245 r162271 443 443 Source/WebKit2/Shared/SessionState.cpp \ 444 444 Source/WebKit2/Shared/SessionState.h \ 445 Source/WebKit2/Shared/SessionTracker.cpp \ 446 Source/WebKit2/Shared/SessionTracker.h \ 445 447 Source/WebKit2/Shared/StatisticsData.cpp \ 446 448 Source/WebKit2/Shared/StatisticsData.h \ -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
r162245 r162271 38 38 #include "NetworkResourceLoaderMessages.h" 39 39 #include "RemoteNetworkingContext.h" 40 #include "SessionTracker.h" 40 41 #include <WebCore/BlobData.h> 41 42 #include <WebCore/PlatformCookieJar.h> … … 148 149 } 149 150 150 static NetworkStorageSession& storageSession( bool privateBrowsingEnabled)151 { 152 if ( privateBrowsingEnabled) {153 NetworkStorageSession* privateSession = RemoteNetworkingContext::privateBrowsingSession();151 static NetworkStorageSession& storageSession(uint64_t sessionID) 152 { 153 if (SessionTracker::isEphemeralID(sessionID)) { 154 NetworkStorageSession* privateSession = SessionTracker::session(sessionID).get(); 154 155 if (privateSession) 155 156 return *privateSession; … … 161 162 } 162 163 163 void NetworkConnectionToWebProcess::startDownload( bool privateBrowsingEnabled, uint64_t downloadID, const ResourceRequest& request)164 { 165 // FIXME: Do something with the private browsing flag.164 void NetworkConnectionToWebProcess::startDownload(uint64_t sessionID, uint64_t downloadID, const ResourceRequest& request) 165 { 166 // FIXME: Do something with the session ID. 166 167 NetworkProcess::shared().downloadManager().startDownload(downloadID, request); 167 168 } … … 183 184 } 184 185 185 void NetworkConnectionToWebProcess::cookiesForDOM( bool privateBrowsingEnabled, const URL& firstParty, const URL& url, String& result)186 { 187 result = WebCore::cookiesForDOM(storageSession( privateBrowsingEnabled), firstParty, url);188 } 189 190 void NetworkConnectionToWebProcess::setCookiesFromDOM( bool privateBrowsingEnabled, const URL& firstParty, const URL& url, const String& cookieString)191 { 192 WebCore::setCookiesFromDOM(storageSession( privateBrowsingEnabled), firstParty, url, cookieString);193 } 194 195 void NetworkConnectionToWebProcess::cookiesEnabled( bool privateBrowsingEnabled, const URL& firstParty, const URL& url, bool& result)196 { 197 result = WebCore::cookiesEnabled(storageSession( privateBrowsingEnabled), firstParty, url);198 } 199 200 void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue( bool privateBrowsingEnabled, const URL& firstParty, const URL& url, String& result)201 { 202 result = WebCore::cookieRequestHeaderFieldValue(storageSession( privateBrowsingEnabled), firstParty, url);203 } 204 205 void NetworkConnectionToWebProcess::getRawCookies( bool privateBrowsingEnabled, const URL& firstParty, const URL& url, Vector<Cookie>& result)206 { 207 WebCore::getRawCookies(storageSession( privateBrowsingEnabled), firstParty, url, result);208 } 209 210 void NetworkConnectionToWebProcess::deleteCookie( bool privateBrowsingEnabled, const URL& url, const String& cookieName)211 { 212 WebCore::deleteCookie(storageSession( privateBrowsingEnabled), url, cookieName);186 void NetworkConnectionToWebProcess::cookiesForDOM(uint64_t sessionID, const URL& firstParty, const URL& url, String& result) 187 { 188 result = WebCore::cookiesForDOM(storageSession(sessionID), firstParty, url); 189 } 190 191 void NetworkConnectionToWebProcess::setCookiesFromDOM(uint64_t sessionID, const URL& firstParty, const URL& url, const String& cookieString) 192 { 193 WebCore::setCookiesFromDOM(storageSession(sessionID), firstParty, url, cookieString); 194 } 195 196 void NetworkConnectionToWebProcess::cookiesEnabled(uint64_t sessionID, const URL& firstParty, const URL& url, bool& result) 197 { 198 result = WebCore::cookiesEnabled(storageSession(sessionID), firstParty, url); 199 } 200 201 void NetworkConnectionToWebProcess::cookieRequestHeaderFieldValue(uint64_t sessionID, const URL& firstParty, const URL& url, String& result) 202 { 203 result = WebCore::cookieRequestHeaderFieldValue(storageSession(sessionID), firstParty, url); 204 } 205 206 void NetworkConnectionToWebProcess::getRawCookies(uint64_t sessionID, const URL& firstParty, const URL& url, Vector<Cookie>& result) 207 { 208 WebCore::getRawCookies(storageSession(sessionID), firstParty, url, result); 209 } 210 211 void NetworkConnectionToWebProcess::deleteCookie(uint64_t sessionID, const URL& url, const String& cookieName) 212 { 213 WebCore::deleteCookie(storageSession(sessionID), url, cookieName); 213 214 } 214 215 -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
r162245 r162271 77 77 void servePendingRequests(uint32_t resourceLoadPriority); 78 78 void setSerialLoadingEnabled(bool); 79 void startDownload( bool privateBrowsingEnabled, uint64_t downloadID, const WebCore::ResourceRequest&);79 void startDownload(uint64_t sessionID, uint64_t downloadID, const WebCore::ResourceRequest&); 80 80 void convertMainResourceLoadToDownload(uint64_t mainResourceLoadIdentifier, uint64_t downloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); 81 81 82 void cookiesForDOM( bool privateBrowsingEnabled, const WebCore::URL& firstParty, const WebCore::URL&, String& result);83 void setCookiesFromDOM( bool privateBrowsingEnabled, const WebCore::URL& firstParty, const WebCore::URL&, const String&);84 void cookiesEnabled( bool privateBrowsingEnabled, const WebCore::URL& firstParty, const WebCore::URL&, bool& result);85 void cookieRequestHeaderFieldValue( bool privateBrowsingEnabled, const WebCore::URL& firstParty, const WebCore::URL&, String& result);86 void getRawCookies( bool privateBrowsingEnabled, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&);87 void deleteCookie( bool privateBrowsingEnabled, const WebCore::URL&, const String& cookieName);82 void cookiesForDOM(uint64_t sessionID, const WebCore::URL& firstParty, const WebCore::URL&, String& result); 83 void setCookiesFromDOM(uint64_t sessionID, const WebCore::URL& firstParty, const WebCore::URL&, const String&); 84 void cookiesEnabled(uint64_t sessionID, const WebCore::URL& firstParty, const WebCore::URL&, bool& result); 85 void cookieRequestHeaderFieldValue(uint64_t sessionID, const WebCore::URL& firstParty, const WebCore::URL&, String& result); 86 void getRawCookies(uint64_t sessionID, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&); 87 void deleteCookie(uint64_t sessionID, const WebCore::URL&, const String& cookieName); 88 88 89 89 void registerBlobURL(const WebCore::URL&, const BlobRegistrationData&); -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r162245 r162271 33 33 SetSerialLoadingEnabled(bool enabled) -> () 34 34 35 StartDownload( bool privateBrowsingEnabled, uint64_t downloadID, WebCore::ResourceRequest request)35 StartDownload(uint64_t sessionID, uint64_t downloadID, WebCore::ResourceRequest request) 36 36 ConvertMainResourceLoadToDownload(uint64_t mainResourceLoadIdentifier, uint64_t downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response) 37 37 38 CookiesForDOM( bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -> (String result)39 SetCookiesFromDOM( bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url, String cookieString)40 CookiesEnabled( bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -> (bool enabled)41 CookieRequestHeaderFieldValue( bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -> (String result)42 GetRawCookies( bool privateBrowsingEnabled, WebCore::URL firstParty, WebCore::URL url) -> (Vector<WebCore::Cookie> cookies)43 DeleteCookie( bool privateBrowsingEnabled, WebCore::URL url, String cookieName)38 CookiesForDOM(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -> (String result) 39 SetCookiesFromDOM(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url, String cookieString) 40 CookiesEnabled(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -> (bool enabled) 41 CookieRequestHeaderFieldValue(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -> (String result) 42 GetRawCookies(uint64_t sessionID, WebCore::URL firstParty, WebCore::URL url) -> (Vector<WebCore::Cookie> cookies) 43 DeleteCookie(uint64_t sessionID, WebCore::URL url, String cookieName) 44 44 45 45 RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data) -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp
r162245 r162271 40 40 #include "NetworkResourceLoader.h" 41 41 #include "RemoteNetworkingContext.h" 42 #include "SessionTracker.h" 42 43 #include "StatisticsData.h" 43 44 #include "WebContextMessages.h" … … 158 159 159 160 #if PLATFORM(MAC) || USE(CFNETWORK) 160 RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); 161 #endif 162 161 SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier); 162 #endif 163 164 // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions) 163 165 if (parameters.privateBrowsingEnabled) 164 RemoteNetworkingContext::ensurePrivateBrowsingSession( );166 RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID); 165 167 166 168 if (parameters.shouldUseTestingNetworkSession) … … 213 215 } 214 216 215 void NetworkProcess::ensurePrivateBrowsingSession( )216 { 217 RemoteNetworkingContext::ensurePrivateBrowsingSession( );218 } 219 220 void NetworkProcess::destroyPrivateBrowsingSession( )221 { 222 RemoteNetworkingContext::destroyPrivateBrowsingSession();217 void NetworkProcess::ensurePrivateBrowsingSession(uint64_t sessionID) 218 { 219 RemoteNetworkingContext::ensurePrivateBrowsingSession(sessionID); 220 } 221 222 void NetworkProcess::destroyPrivateBrowsingSession(uint64_t sessionID) 223 { 224 SessionTracker::destroySession(sessionID); 223 225 } 224 226 -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h
r162245 r162271 105 105 void initializeNetworkProcess(const NetworkProcessCreationParameters&); 106 106 void createNetworkConnectionToWebProcess(); 107 void ensurePrivateBrowsingSession( );108 void destroyPrivateBrowsingSession( );107 void ensurePrivateBrowsingSession(uint64_t sessionID); 108 void destroyPrivateBrowsingSession(uint64_t sessionID); 109 109 void downloadRequest(uint64_t downloadID, const WebCore::ResourceRequest&); 110 110 void cancelDownload(uint64_t downloadID); -
trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in
r162245 r162271 35 35 #endif 36 36 37 EnsurePrivateBrowsingSession( )38 DestroyPrivateBrowsingSession( )37 EnsurePrivateBrowsingSession(uint64_t sessionID) 38 DestroyPrivateBrowsingSession(uint64_t sessionID) 39 39 40 40 DownloadRequest(uint64_t downloadID, WebCore::ResourceRequest request) -
trunk/Source/WebKit2/NetworkProcess/RemoteNetworkingContext.h
r162245 r162271 40 40 virtual ~RemoteNetworkingContext(); 41 41 42 static void setPrivateBrowsingStorageSessionIdentifierBase(const String&); 43 static void ensurePrivateBrowsingSession(); 44 static void destroyPrivateBrowsingSession(); 45 46 static WebCore::NetworkStorageSession* privateBrowsingSession(); 42 // FIXME: remove platform-specific code and use SessionTracker 43 static void ensurePrivateBrowsingSession(uint64_t sessionID); 47 44 48 45 virtual bool shouldClearReferrerOnHTTPSToHTTPRedirect() const override { return m_shouldClearReferrerOnHTTPSToHTTPRedirect; } -
trunk/Source/WebKit2/NetworkProcess/mac/RemoteNetworkingContext.mm
r162245 r162271 27 27 #import "RemoteNetworkingContext.h" 28 28 29 #import "SessionTracker.h" 29 30 #import "WebErrors.h" 30 31 #import <WebCore/ResourceError.h> … … 37 38 namespace WebKit { 38 39 39 static std::unique_ptr<NetworkStorageSession>& privateBrowsingStorageSession()40 {41 ASSERT(isMainThread());42 static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session;43 return session;44 }45 40 46 41 RemoteNetworkingContext::~RemoteNetworkingContext() … … 66 61 { 67 62 if (m_privateBrowsingEnabled) { 68 NetworkStorageSession* privateSession = privateBrowsingStorageSession().get();63 NetworkStorageSession* privateSession = SessionTracker::session(SessionTracker::legacyPrivateSessionID).get(); 69 64 if (privateSession) 70 65 return *privateSession; … … 75 70 76 71 return NetworkStorageSession::defaultStorageSession(); 77 }78 79 NetworkStorageSession* RemoteNetworkingContext::privateBrowsingSession()80 {81 return privateBrowsingStorageSession().get();82 72 } 83 73 … … 92 82 } 93 83 94 static String& privateBrowsingStorageSessionIdentifierBase()84 void RemoteNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 95 85 { 96 ASSERT(isMainThread()); 97 static NeverDestroyed<String> base; 98 return base; 99 } 100 101 void RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String& identifier) 102 { 103 privateBrowsingStorageSessionIdentifierBase() = identifier; 104 } 105 106 void RemoteNetworkingContext::ensurePrivateBrowsingSession() 107 { 108 if (privateBrowsingStorageSession()) 86 if (SessionTracker::session(sessionID)) 109 87 return; 110 88 111 ASSERT(!privateBrowsingStorageSessionIdentifierBase().isNull()); 112 RetainPtr<CFStringRef> cfIdentifier = String(privateBrowsingStorageSessionIdentifierBase() + ".PrivateBrowsing").createCFString(); 113 114 privateBrowsingStorageSession() = std::move(NetworkStorageSession::createPrivateBrowsingSession(privateBrowsingStorageSessionIdentifierBase())); 115 } 116 117 void RemoteNetworkingContext::destroyPrivateBrowsingSession() 118 { 119 privateBrowsingStorageSession() = nullptr; 89 ASSERT(!SessionTracker::getIdentifierBase().isNull()); 90 SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(SessionTracker::getIdentifierBase() + '.' + String::number(sessionID)); 120 91 } 121 92 -
trunk/Source/WebKit2/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
r162245 r162271 53 53 } 54 54 55 void RemoteNetworkingContext:: setPrivateBrowsingStorageSessionIdentifierBase(const String&)55 void RemoteNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 56 56 { 57 57 notImplemented(); 58 }59 60 void RemoteNetworkingContext::ensurePrivateBrowsingSession()61 {62 notImplemented();63 }64 65 void RemoteNetworkingContext::destroyPrivateBrowsingSession()66 {67 58 } 68 59 … … 72 63 } 73 64 74 NetworkStorageSession* RemoteNetworkingContext::privateBrowsingSession()75 {76 notImplemented();77 return &NetworkStorageSession::defaultStorageSession();78 }79 80 65 } 81 66 -
trunk/Source/WebKit2/Shared/SessionTracker.cpp
r162270 r162271 25 25 26 26 #include "config.h" 27 #include " APISession.h"27 #include "SessionTracker.h" 28 28 29 namespace API { 29 #include <wtf/MainThread.h> 30 #include <wtf/NeverDestroyed.h> 30 31 31 Session::Session(bool isEphemeral) 32 : m_isEphemeral(isEphemeral) 32 using namespace WebCore; 33 34 namespace WebKit { 35 36 static HashMap<uint64_t, std::unique_ptr<NetworkStorageSession>>& sessionMap() 33 37 { 38 ASSERT(isMainThread()); 39 40 static NeverDestroyed<HashMap<uint64_t, std::unique_ptr<NetworkStorageSession>>> map; 41 return map.get(); 34 42 } 35 43 36 PassRefPtr<Session> Session::create(bool isEphemeral)44 static String& identifierBase() 37 45 { 38 return adoptRef(new Session(isEphemeral)); 46 ASSERT(isMainThread()); 47 48 static NeverDestroyed<String> base; 49 return base; 39 50 } 40 51 41 bool Session::isEphemeral()52 const HashMap<uint64_t, std::unique_ptr<NetworkStorageSession>>& SessionTracker::getSessionMap() 42 53 { 43 return m_isEphemeral;54 return sessionMap(); 44 55 } 45 56 46 Session::~Session()57 const String& SessionTracker::getIdentifierBase() 47 58 { 59 return identifierBase(); 48 60 } 49 61 50 } // namespace API 62 std::unique_ptr<NetworkStorageSession>& SessionTracker::session(uint64_t sessionID) 63 { 64 return sessionMap().add(sessionID, nullptr).iterator->value; 65 } 66 67 void SessionTracker::destroySession(uint64_t sessionID) 68 { 69 ASSERT(isMainThread()); 70 71 sessionMap().remove(sessionID); 72 } 73 74 void SessionTracker::setIdentifierBase(const String& identifier) 75 { 76 ASSERT(isMainThread()); 77 78 identifierBase() = identifier; 79 } 80 81 } // namespace WebKit -
trunk/Source/WebKit2/Shared/SessionTracker.h
r162270 r162271 24 24 */ 25 25 26 #ifndef APISession_h27 #define APISession_h26 #ifndef SessionTracker_h 27 #define SessionTracker_h 28 28 29 #include "APIObject.h" 30 #include <wtf/PassRefPtr.h> 29 #include <WebCore/NetworkStorageSession.h> 30 #include <wtf/HashMap.h> 31 #include <wtf/Noncopyable.h> 32 #include <wtf/text/CString.h> 31 33 32 namespace API{34 namespace WebKit { 33 35 34 class Session : public API::ObjectImpl<API::Object::Type::Session> { 36 class SessionTracker { 37 WTF_MAKE_NONCOPYABLE(SessionTracker); 35 38 public: 36 static PassRefPtr<Session> create(bool isEphemeral); 37 bool isEphemeral(); 38 virtual ~Session(); 39 40 private: 41 explicit Session(bool isEphemeral); 42 bool m_isEphemeral; 39 static const uint64_t defaultSessionID = 1; 40 static const uint64_t legacyPrivateSessionID = 2; 41 static bool isEphemeralID(uint64_t sessionID) { return sessionID != SessionTracker::defaultSessionID; } 42 static const HashMap<uint64_t, std::unique_ptr<WebCore::NetworkStorageSession>>& getSessionMap(); 43 static const String& getIdentifierBase(); 44 static std::unique_ptr<WebCore::NetworkStorageSession>& session(uint64_t sessionID); 45 static void destroySession(uint64_t sessionID); 46 static void setIdentifierBase(const String&); 43 47 }; 44 48 45 } // namespace API49 } // namespace WebKit 46 50 47 #endif // APISession_h51 #endif // SessionTracker_h -
trunk/Source/WebKit2/Shared/mac/CookieStorageShim.cpp
r161045 r162271 32 32 #include "NetworkConnectionToWebProcess.h" 33 33 #include "NetworkProcessConnection.h" 34 #include "SessionTracker.h" 34 35 #include "WebCoreArgumentCoders.h" 35 36 #include "WebProcess.h" … … 48 49 String cookies; 49 50 URL firstPartyForCookiesURL; 50 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue( false, firstPartyForCookiesURL, inRequestURL), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookies), 0))51 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(SessionTracker::defaultSessionID, firstPartyForCookiesURL, inRequestURL), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookies), 0)) 51 52 return 0; 52 53 -
trunk/Source/WebKit2/UIProcess/APISession.cpp
r162245 r162271 27 27 #include "APISession.h" 28 28 29 #include <wtf/MainThread.h> 30 29 31 namespace API { 32 33 static uint64_t generateID(bool isEphemeral) 34 { 35 ASSERT(isMainThread()); 36 37 static uint64_t uniqueSessionID = WebKit::SessionTracker::legacyPrivateSessionID; 38 ASSERT(isEphemeral); 39 return ++uniqueSessionID; 40 } 41 42 Session& Session::defaultSession() 43 { 44 ASSERT(isMainThread()); 45 46 static Session* defaultSession = new Session(false, WebKit::SessionTracker::defaultSessionID); 47 return *defaultSession; 48 } 49 50 Session& Session::legacyPrivateSession() 51 { 52 ASSERT(isMainThread()); 53 54 static Session* legacyPrivateSession = new Session(true, WebKit::SessionTracker::legacyPrivateSessionID); 55 return *legacyPrivateSession; 56 } 30 57 31 58 Session::Session(bool isEphemeral) 32 59 : m_isEphemeral(isEphemeral) 60 , m_sessionID(generateID(isEphemeral)) 61 { 62 } 63 64 Session::Session(bool isEphemeral, uint64_t sessionID) 65 : m_isEphemeral(isEphemeral) 66 , m_sessionID(sessionID) 33 67 { 34 68 } … … 36 70 PassRefPtr<Session> Session::create(bool isEphemeral) 37 71 { 72 // FIXME: support creation of non-default, non-ephemeral sessions 38 73 return adoptRef(new Session(isEphemeral)); 39 74 } 40 75 41 bool Session::isEphemeral() 76 bool Session::isEphemeral() const 42 77 { 43 78 return m_isEphemeral; 79 } 80 81 uint64_t Session::getID() const 82 { 83 return m_sessionID; 44 84 } 45 85 -
trunk/Source/WebKit2/UIProcess/APISession.h
r162245 r162271 28 28 29 29 #include "APIObject.h" 30 #include "SessionTracker.h" 30 31 #include <wtf/PassRefPtr.h> 31 32 … … 35 36 public: 36 37 static PassRefPtr<Session> create(bool isEphemeral); 37 bool isEphemeral(); 38 static Session& defaultSession(); 39 static Session& legacyPrivateSession(); 40 bool isEphemeral() const; 41 uint64_t getID() const; 38 42 virtual ~Session(); 39 43 40 44 private: 41 45 explicit Session(bool isEphemeral); 46 Session(bool isEphemeral, uint64_t sessionID); 42 47 bool m_isEphemeral; 48 uint64_t m_sessionID; 43 49 }; 44 50 -
trunk/Source/WebKit2/UIProcess/WebContext.cpp
r162245 r162271 33 33 #include "MutableDictionary.h" 34 34 #include "SandboxExtension.h" 35 #include "SessionTracker.h" 35 36 #include "StatisticsData.h" 36 37 #include "TextChecker.h" … … 468 469 if (usesNetworkProcess() && networkProcess()) { 469 470 if (privateBrowsingEnabled) 470 networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession( ), 0);471 networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0); 471 472 else 472 networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession( ), 0);473 networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0); 473 474 } 474 475 #endif // ENABLED(NETWORK_PROCESS) 475 476 476 477 if (privateBrowsingEnabled) 477 sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession( ));478 sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID)); 478 479 else 479 sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession( ));480 sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession(SessionTracker::legacyPrivateSessionID)); 480 481 } 481 482 … … 598 599 599 600 if (WebPreferences::anyPageGroupsAreUsingPrivateBrowsing()) 600 process->send(Messages::WebProcess::EnsurePrivateBrowsingSession( ), 0);601 process->send(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID), 0); 601 602 602 603 m_processes.append(process); … … 741 742 } 742 743 743 PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient& pageClient, WebPageGroup* pageGroup, WebPageProxy* relatedPage)744 PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient& pageClient, WebPageGroup* pageGroup, API::Session& session, WebPageProxy* relatedPage) 744 745 { 745 746 RefPtr<WebProcessProxy> process; … … 757 758 } 758 759 759 return process->createWebPage(pageClient, pageGroup ? *pageGroup : m_defaultPageGroup.get()); 760 return process->createWebPage(pageClient, pageGroup ? *pageGroup : m_defaultPageGroup.get(), session); 761 } 762 763 PassRefPtr<WebPageProxy> WebContext::createWebPage(PageClient& pageClient, WebPageGroup* pageGroup, WebPageProxy* relatedPage) 764 { 765 WebPageGroup* group = pageGroup ? pageGroup : &m_defaultPageGroup.get(); 766 return createWebPage(pageClient, group, group->preferences()->privateBrowsingEnabled() ? API::Session::legacyPrivateSession() : API::Session::defaultSession(), relatedPage); 760 767 } 761 768 -
trunk/Source/WebKit2/UIProcess/WebContext.h
r162245 r162271 150 150 StorageManager& storageManager() const { return *m_storageManager; } 151 151 152 PassRefPtr<WebPageProxy> createWebPage(PageClient&, WebPageGroup*, API::Session&, WebPageProxy* relatedPage = 0); 152 153 PassRefPtr<WebPageProxy> createWebPage(PageClient&, WebPageGroup*, WebPageProxy* relatedPage = 0); 153 154 … … 292 293 static void willStartUsingPrivateBrowsing(); 293 294 static void willStopUsingPrivateBrowsing(); 295 296 static bool isEphemeralSession(uint64_t sessionID); 294 297 295 298 #if USE(SOUP) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r162245 r162271 229 229 #endif // !LOG_DISABLED 230 230 231 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient& pageClient, WebProcessProxy& process, WebPageGroup& pageGroup, uint64_t pageID)232 { 233 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));234 } 235 236 WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, WebPageGroup& pageGroup, uint64_t pageID)231 PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient& pageClient, WebProcessProxy& process, WebPageGroup& pageGroup, API::Session& session, uint64_t pageID) 232 { 233 return adoptRef(new WebPageProxy(pageClient, process, pageGroup, session, pageID)); 234 } 235 236 WebPageProxy::WebPageProxy(PageClient& pageClient, WebProcessProxy& process, WebPageGroup& pageGroup, API::Session& session, uint64_t pageID) 237 237 : m_pageClient(pageClient) 238 238 , m_process(process) … … 280 280 #endif 281 281 , m_pageID(pageID) 282 , m_session(session) 282 283 , m_isPageSuspended(false) 283 284 #if PLATFORM(MAC) -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r162245 r162271 28 28 29 29 #include "APIObject.h" 30 #include "APISession.h" 30 31 #include "AutoCorrectionCallback.h" 31 32 #include "Connection.h" … … 75 76 #include <wtf/PassOwnPtr.h> 76 77 #include <wtf/PassRefPtr.h> 78 #include <wtf/Ref.h> 77 79 #include <wtf/RefPtr.h> 78 80 #include <wtf/Vector.h> … … 328 330 public: 329 331 330 static PassRefPtr<WebPageProxy> create(PageClient&, WebProcessProxy&, WebPageGroup&, uint64_t pageID);332 static PassRefPtr<WebPageProxy> create(PageClient&, WebProcessProxy&, WebPageGroup&, API::Session&, uint64_t pageID); 331 333 virtual ~WebPageProxy(); 332 334 333 335 uint64_t pageID() const { return m_pageID; } 336 uint64_t sessionID() const { return m_session->getID(); } 334 337 335 338 WebFrameProxy* mainFrame() const { return m_mainFrame.get(); } … … 856 859 857 860 private: 858 WebPageProxy(PageClient&, WebProcessProxy&, WebPageGroup&, uint64_t pageID);861 WebPageProxy(PageClient&, WebProcessProxy&, WebPageGroup&, API::Session&, uint64_t pageID); 859 862 void platformInitialize(); 860 863 … … 1313 1316 1314 1317 uint64_t m_pageID; 1318 Ref<API::Session> m_session; 1315 1319 1316 1320 bool m_isPageSuspended; -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r162245 r162271 168 168 } 169 169 170 PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient& pageClient, WebPageGroup& pageGroup )170 PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient& pageClient, WebPageGroup& pageGroup, API::Session& session) 171 171 { 172 172 uint64_t pageID = generatePageID(); 173 RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, *this, pageGroup, pageID);173 RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, *this, pageGroup, session, pageID); 174 174 m_pageMap.set(pageID, webPage.get()); 175 175 globalPageMap().set(pageID, webPage.get()); -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.h
r162245 r162271 27 27 #define WebProcessProxy_h 28 28 29 #include "APISession.h" 29 30 #include "ChildProcessProxy.h" 30 31 #include "MessageReceiverMap.h" … … 78 79 79 80 static WebPageProxy* webPage(uint64_t pageID); 80 PassRefPtr<WebPageProxy> createWebPage(PageClient&, WebPageGroup& );81 PassRefPtr<WebPageProxy> createWebPage(PageClient&, WebPageGroup&, API::Session&); 81 82 void addExistingWebPage(WebPageProxy*, uint64_t pageID); 82 83 void removeWebPage(uint64_t pageID); -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r162259 r162271 788 788 728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; }; 789 789 728E86F21795188C0087879E /* WebColorPickerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 728E86F01795188C0087879E /* WebColorPickerMac.mm */; }; 790 753E3E0D1887398500188496 /* SessionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 753E3E0B1887397300188496 /* SessionTracker.cpp */; }; 791 753E3E0E1887398900188496 /* SessionTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 753E3E091887394B00188496 /* SessionTracker.h */; }; 790 792 755422BD18062BB20046F6A8 /* WKOriginDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755422B918062B9C0046F6A8 /* WKOriginDataManager.cpp */; }; 791 793 755422C418062BF90046F6A8 /* WebOriginDataManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 755422BE18062BE40046F6A8 /* WebOriginDataManagerProxy.cpp */; }; … … 2469 2471 728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = "<group>"; }; 2470 2472 728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = "<group>"; }; 2473 753E3E091887394B00188496 /* SessionTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionTracker.h; sourceTree = "<group>"; }; 2474 753E3E0B1887397300188496 /* SessionTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionTracker.cpp; sourceTree = "<group>"; }; 2471 2475 755422B918062B9C0046F6A8 /* WKOriginDataManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKOriginDataManager.cpp; sourceTree = "<group>"; }; 2472 2476 755422BA18062B9C0046F6A8 /* WKOriginDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOriginDataManager.h; sourceTree = "<group>"; }; … … 3729 3733 518D2CC812D51DFB003BB93B /* SessionState.cpp */, 3730 3734 518D2CC912D51DFB003BB93B /* SessionState.h */, 3735 753E3E0B1887397300188496 /* SessionTracker.cpp */, 3736 753E3E091887394B00188496 /* SessionTracker.h */, 3731 3737 1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */, 3732 3738 1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */, … … 6654 6660 BC40760C124FF0270068F20A /* WKURLRequest.h in Headers */, 6655 6661 BC407629124FF0400068F20A /* WKURLRequestNS.h in Headers */, 6662 753E3E0E1887398900188496 /* SessionTracker.h in Headers */, 6656 6663 BC40760E124FF0270068F20A /* WKURLResponse.h in Headers */, 6657 6664 759CCD5A1808F6160078E8A8 /* WebOriginDataManagerProxy.h in Headers */, … … 7912 7919 BC498630124D18C100D834E1 /* WKBundleHitTestResult.cpp in Sources */, 7913 7920 6501BD1A12F1243400E9F248 /* WKBundleInspector.cpp in Sources */, 7921 753E3E0D1887398500188496 /* SessionTracker.cpp in Sources */, 7914 7922 BC7043CD12F75EE0006472B9 /* WKBundleNavigationAction.cpp in Sources */, 7915 7923 BC4BEFE2120A1A4C00FBA0C7 /* WKBundleNodeHandle.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
r162245 r162271 33 33 #include "LayerTreeHost.h" 34 34 #include "NotificationPermissionRequestManager.h" 35 #include "SessionTracker.h" 35 36 #include "WKAPICast.h" 36 37 #include "WKBundleAPICast.h" … … 300 301 #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP) 301 302 if (enabled) 302 WebFrameNetworkingContext::ensurePrivateBrowsingSession( );303 WebFrameNetworkingContext::ensurePrivateBrowsingSession(SessionTracker::legacyPrivateSessionID); 303 304 else 304 WebFrameNetworkingContext::destroyPrivateBrowsingSession();305 SessionTracker::destroySession(SessionTracker::legacyPrivateSessionID); 305 306 #endif 306 307 const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r162245 r162271 31 31 #include "NetworkResourceLoadParameters.h" 32 32 #include "PluginInfoStore.h" 33 #include "SessionTracker.h" 33 34 #include "StorageNamespaceImpl.h" 34 35 #include "WebContextMessages.h" … … 73 74 namespace WebKit { 74 75 76 #if ENABLE(NETWORK_PROCESS) 77 static uint64_t legacySessionID(const NetworkStorageSession &session) 78 { 79 return session.isPrivateBrowsingSession() ? SessionTracker::legacyPrivateSessionID : SessionTracker::defaultSessionID; 80 } 81 #endif 82 75 83 void WebPlatformStrategies::initialize() 76 84 { … … 134 142 if (WebProcess::shared().usesNetworkProcess()) { 135 143 String result; 136 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM( session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0))144 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(result), 0)) 137 145 return String(); 138 146 return result; … … 147 155 #if ENABLE(NETWORK_PROCESS) 148 156 if (WebProcess::shared().usesNetworkProcess()) { 149 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM( session.isPrivateBrowsingSession(), firstParty, url, cookieString), 0);157 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(legacySessionID(session), firstParty, url, cookieString), 0); 150 158 return; 151 159 } … … 160 168 if (WebProcess::shared().usesNetworkProcess()) { 161 169 bool result; 162 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled( session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0))170 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) 163 171 return false; 164 172 return result; … … 174 182 if (WebProcess::shared().usesNetworkProcess()) { 175 183 String result; 176 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue( session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0))184 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(result), 0)) 177 185 return String(); 178 186 return result; … … 187 195 #if ENABLE(NETWORK_PROCESS) 188 196 if (WebProcess::shared().usesNetworkProcess()) { 189 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies( session.isPrivateBrowsingSession(), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0))197 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(legacySessionID(session), firstParty, url), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) 190 198 return false; 191 199 return true; … … 200 208 #if ENABLE(NETWORK_PROCESS) 201 209 if (WebProcess::shared().usesNetworkProcess()) { 202 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie( session.isPrivateBrowsingSession(), url, cookieName), 0);210 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::DeleteCookie(legacySessionID(session), url, cookieName), 0); 203 211 return; 204 212 } -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h
r162245 r162271 40 40 } 41 41 42 static void setPrivateBrowsingStorageSessionIdentifierBase(const String&);43 static void ensurePrivateBrowsingSession( );44 static void destroyPrivateBrowsingSession(); 42 // FIXME: remove platform-specific code and use SessionTracker 43 static void ensurePrivateBrowsingSession(uint64_t sessionID); 44 45 45 static void setCookieAcceptPolicyForAllContexts(HTTPCookieAcceptPolicy); 46 46 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
r162245 r162271 25 25 26 26 #include "config.h" 27 28 #include "SessionTracker.h" 27 29 #include "WebCookieManager.h" 28 30 #include "WebFrameNetworkingContext.h" … … 35 37 #include <WebCore/Settings.h> 36 38 #include <WebKitSystemInterface.h> 37 #include <wtf/NeverDestroyed.h>38 39 39 40 using namespace WebCore; 40 41 41 42 namespace WebKit { 42 43 static std::unique_ptr<NetworkStorageSession>& privateSession()43 44 void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 44 45 { 45 static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session; 46 return session; 47 } 48 49 static String& identifierBase() 50 { 51 static NeverDestroyed<String> base; 52 return base; 53 } 54 55 void WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(const String& base) 56 { 57 ASSERT(isMainThread()); 58 59 identifierBase() = base; 60 } 61 62 void WebFrameNetworkingContext::ensurePrivateBrowsingSession() 63 { 64 ASSERT(isMainThread()); 65 66 if (privateSession()) 46 if (SessionTracker::session(sessionID)) 67 47 return; 68 48 69 49 String base; 70 if ( identifierBase().isNull())50 if (SessionTracker::getIdentifierBase().isNull()) 71 51 base = [[NSBundle mainBundle] bundleIdentifier]; 72 52 else 73 base = identifierBase();53 base = SessionTracker::getIdentifierBase(); 74 54 75 privateSession() = NetworkStorageSession::createPrivateBrowsingSession(base); 76 } 77 78 void WebFrameNetworkingContext::destroyPrivateBrowsingSession() 79 { 80 ASSERT(isMainThread()); 81 82 privateSession() = nullptr; 55 SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(base + '.' + String::number(sessionID)); 83 56 } 84 57 … … 90 63 WKSetHTTPCookieAcceptPolicy(cookieStorage.get(), policy); 91 64 92 if (privateSession()) 93 WKSetHTTPCookieAcceptPolicy(privateSession()->cookieStorage().get(), policy); 65 for (const auto& session : SessionTracker::getSessionMap().values()) { 66 if (session) 67 WKSetHTTPCookieAcceptPolicy(session->cookieStorage().get(), policy); 68 } 94 69 } 95 70 … … 126 101 127 102 if (frame() && frame()->settings().privateBrowsingEnabled()) 128 return * privateSession();103 return *SessionTracker::session(SessionTracker::legacyPrivateSessionID); 129 104 130 105 return NetworkStorageSession::defaultStorageSession(); 131 106 } 132 133 107 WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const 134 108 { -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
r162245 r162271 28 28 #include "WebFrameNetworkingContext.h" 29 29 30 #include "SessionTracker.h" 30 31 #include "WebFrame.h" 31 32 #include "WebPage.h" … … 37 38 namespace WebKit { 38 39 39 static std::unique_ptr<NetworkStorageSession>& privateSession() 40 { 41 static NeverDestroyed<std::unique_ptr<NetworkStorageSession>> session; 42 return session; 43 } 44 45 void WebFrameNetworkingContext::ensurePrivateBrowsingSession() 40 void WebFrameNetworkingContext::ensurePrivateBrowsingSession(uint64_t sessionID) 46 41 { 47 42 ASSERT(isMainThread()); 48 43 49 if ( privateSession())44 if (SessionTracker::session(sessionID)) 50 45 return; 51 46 52 privateSession() = NetworkStorageSession::createPrivateBrowsingSession(); 53 } 54 55 void WebFrameNetworkingContext::destroyPrivateBrowsingSession() 56 { 57 ASSERT(isMainThread()); 58 59 privateSession() = nullptr; 47 SessionTracker::session(sessionID) = NetworkStorageSession::createPrivateBrowsingSession(String::number(sessionID)); 60 48 } 61 49 … … 71 59 { 72 60 if (frame() && frame()->settings().privateBrowsingEnabled()) 73 return * privateSession();61 return *SessionTracker::session(SessionTracker::legacyPrivateSessionID); 74 62 75 63 return NetworkStorageSession::defaultStorageSession(); -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h
r162245 r162271 43 43 } 44 44 45 static void ensurePrivateBrowsingSession(); 46 static void destroyPrivateBrowsingSession(); 45 static void ensurePrivateBrowsingSession(uint64_t sessionID); 47 46 48 47 WebFrameLoaderClient* webFrameLoaderClient() const; -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r162245 r162271 34 34 #include "Logging.h" 35 35 #include "PluginProcessConnectionManager.h" 36 #include "SessionTracker.h" 36 37 #include "StatisticsData.h" 37 38 #include "UserData.h" … … 336 337 337 338 #if PLATFORM(MAC) || USE(CFNETWORK) 338 WebFrameNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier);339 SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier); 339 340 #endif 340 341 … … 453 454 } 454 455 455 void WebProcess::ensurePrivateBrowsingSession( )456 void WebProcess::ensurePrivateBrowsingSession(uint64_t sessionID) 456 457 { 457 458 #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP) 458 WebFrameNetworkingContext::ensurePrivateBrowsingSession( );459 #endif 460 } 461 462 void WebProcess::destroyPrivateBrowsingSession( )459 WebFrameNetworkingContext::ensurePrivateBrowsingSession(sessionID); 460 #endif 461 } 462 463 void WebProcess::destroyPrivateBrowsingSession(uint64_t sessionID) 463 464 { 464 465 #if PLATFORM(MAC) || USE(CFNETWORK) || USE(SOUP) 465 WebFrameNetworkingContext::destroyPrivateBrowsingSession();466 SessionTracker::destroySession(sessionID); 466 467 #endif 467 468 } -
trunk/Source/WebKit2/WebProcess/WebProcess.h
r162245 r162271 166 166 void setCacheModel(uint32_t); 167 167 168 void ensurePrivateBrowsingSession( );169 void destroyPrivateBrowsingSession( );170 168 void ensurePrivateBrowsingSession(uint64_t sessionID); 169 void destroyPrivateBrowsingSession(uint64_t sessionID); 170 171 171 void pageDidEnterWindow(uint64_t pageID); 172 172 void pageWillLeaveWindow(uint64_t pageID); -
trunk/Source/WebKit2/WebProcess/WebProcess.messages.in
r162245 r162271 52 52 #endif 53 53 54 // Private browsing session is per process. Individual pages or page groups may use the private session or the default one as appropriate.55 EnsurePrivateBrowsingSession( )56 DestroyPrivateBrowsingSession( )54 // Legacy private browsing session is per process. Individual pages or page groups may use the private session or the default one as appropriate. 55 EnsurePrivateBrowsingSession(uint64_t sessionID) 56 DestroyPrivateBrowsingSession(uint64_t sessionID) 57 57 58 58 # Plug-ins.
Note: See TracChangeset
for help on using the changeset viewer.