Title: [239735] trunk/Source
Revision
239735
Author
achristen...@apple.com
Date
2019-01-08 12:12:38 -0800 (Tue, 08 Jan 2019)

Log Message

Unreviewed, rolling out r239727.

Broke API tests

Reverted changeset:

"Stop using NetworkStorageSession in WebProcess"
https://bugs.webkit.org/show_bug.cgi?id=193236
https://trac.webkit.org/changeset/239727

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239734 => 239735)


--- trunk/Source/WebCore/ChangeLog	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/ChangeLog	2019-01-08 20:12:38 UTC (rev 239735)
@@ -1,5 +1,17 @@
 2019-01-08  Alex Christensen  <achristen...@webkit.org>
 
+        Unreviewed, rolling out r239727.
+
+        Broke API tests
+
+        Reverted changeset:
+
+        "Stop using NetworkStorageSession in WebProcess"
+        https://bugs.webkit.org/show_bug.cgi?id=193236
+        https://trac.webkit.org/changeset/239727
+
+2019-01-08  Alex Christensen  <achristen...@webkit.org>
+
         Stop using NetworkStorageSession in WebProcess
         https://bugs.webkit.org/show_bug.cgi?id=193236
 

Modified: trunk/Source/WebCore/loader/CookieJar.cpp (239734 => 239735)


--- trunk/Source/WebCore/loader/CookieJar.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/loader/CookieJar.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -54,7 +54,7 @@
 inline NetworkStorageSession& storageSession(const Document& document)
 {
     NetworkingContext* context = networkingContext(document);
-    return context ? *context->storageSession() : NetworkStorageSession::defaultStorageSession();
+    return context ? context->storageSession() : NetworkStorageSession::defaultStorageSession();
 }
 
 static IncludeSecureCookies shouldIncludeSecureCookies(const Document& document, const URL& url)

Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (239734 => 239735)


--- trunk/Source/WebCore/loader/EmptyClients.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -287,7 +287,7 @@
     EmptyFrameNetworkingContext();
 
     bool shouldClearReferrerOnHTTPSToHTTPRedirect() const { return true; }
-    NetworkStorageSession* storageSession() const final { return &NetworkStorageSession::defaultStorageSession(); }
+    NetworkStorageSession& storageSession() const final { return NetworkStorageSession::defaultStorageSession(); }
 
 #if PLATFORM(COCOA)
     bool localFileContentSniffingEnabled() const { return false; }

Modified: trunk/Source/WebCore/platform/network/NetworkingContext.h (239734 => 239735)


--- trunk/Source/WebCore/platform/network/NetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/platform/network/NetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -58,7 +58,7 @@
 
     virtual String sourceApplicationIdentifier() const { return emptyString(); }
 
-    virtual NetworkStorageSession* storageSession() const = 0;
+    virtual NetworkStorageSession& storageSession() const = 0;
 
 #if PLATFORM(WIN)
     virtual ResourceError blockedError(const ResourceRequest&) const = 0;

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (239734 => 239735)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -149,12 +149,12 @@
         if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
             // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
             // try and reuse the credential preemptively, as allowed by RFC 2617.
-            d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(partition, firstRequest().url());
+            d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(partition, firstRequest().url());
         } else {
             // If there is already a protection space known for the URL, update stored credentials before sending a request.
             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
             // (so that an authentication dialog doesn't pop up).
-            d->m_context->storageSession()->credentialStorage().set(partition, Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
+            d->m_context->storageSession().credentialStorage().set(partition, Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
         }
     }
         
@@ -261,7 +261,7 @@
     if (!d->m_context->isValid())
         return false;
 
-    d->m_storageSession = d->m_context->storageSession()->platformSession();
+    d->m_storageSession = d->m_context->storageSession().platformSession();
 
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
@@ -307,7 +307,7 @@
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.
         if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
-            Credential credential = d->m_context->storageSession()->credentialStorage().get(partition, request.url());
+            Credential credential = d->m_context->storageSession().credentialStorage().get(partition, request.url());
             if (!credential.isEmpty()) {
                 d->m_initialCredential = credential;
                 
@@ -382,7 +382,7 @@
         URL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
             urlToStore = challenge.failureResponse().url();
-        d->m_context->storageSession()->credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore);
+        d->m_context->storageSession().credentialStorage().set(partition, credential, challenge.protectionSpace(), urlToStore);
         
         CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
         d->m_user = String();
@@ -396,16 +396,16 @@
             // The stored credential wasn't accepted, stop using it.
             // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
             // but the observable effect should be very minor, if any.
-            d->m_context->storageSession()->credentialStorage().remove(partition, challenge.protectionSpace());
+            d->m_context->storageSession().credentialStorage().remove(partition, challenge.protectionSpace());
         }
 
         if (!challenge.previousFailureCount()) {
-            Credential credential = d->m_context->storageSession()->credentialStorage().get(partition, challenge.protectionSpace());
+            Credential credential = d->m_context->storageSession().credentialStorage().get(partition, challenge.protectionSpace());
             if (!credential.isEmpty() && credential != d->m_initialCredential) {
                 ASSERT(credential.persistence() == CredentialPersistenceNone);
                 if (challenge.failureResponse().httpStatusCode() == 401) {
                     // Store the credential back, possibly adding it as a default for this directory.
-                    d->m_context->storageSession()->credentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
+                    d->m_context->storageSession().credentialStorage().set(partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
                 }
 #if PLATFORM(COCOA)
                 CFURLConnectionUseCredential(d->m_connection.get(), credential.cfCredential(), challenge.cfURLAuthChallengeRef());
@@ -455,7 +455,7 @@
         if (challenge.failureResponse().httpStatusCode() == 401)
             urlToStore = challenge.failureResponse().url(); 
 
-        d->m_context->storageSession()->credentialStorage().set(firstRequest().cachePartition(), webCredential, challenge.protectionSpace(), urlToStore);
+        d->m_context->storageSession().credentialStorage().set(firstRequest().cachePartition(), webCredential, challenge.protectionSpace(), urlToStore);
 
         if (d->m_connection) {
 #if PLATFORM(COCOA)
@@ -571,7 +571,7 @@
     bool shouldContentEncodingSniff = true;
     RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, &client, defersLoading, shouldContentSniff, shouldContentEncodingSniff));
 
-    handle->d->m_storageSession = context->storageSession()->platformSession();
+    handle->d->m_storageSession = context->storageSession().platformSession();
 
     if (handle->d->m_scheduledFailureType != NoFailure) {
         error = context->blockedError(request);

Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (239734 => 239735)


--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm	2019-01-08 20:12:38 UTC (rev 239735)
@@ -157,12 +157,12 @@
         if (d->m_user.isEmpty() && d->m_pass.isEmpty()) {
             // <rdar://problem/7174050> - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
             // try and reuse the credential preemptively, as allowed by RFC 2617.
-            d->m_initialCredential = d->m_context->storageSession()->credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
+            d->m_initialCredential = d->m_context->storageSession().credentialStorage().get(firstRequest().cachePartition(), firstRequest().url());
         } else {
             // If there is already a protection space known for the URL, update stored credentials before sending a request.
             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
             // (so that an authentication dialog doesn't pop up).
-            d->m_context->storageSession()->credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
+            d->m_context->storageSession().credentialStorage().set(firstRequest().cachePartition(), Credential(d->m_user, d->m_pass, CredentialPersistenceNone), firstRequest().url());
         }
     }
         
@@ -240,7 +240,7 @@
     if (!d->m_context->isValid())
         return false;
 
-    d->m_storageSession = d->m_context->storageSession()->platformSession();
+    d->m_storageSession = d->m_context->storageSession().platformSession();
 
     // FIXME: Do not use the sync version of shouldUseCredentialStorage when the client returns true from usesAsyncCallbacks.
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
@@ -367,7 +367,7 @@
     bool shouldContentEncodingSniff = true;
     RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(context, request, &client, defersLoading, shouldContentSniff, shouldContentEncodingSniff));
 
-    handle->d->m_storageSession = context->storageSession()->platformSession();
+    handle->d->m_storageSession = context->storageSession().platformSession();
 
     if (context && handle->d->m_scheduledFailureType != NoFailure) {
         error = context->blockedError(request);
@@ -449,7 +449,7 @@
         // Only consider applying authentication credentials if this is actually a redirect and the redirect
         // URL didn't include credentials of its own.
         if (d->m_user.isEmpty() && d->m_pass.isEmpty() && !redirectResponse.isNull()) {
-            Credential credential = d->m_context->storageSession()->credentialStorage().get(request.cachePartition(), request.url());
+            Credential credential = d->m_context->storageSession().credentialStorage().get(request.cachePartition(), request.url());
             if (!credential.isEmpty()) {
                 d->m_initialCredential = credential;
                 
@@ -540,16 +540,16 @@
             // The stored credential wasn't accepted, stop using it.
             // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
             // but the observable effect should be very minor, if any.
-            d->m_context->storageSession()->credentialStorage().remove(d->m_partition, challenge.protectionSpace());
+            d->m_context->storageSession().credentialStorage().remove(d->m_partition, challenge.protectionSpace());
         }
 
         if (!challenge.previousFailureCount()) {
-            Credential credential = d->m_context->storageSession()->credentialStorage().get(d->m_partition, challenge.protectionSpace());
+            Credential credential = d->m_context->storageSession().credentialStorage().get(d->m_partition, challenge.protectionSpace());
             if (!credential.isEmpty() && credential != d->m_initialCredential) {
                 ASSERT(credential.persistence() == CredentialPersistenceNone);
                 if (challenge.failureResponse().httpStatusCode() == 401) {
                     // Store the credential back, possibly adding it as a default for this directory.
-                    d->m_context->storageSession()->credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
+                    d->m_context->storageSession().credentialStorage().set(d->m_partition, credential, challenge.protectionSpace(), challenge.failureResponse().url());
                 }
                 [challenge.sender() useCredential:credential.nsCredential() forAuthenticationChallenge:mac(challenge)];
                 return true;
@@ -591,7 +591,7 @@
         URL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
             urlToStore = challenge.failureResponse().url();
-        d->m_context->storageSession()->credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
+        d->m_context->storageSession().credentialStorage().set(d->m_partition, webCredential, ProtectionSpace([d->m_currentMacChallenge protectionSpace]), urlToStore);
         [[d->m_currentMacChallenge sender] useCredential:webCredential.nsCredential() forAuthenticationChallenge:d->m_currentMacChallenge];
     } else
         [[d->m_currentMacChallenge sender] useCredential:credential.nsCredential() forAuthenticationChallenge:d->m_currentMacChallenge];

Modified: trunk/Source/WebKit/ChangeLog (239734 => 239735)


--- trunk/Source/WebKit/ChangeLog	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/ChangeLog	2019-01-08 20:12:38 UTC (rev 239735)
@@ -1,3 +1,15 @@
+2019-01-08  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r239727.
+
+        Broke API tests
+
+        Reverted changeset:
+
+        "Stop using NetworkStorageSession in WebProcess"
+        https://bugs.webkit.org/show_bug.cgi?id=193236
+        https://trac.webkit.org/changeset/239727
+
 2019-01-08  Brian Burg  <bb...@apple.com>
 
         Remove WKPageRef-based SPI in _WKAutomationSessionDelegate

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (239734 => 239735)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -72,6 +72,7 @@
     encoder << shouldCaptureVideoInUIProcess;
     encoder << shouldCaptureDisplayInUIProcess;
 #endif
+    encoder << shouldUseTestingNetworkSession;
     encoder << urlSchemesRegisteredAsEmptyDocument;
     encoder << urlSchemesRegisteredAsSecure;
     encoder << urlSchemesRegisteredAsBypassingContentSecurityPolicy;
@@ -266,6 +267,8 @@
     if (!decoder.decode(parameters.shouldCaptureDisplayInUIProcess))
         return false;
 #endif
+    if (!decoder.decode(parameters.shouldUseTestingNetworkSession))
+        return false;
     if (!decoder.decode(parameters.urlSchemesRegisteredAsEmptyDocument))
         return false;
     if (!decoder.decode(parameters.urlSchemesRegisteredAsSecure))

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (239734 => 239735)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -124,6 +124,7 @@
 
     double defaultRequestTimeoutInterval { INT_MAX };
 
+    bool shouldUseTestingNetworkSession { false };
     bool shouldAlwaysUseComplexTextCodePath { false };
     bool shouldEnableMemoryPressureReliefLogging { false };
     bool shouldSuppressMemoryPressureHandler { false };

Modified: trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp (239734 => 239735)


--- trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -161,8 +161,11 @@
 
     if (websitePolicies.websiteDataStoreParameters) {
         if (auto* frame = documentLoader.frame()) {
-            if (auto* page = frame->page())
-                page->setSessionID(websitePolicies.websiteDataStoreParameters->networkSessionParameters.sessionID);
+            if (auto* page = frame->page()) {
+                auto sessionID = websitePolicies.websiteDataStoreParameters->networkSessionParameters.sessionID;
+                WebProcess::singleton().addWebsiteDataStore(WTFMove(*websitePolicies.websiteDataStoreParameters));
+                page->setSessionID(sessionID);
+            }
         }
     }
 }

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (239734 => 239735)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -689,8 +689,10 @@
 {
     if (privateBrowsingEnabled) {
         sendToNetworkingProcess(Messages::NetworkProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()));
+        sendToAllProcesses(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()));
     } else {
         networkProcess()->removeSession(PAL::SessionID::legacyPrivateSessionID());
+        sendToAllProcesses(Messages::WebProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()));
     }
 }
 
@@ -763,6 +765,8 @@
 
     ASSERT(m_prewarmedProcess->isPrewarmed());
     m_prewarmedProcess->markIsNoLongerInPrewarmedPool();
+    if (&m_prewarmedProcess->websiteDataStore() != &websiteDataStore)
+        m_prewarmedProcess->send(Messages::WebProcess::AddWebsiteDataStore(websiteDataStore.parameters()), 0);
 
     return std::exchange(m_prewarmedProcess, nullptr);
 }
@@ -850,6 +854,8 @@
             SandboxExtension::createHandleWithoutResolvingPath(parameters._javascript_ConfigurationDirectory, SandboxExtension::Type::ReadWrite, parameters._javascript_ConfigurationDirectoryExtensionHandle);
     }
 
+    parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession;
+
     parameters.cacheModel = cacheModel();
     parameters.languages = userPreferredLanguages();
 
@@ -936,6 +942,9 @@
     process.send(Messages::WebProcess::SetQOS(webProcessLatencyQOS(), webProcessThroughputQOS()), 0);
 #endif
 
+    if (WebPreferences::anyPagesAreUsingPrivateBrowsing())
+        process.send(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::legacyPrivateSessionParameters()), 0);
+
     if (m_automationSession)
         process.send(Messages::WebProcess::EnsureAutomationSessionProxy(m_automationSession->sessionIdentifier()), 0);
 
@@ -1179,10 +1188,12 @@
         ASSERT(page.websiteDataStore().parameters().networkSessionParameters.sessionID == sessionID);
         if (m_networkProcess)
             m_networkProcess->addSession(makeRef(page.websiteDataStore()));
+        page.process().send(Messages::WebProcess::AddWebsiteDataStore(WebsiteDataStoreParameters::privateSessionParameters(sessionID)), 0);
         page.websiteDataStore().clearPendingCookies();
     } else if (sessionID != PAL::SessionID::defaultSessionID()) {
         if (m_networkProcess)
             m_networkProcess->addSession(makeRef(page.websiteDataStore()));
+        page.process().send(Messages::WebProcess::AddWebsiteDataStore(page.websiteDataStore().parameters()), 0);
         page.websiteDataStore().clearPendingCookies();
     }
 
@@ -1213,6 +1224,7 @@
         // The last user of this non-default PAL::SessionID is gone, so clean it up in the child processes.
         if (networkProcess())
             networkProcess()->removeSession(sessionID);
+        page.process().send(Messages::WebProcess::DestroySession(sessionID), 0);
     }
 }
 
@@ -2226,6 +2238,9 @@
         if (&(*it)->page() == &page)
             m_suspendedPages.remove(it);
 
+        if (&process->websiteDataStore() != &page.websiteDataStore())
+            process->send(Messages::WebProcess::AddWebsiteDataStore(page.websiteDataStore().parameters()), 0);
+
         return completionHandler(WTFMove(process), nullptr, reason);
     }
 

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -357,6 +357,7 @@
     ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
     if (enabled) {
         WebProcess::singleton().ensureLegacyPrivateBrowsingSessionInNetworkProcess();
+        WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters::legacyPrivateSessionParameters());
     } else
         SessionTracker::destroySession(PAL::SessionID::legacyPrivateSessionID());
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -56,6 +56,15 @@
 {
 }
 
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
+{
+    if (frame()) {
+        if (auto* storageSession = NetworkStorageSession::storageSession(frame()->page()->sessionID()))
+            return *storageSession;
+    }
+    return NetworkStorageSession::defaultStorageSession();
+}
+
 WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
 {
     if (!frame())

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -53,7 +53,7 @@
 private:
     WebFrameNetworkingContext(WebFrame*);
 
-    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
+    WebCore::NetworkStorageSession& storageSession() const override;
 };
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -56,7 +56,7 @@
     RetainPtr<CFDataRef> sourceApplicationAuditData() const override;
     String sourceApplicationIdentifier() const override;
     WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
-    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
+    WebCore::NetworkStorageSession& storageSession() const override;
 };
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm	2019-01-08 20:12:38 UTC (rev 239735)
@@ -43,6 +43,20 @@
 namespace WebKit {
 using namespace WebCore;
 
+void WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&& parameters)
+{
+    ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    if (NetworkStorageSession::storageSession(sessionID))
+        return;
+
+    String base = WebProcess::singleton().uiProcessBundleIdentifier();
+    if (base.isNull())
+        base = [[NSBundle mainBundle] bundleIdentifier];
+
+    NetworkStorageSession::ensureSession(sessionID, base + '.' + String::number(sessionID.sessionID()));
+}
+
 bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
 {
     return frame() && frame()->settings().localFileContentSniffingEnabled();
@@ -70,6 +84,19 @@
     return frame()->loader().client().blockedError(request);
 }
 
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
+{
+    ASSERT(RunLoop::isMain());
+    ASSERT(!hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
+    if (frame()) {
+        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("WEB Invalid session ID. Please file a bug unless you just disabled private browsing, in which case it's an expected race.");
+    }
+    return NetworkStorageSession::defaultStorageSession();
+}
+
 WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
 {
     if (!frame())

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -58,6 +58,15 @@
 {
 }
 
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
+{
+    if (frame()) {
+        if (auto* storageSession = NetworkStorageSession::storageSession(frame()->page()->sessionID()))
+            return *storageSession;
+    }
+    return NetworkStorageSession::defaultStorageSession();
+}
+
 WebFrameLoaderClient* WebFrameNetworkingContext::webFrameLoaderClient() const
 {
     if (!frame())

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -51,7 +51,7 @@
 private:
     WebFrameNetworkingContext(WebFrame*);
 
-    WebCore::NetworkStorageSession* storageSession() const override { return nullptr; }
+    WebCore::NetworkStorageSession& storageSession() const override;
 };
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -3043,6 +3043,8 @@
 
 void WebPage::setSessionID(PAL::SessionID sessionID)
 {
+    if (sessionID.isEphemeral())
+        WebProcess::singleton().addWebsiteDataStore(WebsiteDataStoreParameters::privateSessionParameters(sessionID));
     m_page->setSessionID(sessionID);
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -381,6 +381,9 @@
 
     setShouldUseFontSmoothing(parameters.shouldUseFontSmoothing);
 
+    if (parameters.shouldUseTestingNetworkSession)
+        NetworkStorageSession::switchToNewTestingSession();
+
     ensureNetworkProcessConnection();
 
     setTerminationTimeout(parameters.terminationTimeout);
@@ -537,6 +540,16 @@
     m_fullKeyboardAccessEnabled = fullKeyboardAccessEnabled;
 }
 
+void WebProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters)
+{
+    WebFrameNetworkingContext::ensureWebsiteDataStoreSession(WTFMove(parameters));
+}
+
+void WebProcess::destroySession(PAL::SessionID sessionID)
+{
+    SessionTracker::destroySession(sessionID);
+}
+
 void WebProcess::ensureLegacyPrivateBrowsingSessionInNetworkProcess()
 {
     ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::EnsureLegacyPrivateBrowsingSession(), 0);
@@ -1281,6 +1294,11 @@
         for (auto& origin : MemoryCache::singleton().originsWithCache(sessionID))
             websiteData.entries.append(WebsiteData::Entry { origin->data(), WebsiteDataType::MemoryCache, 0 });
     }
+
+    if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {
+        if (NetworkStorageSession::storageSession(sessionID))
+            websiteData.originsWithCredentials = NetworkStorageSession::storageSession(sessionID)->credentialStorage().originsWithCredentials();
+    }
 }
 
 void WebProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -178,6 +178,8 @@
     void setCacheModel(CacheModel);
 
     void ensureLegacyPrivateBrowsingSessionInNetworkProcess();
+    void addWebsiteDataStore(WebsiteDataStoreParameters&&);
+    void destroySession(PAL::SessionID);
 
     void pageDidEnterWindow(uint64_t pageID);
     void pageWillLeaveWindow(uint64_t pageID);

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (239734 => 239735)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2019-01-08 20:12:38 UTC (rev 239735)
@@ -53,6 +53,9 @@
 
     ClearCachedCredentials()
 
+    AddWebsiteDataStore(struct WebKit::WebsiteDataStoreParameters websiteDataStoreParameters);
+    DestroySession(PAL::SessionID sessionID)
+
     # Plug-ins.
     DidAddPlugInAutoStartOriginHash(uint32_t hash, WallTime expirationTime, PAL::SessionID sessionID)
     ResetPlugInAutoStartOriginDefaultHashes(HashMap<uint32_t,WallTime> hashes)

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (239734 => 239735)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-01-08 20:12:38 UTC (rev 239735)
@@ -1,5 +1,17 @@
 2019-01-08  Alex Christensen  <achristen...@webkit.org>
 
+        Unreviewed, rolling out r239727.
+
+        Broke API tests
+
+        Reverted changeset:
+
+        "Stop using NetworkStorageSession in WebProcess"
+        https://bugs.webkit.org/show_bug.cgi?id=193236
+        https://trac.webkit.org/changeset/239727
+
+2019-01-08  Alex Christensen  <achristen...@webkit.org>
+
         Stop using NetworkStorageSession in WebProcess
         https://bugs.webkit.org/show_bug.cgi?id=193236
 

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.h (239734 => 239735)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -49,5 +49,5 @@
     RetainPtr<CFDataRef> sourceApplicationAuditData() const override;
     String sourceApplicationIdentifier() const override;
     WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
-    WebCore::NetworkStorageSession* storageSession() const override;
+    WebCore::NetworkStorageSession& storageSession() const override;
 };

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm (239734 => 239735)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebFrameNetworkingContext.mm	2019-01-08 20:12:38 UTC (rev 239735)
@@ -90,14 +90,14 @@
     return frame()->loader().client().blockedError(request);
 }
 
-NetworkStorageSession* WebFrameNetworkingContext::storageSession() const
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
 {
     ASSERT(isMainThread());
     if (frame() && frame()->page() && frame()->page()->sessionID().isEphemeral()) {
         if (auto* session = NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID()))
-            return session;
+            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.");
     }
-    return &NetworkStorageSession::defaultStorageSession();
+    return NetworkStorageSession::defaultStorageSession();
 }

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (239734 => 239735)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-01-08 20:12:38 UTC (rev 239735)
@@ -3668,7 +3668,7 @@
     if (!_private->page)
         return nil;
 
-    if (auto storageSession = _private->page->mainFrame().loader().networkingContext()->storageSession()->platformSession())
+    if (CFURLStorageSessionRef storageSession = _private->page->mainFrame().loader().networkingContext()->storageSession().platformSession())
         cachedResponse = cachedResponseForRequest(storageSession, request.get());
     else
         cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request.get()];
@@ -9251,7 +9251,7 @@
     if (!networkingContext)
         return;
 
-    networkingContext->storageSession()->credentialStorage().clearCredentials();
+    networkingContext->storageSession().credentialStorage().clearCredentials();
 }
 
 - (BOOL)_needsOneShotDrawingSynchronization

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (239734 => 239735)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2019-01-08 20:12:38 UTC (rev 239735)
@@ -1,3 +1,15 @@
+2019-01-08  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r239727.
+
+        Broke API tests
+
+        Reverted changeset:
+
+        "Stop using NetworkStorageSession in WebProcess"
+        https://bugs.webkit.org/show_bug.cgi?id=193236
+        https://trac.webkit.org/changeset/239727
+
 2018-12-24  Fujii Hironori  <hironori.fu...@sony.com>
 
         Remove "using namespace std;"

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp (239734 => 239735)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.cpp	2019-01-08 20:12:38 UTC (rev 239735)
@@ -99,12 +99,12 @@
     return frame()->loader().client().blockedError(request);
 }
 
-NetworkStorageSession* WebFrameNetworkingContext::storageSession() const
+NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
 {
     ASSERT(isMainThread());
 
     if (frame() && frame()->page()->usesEphemeralSession())
-        return NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID());
+        return *NetworkStorageSession::storageSession(PAL::SessionID::legacyPrivateSessionID());
 
-    return &NetworkStorageSession::defaultStorageSession();
+    return NetworkStorageSession::defaultStorageSession();
 }

Modified: trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.h (239734 => 239735)


--- trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.h	2019-01-08 20:09:58 UTC (rev 239734)
+++ trunk/Source/WebKitLegacy/win/WebCoreSupport/WebFrameNetworkingContext.h	2019-01-08 20:12:38 UTC (rev 239735)
@@ -47,5 +47,5 @@
     }
 
     WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const override;
-    WebCore::NetworkStorageSession* storageSession() const override;
+    WebCore::NetworkStorageSession& storageSession() const override;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to