WebKit Bugzilla
Attachment 359352 Details for
Bug 193529
: Stop using NetworkStorageSession::storageSession in WebCore
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193529-20190116230003.patch (text/plain), 57.45 KB, created by
Alex Christensen
on 2019-01-16 23:00:04 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-16 23:00:04 PST
Size:
57.45 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 240091) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,51 @@ >+2019-01-16 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using NetworkStorageSession::storageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Ownership of the map that NetworkStorageSession::storageSession searches needs to move to the WebKit/WebKitLegacy layer, >+ so when WebCore used to look in this map it needs to call a client function to ask the layer above it for the storage object. >+ I've called this client StorageSessionProvider::storageSession. Right now it just looks in NetworkStorageSession::storageSession, >+ but this added abstraction makes it possible to move the currently process-global map to be a member of the NetworkProcess object. >+ >+ * Modules/websockets/WebSocketChannel.cpp: >+ (WebCore::WebSocketChannel::connect): >+ * WebCore.xcodeproj/project.pbxproj: >+ * loader/CookieJar.cpp: >+ (WebCore::CookieJar::create): >+ (WebCore::CookieJar::CookieJar): >+ (WebCore::CookieJar::cookies const): >+ (WebCore::CookieJar::setCookies): >+ (WebCore::CookieJar::cookiesEnabled const): >+ (WebCore::CookieJar::cookieRequestHeaderFieldValue const): >+ (WebCore::CookieJar::getRawCookies const): >+ (WebCore::CookieJar::deleteCookie): >+ * loader/CookieJar.h: >+ * loader/EmptyClients.cpp: >+ (WebCore::pageConfigurationWithEmptyClients): >+ * page/Page.h: >+ * page/SocketProvider.cpp: >+ (WebCore::SocketProvider::createSocketStreamHandle): >+ * page/SocketProvider.h: >+ * platform/network/NetworkingContext.h: >+ * platform/network/SocketStreamHandleImpl.cpp: >+ (WebCore::cookieDataForHandshake): >+ (WebCore::SocketStreamHandleImpl::platformSendHandshake): >+ * platform/network/StorageSessionProvider.h: Added. >+ (WebCore::StorageSessionProvider::~StorageSessionProvider): >+ * platform/network/cf/SocketStreamHandleImpl.h: >+ (WebCore::SocketStreamHandleImpl::create): >+ * platform/network/cf/SocketStreamHandleImplCFNet.cpp: >+ (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl): >+ (WebCore::SocketStreamHandleImpl::getStoredCONNECTProxyCredentials): >+ * platform/network/curl/SocketStreamHandleImpl.h: >+ (WebCore::SocketStreamHandleImpl::create): >+ * platform/network/soup/SocketStreamHandleImpl.h: >+ * platform/network/soup/SocketStreamHandleImplSoup.cpp: >+ (WebCore::SocketStreamHandleImpl::create): >+ > 2019-01-16 Sihui Liu <sihui_liu@apple.com> > > IndexedDB: UniqueIDBDatabase should not be freed if the database task queue is not empty. >Index: Source/WebCore/Modules/websockets/WebSocketChannel.cpp >=================================================================== >--- Source/WebCore/Modules/websockets/WebSocketChannel.cpp (revision 240091) >+++ Source/WebCore/Modules/websockets/WebSocketChannel.cpp (working copy) >@@ -40,6 +40,7 @@ > #include "Frame.h" > #include "InspectorInstrumentation.h" > #include "Logging.h" >+#include "NetworkingContext.h" > #include "Page.h" > #include "ProgressTracker.h" > #include "ResourceRequest.h" >@@ -123,7 +124,7 @@ void WebSocketChannel::connect(const URL > Page* page = frame->page(); > PAL::SessionID sessionID = page ? page->sessionID() : PAL::SessionID::defaultSessionID(); > String partition = m_document->domainForCachePartition(); >- m_handle = m_socketProvider->createSocketStreamHandle(m_handshake->url(), *this, sessionID, partition); >+ m_handle = m_socketProvider->createSocketStreamHandle(m_handshake->url(), *this, sessionID, partition, frame->loader().networkingContext()); > } > } > >Index: Source/WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebCore/WebCore.xcodeproj/project.pbxproj (revision 240091) >+++ Source/WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -1902,6 +1902,7 @@ > 5C4304B1191AC908000E2BC0 /* EXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304AE191AC908000E2BC0 /* EXTShaderTextureLOD.h */; }; > 5C4304B6191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */; }; > 5C7C88D81D0F1F4A009D2F6D /* SocketProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D71D0F1F2B009D2F6D /* SocketProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 5C9EF2E321F009E5003BDC56 /* StorageSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9EF2E121F0097C003BDC56 /* StorageSessionProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5CA1DEC61F71F1C700E71BD3 /* HTTPHeaderField.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CA1DEC41F71E68700E71BD3 /* HTTPHeaderField.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5CB37FFF1C62D2A100F20188 /* ScrollAnimatorMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */; }; > 5CBC8DAD1AAA302200E1C803 /* MediaAccessibilitySoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */; }; >@@ -8902,6 +8903,7 @@ > 5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkLoadMetrics.mm; sourceTree = "<group>"; }; > 5C9EF16F1DFF719900A452E3 /* XPathGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XPathGrammar.cpp; sourceTree = "<group>"; }; > 5C9EF1701DFF719900A452E3 /* XPathGrammar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathGrammar.h; sourceTree = "<group>"; }; >+ 5C9EF2E121F0097C003BDC56 /* StorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageSessionProvider.h; sourceTree = "<group>"; }; > 5CA1DEC21F71E68600E71BD3 /* HTTPHeaderField.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderField.cpp; sourceTree = "<group>"; }; > 5CA1DEC41F71E68700E71BD3 /* HTTPHeaderField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPHeaderField.h; sourceTree = "<group>"; }; > 5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimatorMock.cpp; sourceTree = "<group>"; }; >@@ -19929,6 +19931,7 @@ > 510D4A31103165EE0049EA54 /* SocketStreamHandle.h */, > 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */, > 5C668E641E7C6C3500D32B3B /* SocketStreamHandleImpl.cpp */, >+ 5C9EF2E121F0097C003BDC56 /* StorageSessionProvider.h */, > 4682D1FF1F79782300C863DB /* StoredCredentialsPolicy.h */, > E180811016FCF42E00B80D07 /* SynchronousLoaderClient.cpp */, > E180811516FCF9CB00B80D07 /* SynchronousLoaderClient.h */, >@@ -31529,6 +31532,7 @@ > 51E0BB380DA5ACB600A9E417 /* StorageMap.h in Headers */, > C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */, > 1A37636C1A2E68BB009A7EE2 /* StorageNamespaceProvider.h in Headers */, >+ 5C9EF2E321F009E5003BDC56 /* StorageSessionProvider.h in Headers */, > 5166D3CD1E8ED48F00AD62E3 /* StorageType.h in Headers */, > 4682D2001F79783000C863DB /* StoredCredentialsPolicy.h in Headers */, > 416E6FE81BBD12DF000A6033 /* StreamInternalsBuiltins.h in Headers */, >@@ -32423,6 +32427,7 @@ > Spanish, > Dutch, > Italian, >+ en, > ); > mainGroup = 0867D691FE84028FC02AAC07 /* WebCore */; > productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; >Index: Source/WebCore/loader/CookieJar.cpp >=================================================================== >--- Source/WebCore/loader/CookieJar.cpp (revision 240091) >+++ Source/WebCore/loader/CookieJar.cpp (working copy) >@@ -36,10 +36,16 @@ > #include "NetworkingContext.h" > #include "PlatformStrategies.h" > #include "SameSiteInfo.h" >+#include "StorageSessionProvider.h" > #include <wtf/SystemTracing.h> > > namespace WebCore { > >+Ref<CookieJar> CookieJar::create(Ref<StorageSessionProvider>&& storageSessionProvider) >+{ >+ return adoptRef(*new CookieJar(WTFMove(storageSessionProvider))); >+} >+ > IncludeSecureCookies CookieJar::shouldIncludeSecureCookies(const Document& document, const URL& url) > { > return (url.protocolIs("https") && !document.foundMixedContent().contains(SecurityContext::MixedContentType::Active)) ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; >@@ -52,9 +58,9 @@ SameSiteInfo CookieJar::sameSiteInfo(con > return { }; > } > >-Ref<CookieJar> CookieJar::create() >+CookieJar::CookieJar(Ref<StorageSessionProvider>&& storageSessionProvider) >+ : m_storageSessionProvider(WTFMove(storageSessionProvider)) > { >- return adoptRef(*new CookieJar); > } > > CookieJar::~CookieJar() = default; >@@ -73,7 +79,7 @@ String CookieJar::cookies(Document& docu > } > > std::pair<String, bool> result; >- if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ if (auto* session = m_storageSessionProvider->storageSession()) > result = session->cookiesForDOM(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, includeSecureCookies); > else > ASSERT_NOT_REACHED(); >@@ -110,24 +116,24 @@ void CookieJar::setCookies(Document& doc > pageID = frame->loader().client().pageID(); > } > >- if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ if (auto* session = m_storageSessionProvider->storageSession()) > session->setCookiesFromDOM(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, cookieString); > else > ASSERT_NOT_REACHED(); > } > >-bool CookieJar::cookiesEnabled(const Document& document) const >+bool CookieJar::cookiesEnabled(const Document&) const > { >- if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ if (auto* session = m_storageSessionProvider->storageSession()) > return session->cookiesEnabled(); > > ASSERT_NOT_REACHED(); > return false; > } > >-std::pair<String, SecureCookiesAccessed> CookieJar::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const >+std::pair<String, SecureCookiesAccessed> CookieJar::cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) const > { >- if (auto* session = NetworkStorageSession::storageSession(sessionID)) { >+ if (auto* session = m_storageSessionProvider->storageSession()) { > std::pair<String, bool> result = session->cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); > return { result.first, result.second ? SecureCookiesAccessed::Yes : SecureCookiesAccessed::No }; > } >@@ -160,16 +166,16 @@ bool CookieJar::getRawCookies(const Docu > pageID = frame->loader().client().pageID(); > } > >- if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ if (auto* session = m_storageSessionProvider->storageSession()) > return session->getRawCookies(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, cookies); > > ASSERT_NOT_REACHED(); > return false; > } > >-void CookieJar::deleteCookie(const Document& document, const URL& url, const String& cookieName) >+void CookieJar::deleteCookie(const Document&, const URL& url, const String& cookieName) > { >- if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ if (auto* session = m_storageSessionProvider->storageSession()) > session->deleteCookie(url, cookieName); > else > ASSERT_NOT_REACHED(); >Index: Source/WebCore/loader/CookieJar.h >=================================================================== >--- Source/WebCore/loader/CookieJar.h (revision 240091) >+++ Source/WebCore/loader/CookieJar.h (working copy) >@@ -26,6 +26,7 @@ > #pragma once > > #include <wtf/Forward.h> >+#include <wtf/UniqueRef.h> > #include <wtf/text/WTFString.h> > > namespace PAL { >@@ -40,11 +41,13 @@ enum class SecureCookiesAccessed : bool > class Document; > struct Cookie; > struct CookieRequestHeaderFieldProxy; >+class NetworkStorageSession; >+class StorageSessionProvider; > struct SameSiteInfo; > > class WEBCORE_EXPORT CookieJar : public RefCounted<CookieJar> { > public: >- static Ref<CookieJar> create(); >+ static Ref<CookieJar> create(Ref<StorageSessionProvider>&&); > > static CookieRequestHeaderFieldProxy cookieRequestHeaderFieldProxy(const Document&, const URL&); > >@@ -63,6 +66,10 @@ public: > protected: > static SameSiteInfo sameSiteInfo(const Document&); > static IncludeSecureCookies shouldIncludeSecureCookies(const Document&, const URL&); >+ CookieJar(Ref<StorageSessionProvider>&&); >+ >+private: >+ Ref<StorageSessionProvider> m_storageSessionProvider; > }; > > } // namespace WebCore >Index: Source/WebCore/loader/EmptyClients.cpp >=================================================================== >--- Source/WebCore/loader/EmptyClients.cpp (revision 240091) >+++ Source/WebCore/loader/EmptyClients.cpp (working copy) >@@ -535,6 +535,10 @@ Ref<StorageNamespace> EmptyStorageNamesp > return adoptRef(*new EmptyStorageNamespace); > } > >+class EmptyStorageSessionProvider : public StorageSessionProvider { >+ NetworkStorageSession* storageSession() const final { return nullptr; } >+}; >+ > PageConfiguration pageConfigurationWithEmptyClients() > { > PageConfiguration pageConfiguration { >@@ -543,7 +547,7 @@ PageConfiguration pageConfigurationWithE > LibWebRTCProvider::create(), > CacheStorageProvider::create(), > adoptRef(*new EmptyBackForwardClient), >- CookieJar::create() >+ CookieJar::create(adoptRef(*new EmptyStorageSessionProvider)) > }; > > static NeverDestroyed<EmptyChromeClient> dummyChromeClient; >Index: Source/WebCore/page/Page.h >=================================================================== >--- Source/WebCore/page/Page.h (revision 240091) >+++ Source/WebCore/page/Page.h (working copy) >@@ -47,6 +47,7 @@ > #include <wtf/Noncopyable.h> > #include <wtf/Ref.h> > #include <wtf/UniqueRef.h> >+#include <wtf/WeakPtr.h> > #include <wtf/text/WTFString.h> > > #if PLATFORM(COCOA) >@@ -166,7 +167,7 @@ enum class DidWrap : bool; > enum class RouteSharingPolicy : uint8_t; > enum class ShouldTreatAsContinuingLoad : bool; > >-class Page : public Supplementable<Page> { >+class Page : public Supplementable<Page>, public CanMakeWeakPtr<Page> { > WTF_MAKE_NONCOPYABLE(Page); > WTF_MAKE_FAST_ALLOCATED; > friend class SettingsBase; >Index: Source/WebCore/page/SocketProvider.cpp >=================================================================== >--- Source/WebCore/page/SocketProvider.cpp (revision 240091) >+++ Source/WebCore/page/SocketProvider.cpp (working copy) >@@ -30,9 +30,9 @@ > > namespace WebCore { > >-Ref<SocketStreamHandle> SocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition) >+Ref<SocketStreamHandle> SocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, const StorageSessionProvider* provider) > { >- return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }); >+ return SocketStreamHandleImpl::create(url, client, sessionID, credentialPartition, { }, provider); > } > > } >Index: Source/WebCore/page/SocketProvider.h >=================================================================== >--- Source/WebCore/page/SocketProvider.h (revision 240091) >+++ Source/WebCore/page/SocketProvider.h (working copy) >@@ -31,6 +31,7 @@ > > namespace WebCore { > >+class StorageSessionProvider; > class ScriptExecutionContext; > class SocketStreamHandle; > class SocketStreamHandleClient; >@@ -38,7 +39,7 @@ class SocketStreamHandleClient; > class WEBCORE_EXPORT SocketProvider : public ThreadSafeRefCounted<SocketProvider> { > public: > static Ref<SocketProvider> create() { return adoptRef(*new SocketProvider); } >- virtual Ref<SocketStreamHandle> createSocketStreamHandle(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition); >+ virtual Ref<SocketStreamHandle> createSocketStreamHandle(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, const StorageSessionProvider*); > virtual ~SocketProvider() { }; > }; > >Index: Source/WebCore/platform/network/NetworkingContext.h >=================================================================== >--- Source/WebCore/platform/network/NetworkingContext.h (revision 240091) >+++ Source/WebCore/platform/network/NetworkingContext.h (working copy) >@@ -19,7 +19,7 @@ > > #pragma once > >-#include <wtf/RefCounted.h> >+#include "StorageSessionProvider.h" > #include <wtf/RetainPtr.h> > #include <wtf/text/WTFString.h> > >@@ -41,7 +41,7 @@ class NetworkStorageSession; > class ResourceError; > class ResourceRequest; > >-class NetworkingContext : public RefCounted<NetworkingContext> { >+class NetworkingContext : public StorageSessionProvider { > public: > virtual ~NetworkingContext() = default; > >@@ -58,8 +58,6 @@ public: > > virtual String sourceApplicationIdentifier() const { return emptyString(); } > >- virtual NetworkStorageSession* storageSession() const = 0; >- > #if PLATFORM(WIN) > virtual ResourceError blockedError(const ResourceRequest&) const = 0; > #endif >Index: Source/WebCore/platform/network/SocketStreamHandleImpl.cpp >=================================================================== >--- Source/WebCore/platform/network/SocketStreamHandleImpl.cpp (revision 240091) >+++ Source/WebCore/platform/network/SocketStreamHandleImpl.cpp (working copy) >@@ -76,9 +76,8 @@ static size_t removeTerminationCharacter > return dataLength - 2; > } > >-static Optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(const CookieRequestHeaderFieldProxy& headerFieldProxy) >+static Optional<std::pair<Vector<uint8_t>, bool>> cookieDataForHandshake(const NetworkStorageSession* networkStorageSession, const CookieRequestHeaderFieldProxy& headerFieldProxy) > { >- auto networkStorageSession = NetworkStorageSession::storageSession(headerFieldProxy.sessionID); > if (!networkStorageSession) > return WTF::nullopt; > >@@ -103,7 +102,7 @@ void SocketStreamHandleImpl::platformSen > bool secureCookiesAccessed = false; > > if (headerFieldProxy) { >- auto cookieDataFromNetworkSession = cookieDataForHandshake(headerFieldProxy.value()); >+ auto cookieDataFromNetworkSession = cookieDataForHandshake(m_storageSessionProvider ? m_storageSessionProvider->storageSession() : nullptr, *headerFieldProxy); > if (!cookieDataFromNetworkSession) { > completionHandler(false, false); > return; >Index: Source/WebCore/platform/network/StorageSessionProvider.h >=================================================================== >--- Source/WebCore/platform/network/StorageSessionProvider.h (nonexistent) >+++ Source/WebCore/platform/network/StorageSessionProvider.h (working copy) >@@ -0,0 +1,45 @@ >+/* >+ * Copyright (C) 2019 Apple, Inc. All Rights Reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace PAL { >+class SessionID; >+} >+ >+namespace WebCore { >+ >+class NetworkStorageSession; >+ >+class StorageSessionProvider : public ThreadSafeRefCounted<StorageSessionProvider> { >+public: >+ virtual NetworkStorageSession* storageSession() const = 0; >+ >+ virtual ~StorageSessionProvider() { } >+}; >+ >+} // namespace WebCore >Index: Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h >=================================================================== >--- Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h (revision 240091) >+++ Source/WebCore/platform/network/cf/SocketStreamHandleImpl.h (working copy) >@@ -41,12 +41,13 @@ typedef struct __CFHTTPMessage* CFHTTPMe > namespace WebCore { > > class Credential; >+class StorageSessionProvider; > class ProtectionSpace; > class SocketStreamHandleClient; > > class SocketStreamHandleImpl : public SocketStreamHandle { > public: >- static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID, credentialPartition, WTFMove(auditData))); } >+ static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider) { return adoptRef(*new SocketStreamHandleImpl(url, client, sessionID, credentialPartition, WTFMove(auditData), provider)); } > > virtual ~SocketStreamHandleImpl(); > >@@ -58,7 +59,7 @@ private: > Optional<size_t> platformSendInternal(const uint8_t*, size_t); > bool sendPendingData(); > >- WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&); >+ WEBCORE_EXPORT SocketStreamHandleImpl(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, SourceApplicationAuditToken&&, const StorageSessionProvider*); > void createStreams(); > void scheduleStreams(); > void chooseProxy(); >@@ -103,6 +104,7 @@ private: > PAL::SessionID m_sessionID; > String m_credentialPartition; > SourceApplicationAuditToken m_auditData; >+ RefPtr<const StorageSessionProvider> m_storageSessionProvider; > > StreamBuffer<uint8_t, 1024 * 1024> m_buffer; > static const unsigned maxBufferSize = 100 * 1024 * 1024; >Index: Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp >=================================================================== >--- Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (revision 240091) >+++ Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (working copy) >@@ -40,6 +40,7 @@ > #include "ProtectionSpace.h" > #include "SocketStreamError.h" > #include "SocketStreamHandleClient.h" >+#include "StorageSessionProvider.h" > #include <CFNetwork/CFNetwork.h> > #include <wtf/Condition.h> > #include <wtf/Lock.h> >@@ -95,7 +96,7 @@ static inline auto callbacksRunLoopMode( > #endif > } > >-SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData) >+SocketStreamHandleImpl::SocketStreamHandleImpl(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, SourceApplicationAuditToken&& auditData, const StorageSessionProvider* provider) > : SocketStreamHandle(url, client) > , m_connectingSubstate(New) > , m_connectionType(Unknown) >@@ -103,6 +104,7 @@ SocketStreamHandleImpl::SocketStreamHand > , m_sessionID(sessionID) > , m_credentialPartition(credentialPartition) > , m_auditData(WTFMove(auditData)) >+ , m_storageSessionProvider(provider) > { > LOG(Network, "SocketStreamHandle %p new client %p", this, &m_client); > >@@ -367,7 +369,7 @@ bool SocketStreamHandleImpl::getStoredCO > > // Try system credential storage first, matching HTTP behavior (CFNetwork only asks the client for password if it couldn't find it in Keychain). > Credential storedCredential; >- if (auto* storageSession = NetworkStorageSession::storageSession(m_sessionID)) { >+ if (auto* storageSession = m_storageSessionProvider ? m_storageSessionProvider->storageSession() : nullptr) { > storedCredential = storageSession->credentialStorage().getFromPersistentStorage(protectionSpace); > if (storedCredential.isEmpty()) > storedCredential = storageSession->credentialStorage().get(m_credentialPartition, protectionSpace); >Index: Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h >=================================================================== >--- Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h (revision 240091) >+++ Source/WebCore/platform/network/curl/SocketStreamHandleImpl.h (working copy) >@@ -47,7 +47,7 @@ class SocketStreamHandleClient; > > class SocketStreamHandleImpl : public SocketStreamHandle { > public: >- static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID, const String&, SourceApplicationAuditToken&&) { return adoptRef(*new SocketStreamHandleImpl(url, client)); } >+ static Ref<SocketStreamHandleImpl> create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const NetworkStorageSessionProvider*) { return adoptRef(*new SocketStreamHandleImpl(url, client)); } > > virtual ~SocketStreamHandleImpl(); > >Index: Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h >=================================================================== >--- Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h (revision 240091) >+++ Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h (working copy) >@@ -51,7 +51,7 @@ class SocketStreamHandleClient; > > class SocketStreamHandleImpl final : public SocketStreamHandle { > public: >- static Ref<SocketStreamHandleImpl> create(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String&, SourceApplicationAuditToken&&); >+ static Ref<SocketStreamHandleImpl> create(const URL&, SocketStreamHandleClient&, PAL::SessionID, const String&, SourceApplicationAuditToken&&, const NetworkStorageSessionProvider*); > virtual ~SocketStreamHandleImpl(); > > const URL& url() const { return m_url; } >Index: Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp >=================================================================== >--- Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp (revision 240091) >+++ Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp (working copy) >@@ -37,6 +37,7 @@ > #include "DeprecatedGlobalSettings.h" > #include "Logging.h" > #include "NetworkStorageSession.h" >+#include "NetworkStorageSessionProvider.h" > #include "ResourceError.h" > #include "SocketStreamError.h" > #include "SocketStreamHandleClient.h" >@@ -81,12 +82,12 @@ static void socketClientEventCallback(GS > } > #endif > >-Ref<SocketStreamHandleImpl> SocketStreamHandleImpl::create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String&, SourceApplicationAuditToken&&) >+Ref<SocketStreamHandleImpl> SocketStreamHandleImpl::create(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String&, SourceApplicationAuditToken&&, const NetworkStorageSessionProvider* networkStorageSessionProvider) > { > Ref<SocketStreamHandleImpl> socket = adoptRef(*new SocketStreamHandleImpl(url, client)); > > #if SOUP_CHECK_VERSION(2, 61, 90) >- auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID); >+ auto* networkStorageSession = networkStorageSessionProvider ? networkStorageSessionProvider->storageSession() : nullptr; > if (!networkStorageSession) > return socket; > >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 240104) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,26 @@ >+2019-01-16 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using NetworkStorageSession::storageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/NetworkConnectionToWebProcess.cpp: >+ (WebKit::NetworkConnectionToWebProcess::createSocketStream): >+ * NetworkProcess/NetworkProcess.h: >+ * NetworkProcess/NetworkSocketStream.cpp: >+ (WebKit::NetworkSocketStream::create): >+ (WebKit::NetworkSocketStream::NetworkSocketStream): >+ * NetworkProcess/NetworkSocketStream.h: >+ * NetworkProcess/NetworkStorageSessionProvider.h: Added. >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/Network/WebSocketProvider.cpp: >+ (WebKit::WebSocketProvider::createSocketStreamHandle): >+ * WebProcess/Network/WebSocketProvider.h: >+ * WebProcess/WebPage/WebCookieJar.cpp: >+ (WebKit::WebCookieJar::WebCookieJar): >+ * WebProcess/WebPage/WebCookieJar.h: >+ > 2019-01-16 Youenn Fablet <youenn@apple.com> > > Add a new SPI for controlling getUserMedia >Index: Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (revision 240091) >+++ Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (working copy) >@@ -281,7 +281,7 @@ void NetworkConnectionToWebProcess::crea > #if PLATFORM(COCOA) > token = { m_networkProcess->sourceApplicationAuditData() }; > #endif >- m_networkSocketStreams.set(identifier, NetworkSocketStream::create(WTFMove(url), sessionID, cachePartition, identifier, m_connection, WTFMove(token))); >+ m_networkSocketStreams.set(identifier, NetworkSocketStream::create(m_networkProcess.get(), WTFMove(url), sessionID, cachePartition, identifier, m_connection, WTFMove(token))); > } > > void NetworkConnectionToWebProcess::destroySocketStream(uint64_t identifier) >Index: Source/WebKit/NetworkProcess/NetworkProcess.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcess.h (revision 240091) >+++ Source/WebKit/NetworkProcess/NetworkProcess.h (working copy) >@@ -44,6 +44,7 @@ > #include <wtf/MemoryPressureHandler.h> > #include <wtf/NeverDestroyed.h> > #include <wtf/RetainPtr.h> >+#include <wtf/WeakPtr.h> > > namespace IPC { > class FormDataReference; >@@ -92,7 +93,7 @@ namespace NetworkCache { > class Cache; > } > >-class NetworkProcess : public ChildProcess, private DownloadManager::Client, public ThreadSafeRefCounted<NetworkProcess> >+class NetworkProcess : public ChildProcess, private DownloadManager::Client, public ThreadSafeRefCounted<NetworkProcess>, public CanMakeWeakPtr<NetworkProcess> > #if ENABLE(INDEXED_DATABASE) > , public WebCore::IDBServer::IDBBackingStoreTemporaryFileHandler > #endif >Index: Source/WebKit/NetworkProcess/NetworkSocketStream.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkSocketStream.cpp (revision 240091) >+++ Source/WebKit/NetworkProcess/NetworkSocketStream.cpp (working copy) >@@ -27,6 +27,7 @@ > #include "NetworkSocketStream.h" > > #include "DataReference.h" >+#include "NetworkStorageSessionProvider.h" > #include "WebSocketStreamMessages.h" > #include <WebCore/CookieRequestHeaderFieldProxy.h> > #include <WebCore/SocketStreamError.h> >@@ -34,15 +35,15 @@ > namespace WebKit { > using namespace WebCore; > >-Ref<NetworkSocketStream> NetworkSocketStream::create(URL&& url, PAL::SessionID sessionID, const String& credentialPartition, uint64_t identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData) >+Ref<NetworkSocketStream> NetworkSocketStream::create(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, uint64_t identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData) > { >- return adoptRef(*new NetworkSocketStream(WTFMove(url), sessionID, credentialPartition, identifier, connection, WTFMove(auditData))); >+ return adoptRef(*new NetworkSocketStream(networkProcess, WTFMove(url), sessionID, credentialPartition, identifier, connection, WTFMove(auditData))); > } > >-NetworkSocketStream::NetworkSocketStream(URL&& url, PAL::SessionID sessionID, const String& credentialPartition, uint64_t identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData) >+NetworkSocketStream::NetworkSocketStream(NetworkProcess& networkProcess, URL&& url, PAL::SessionID sessionID, const String& credentialPartition, uint64_t identifier, IPC::Connection& connection, SourceApplicationAuditToken&& auditData) > : m_identifier(identifier) > , m_connection(connection) >- , m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData))) >+ , m_impl(SocketStreamHandleImpl::create(url, *this, sessionID, credentialPartition, WTFMove(auditData), NetworkStorageSessionProvider::create(networkProcess, sessionID).ptr())) > { > } > >Index: Source/WebKit/NetworkProcess/NetworkSocketStream.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkSocketStream.h (revision 240091) >+++ Source/WebKit/NetworkProcess/NetworkSocketStream.h (working copy) >@@ -39,9 +39,11 @@ class DataReference; > > namespace WebKit { > >+class NetworkProcess; >+ > class NetworkSocketStream : public RefCounted<NetworkSocketStream>, public IPC::MessageSender, public IPC::MessageReceiver, public WebCore::SocketStreamHandleClient { > public: >- static Ref<NetworkSocketStream> create(URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&); >+ static Ref<NetworkSocketStream> create(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&); > ~NetworkSocketStream(); > > void didReceiveMessage(IPC::Connection&, IPC::Decoder&); >@@ -62,7 +64,7 @@ private: > IPC::Connection* messageSenderConnection() final; > uint64_t messageSenderDestinationID() final; > >- NetworkSocketStream(URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&); >+ NetworkSocketStream(NetworkProcess&, URL&&, PAL::SessionID, const String& credentialPartition, uint64_t, IPC::Connection&, WebCore::SourceApplicationAuditToken&&); > > uint64_t m_identifier; > IPC::Connection& m_connection; >Index: Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h (nonexistent) >+++ Source/WebKit/NetworkProcess/NetworkStorageSessionProvider.h (working copy) >@@ -0,0 +1,56 @@ >+/* >+ * Copyright (C) 2019 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. >+ */ >+ >+#pragma once >+ >+#include "NetworkProcess.h" >+#include <WebCore/NetworkStorageSession.h> >+#include <WebCore/StorageSessionProvider.h> >+#include <pal/SessionID.h> >+#include <wtf/WeakPtr.h> >+ >+namespace WebKit { >+ >+class NetworkStorageSessionProvider final : public WebCore::StorageSessionProvider { >+public: >+ static Ref<NetworkStorageSessionProvider> create(NetworkProcess& networkProcess, const PAL::SessionID& sessionID) { return adoptRef(*new NetworkStorageSessionProvider(networkProcess, sessionID)); } >+ >+private: >+ NetworkStorageSessionProvider(NetworkProcess& networkProcess, const PAL::SessionID& sessionID) >+ : m_networkProcess(makeWeakPtr(networkProcess)) >+ , m_sessionID(sessionID) { } >+ >+ WebCore::NetworkStorageSession* storageSession() const final >+ { >+ if (m_networkProcess) >+ return WebCore::NetworkStorageSession::storageSession(m_sessionID); >+ return nullptr; >+ } >+ >+ WeakPtr<NetworkProcess> m_networkProcess; >+ PAL::SessionID m_sessionID; >+}; >+ >+} >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 240091) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -3443,6 +3443,7 @@ > 5C8DD3811FE455CA00F2A556 /* WebsiteAutoplayQuirk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteAutoplayQuirk.h; sourceTree = "<group>"; }; > 5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKWebsitePolicies.cpp; sourceTree = "<group>"; }; > 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsitePolicies.h; sourceTree = "<group>"; }; >+ 5C9EF2E721F058F9003BDC56 /* NetworkStorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkStorageSessionProvider.h; sourceTree = "<group>"; }; > 5CA26D7F217ABBB600F97A35 /* WKSafeBrowsingWarning.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKSafeBrowsingWarning.mm; sourceTree = "<group>"; }; > 5CA26D80217ABBB600F97A35 /* WKSafeBrowsingWarning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSafeBrowsingWarning.h; sourceTree = "<group>"; }; > 5CA98549210BEB5A0057EB6B /* SafeBrowsingWarning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SafeBrowsingWarning.h; sourceTree = "<group>"; }; >@@ -6434,6 +6435,7 @@ > 5C0B177D1E7C886700E9123C /* NetworkSocketStream.cpp */, > 5C0B177E1E7C886700E9123C /* NetworkSocketStream.h */, > 5C0B177F1E7C886700E9123C /* NetworkSocketStream.messages.in */, >+ 5C9EF2E721F058F9003BDC56 /* NetworkStorageSessionProvider.h */, > 462107D71F38DBD300DD7810 /* PingLoad.cpp */, > 5CE85B1F1C88E6430070BFCE /* PingLoad.h */, > 83A0ED331F747CC7003299EB /* PreconnectTask.cpp */, >Index: Source/WebKit/WebProcess/Network/WebSocketProvider.cpp >=================================================================== >--- Source/WebKit/WebProcess/Network/WebSocketProvider.cpp (revision 240091) >+++ Source/WebKit/WebProcess/Network/WebSocketProvider.cpp (working copy) >@@ -36,7 +36,7 @@ > namespace WebKit { > using namespace WebCore; > >-Ref<SocketStreamHandle> WebSocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition) >+Ref<SocketStreamHandle> WebSocketProvider::createSocketStreamHandle(const URL& url, SocketStreamHandleClient& client, PAL::SessionID sessionID, const String& credentialPartition, const StorageSessionProvider*) > { > return WebSocketStream::create(url, client, sessionID, credentialPartition); > } >Index: Source/WebKit/WebProcess/Network/WebSocketProvider.h >=================================================================== >--- Source/WebKit/WebProcess/Network/WebSocketProvider.h (revision 240091) >+++ Source/WebKit/WebProcess/Network/WebSocketProvider.h (working copy) >@@ -32,7 +32,7 @@ namespace WebKit { > class WebSocketProvider final : public WebCore::SocketProvider { > public: > static Ref<WebSocketProvider> create() { return adoptRef(*new WebSocketProvider); } >- Ref<WebCore::SocketStreamHandle> createSocketStreamHandle(const URL&, WebCore::SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition) final; >+ Ref<WebCore::SocketStreamHandle> createSocketStreamHandle(const URL&, WebCore::SocketStreamHandleClient&, PAL::SessionID, const String& credentialPartition, const WebCore::StorageSessionProvider*) final; > virtual ~WebSocketProvider() { } > }; > >Index: Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp (revision 240091) >+++ Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp (working copy) >@@ -34,9 +34,18 @@ > #include <WebCore/Frame.h> > #include <WebCore/FrameLoader.h> > #include <WebCore/FrameLoaderClient.h> >+#include <WebCore/StorageSessionProvider.h> > > namespace WebKit { > >+class WebStorageSessionProvider : public WebCore::StorageSessionProvider { >+ // NetworkStorageSessions are accessed only in the NetworkProcess. >+ WebCore::NetworkStorageSession* storageSession() const final { return nullptr; } >+}; >+ >+WebCookieJar::WebCookieJar() >+ : WebCore::CookieJar(adoptRef(*new WebStorageSessionProvider)) { } >+ > String WebCookieJar::cookies(WebCore::Document& document, const URL& url) const > { > Optional<uint64_t> frameID; >Index: Source/WebKit/WebProcess/WebPage/WebCookieJar.h >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebCookieJar.h (revision 240091) >+++ Source/WebKit/WebProcess/WebPage/WebCookieJar.h (working copy) >@@ -39,6 +39,8 @@ public: > std::pair<String, WebCore::SecureCookiesAccessed> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) const final; > bool getRawCookies(const WebCore::Document&, const URL&, Vector<WebCore::Cookie>&) const final; > void deleteCookie(const WebCore::Document&, const URL&, const String& cookieName) final; >+private: >+ WebCookieJar(); > }; > > } // namespace WebKit >Index: Source/WebKitLegacy/ChangeLog >=================================================================== >--- Source/WebKitLegacy/ChangeLog (revision 240091) >+++ Source/WebKitLegacy/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-01-16 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using NetworkStorageSession::storageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/PageStorageSessionProvider.h: Added. >+ * WebKitLegacy.xcodeproj/project.pbxproj: >+ > 2019-01-04 Youenn Fablet <youenn@apple.com> > > CSP violation reports should bypass CSP checks >Index: Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h >=================================================================== >--- Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h (nonexistent) >+++ Source/WebKitLegacy/WebCoreSupport/PageStorageSessionProvider.h (working copy) >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <WebCore/NetworkStorageSession.h> >+#include <WebCore/Page.h> >+#include <WebCore/StorageSessionProvider.h> >+#include <wtf/WeakPtr.h> >+ >+class PageStorageSessionProvider final : public WebCore::StorageSessionProvider { >+public: >+ static Ref<PageStorageSessionProvider> create() { return adoptRef(*new PageStorageSessionProvider); } >+ >+ WebCore::NetworkStorageSession* storageSession() const >+ { >+ if (m_page) >+ return WebCore::NetworkStorageSession::storageSession(m_page->sessionID()); >+ return nullptr; >+ } >+ >+ void setPage(WebCore::Page& page) >+ { >+ m_page = makeWeakPtr(page); >+ } >+ >+private: >+ WeakPtr<WebCore::Page> m_page; >+}; >Index: Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (revision 240091) >+++ Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (working copy) >@@ -147,6 +147,7 @@ > 598AD9281201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm in Sources */ = {isa = PBXBuildFile; fileRef = 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */; }; > 598AD92A1201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */; }; > 598ADA461202275000ABAE4E /* WebDeviceOrientationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 5C9EF2E621F04BA3003BDC56 /* PageStorageSessionProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9EF2E521F04BA3003BDC56 /* PageStorageSessionProvider.h */; }; > 5CE44F4A206D70EA003EFD01 /* PingHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CE44F49206D70E9003EFD01 /* PingHandle.h */; }; > 5D7BF8140C2A1D90008CE06D /* WebInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D7BF8120C2A1D90008CE06D /* WebInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5D7BF8150C2A1D90008CE06D /* WebInspector.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */; }; >@@ -986,6 +987,7 @@ > 598AD9271201CF3200ABAE4E /* WebDeviceOrientationProviderMock.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDeviceOrientationProviderMock.mm; sourceTree = "<group>"; }; > 598AD9291201CF3B00ABAE4E /* WebDeviceOrientationProviderMockInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProviderMockInternal.h; sourceTree = "<group>"; }; > 598ADA451202275000ABAE4E /* WebDeviceOrientationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationProvider.h; sourceTree = "<group>"; }; >+ 5C9EF2E521F04BA3003BDC56 /* PageStorageSessionProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PageStorageSessionProvider.h; path = WebCoreSupport/PageStorageSessionProvider.h; sourceTree = SOURCE_ROOT; }; > 5CE44F49206D70E9003EFD01 /* PingHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PingHandle.h; path = WebCoreSupport/PingHandle.h; sourceTree = SOURCE_ROOT; }; > 5D7BF8120C2A1D90008CE06D /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; }; > 5D7BF8130C2A1D90008CE06D /* WebInspector.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspector.mm; sourceTree = "<group>"; }; >@@ -2554,6 +2556,7 @@ > A10C1D4418202FFB0036883A /* ios */, > B82958D1132707D0000D0E79 /* CorrectionPanel.h */, > B82958D2132707D0000D0E79 /* CorrectionPanel.mm */, >+ 5C9EF2E521F04BA3003BDC56 /* PageStorageSessionProvider.h */, > 5CE44F49206D70E9003EFD01 /* PingHandle.h */, > 7C01CB81173435C900C5D807 /* PopupMenuMac.h */, > 7C01CB82173435C900C5D807 /* PopupMenuMac.mm */, >@@ -2934,6 +2937,7 @@ > E1531BD82187B954002E3F81 /* NSURLDownloadSPI.h in Headers */, > 93D4379B1D57ABEF00AB85EA /* ObjCEventListener.h in Headers */, > 93D4379D1D57ABEF00AB85EA /* ObjCNodeFilterCondition.h in Headers */, >+ 5C9EF2E621F04BA3003BDC56 /* PageStorageSessionProvider.h in Headers */, > 5CE44F4A206D70EA003EFD01 /* PingHandle.h in Headers */, > A10C1D5F1820300E0036883A /* PopupMenuIOS.h in Headers */, > 7C01CB85173435C900C5D807 /* PopupMenuMac.h in Headers */, >@@ -3230,6 +3234,7 @@ > Spanish, > Dutch, > Italian, >+ en, > ); > mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */; > productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 240091) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-01-16 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using NetworkStorageSession::storageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Misc/WebCache.mm: >+ (+[WebCache addImageToCache:forURL:forFrame:]): >+ * WebView/WebView.mm: >+ (-[WebView _commonInitializationWithFrameName:groupName:]): >+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >Index: Source/WebKitLegacy/mac/Misc/WebCache.mm >=================================================================== >--- Source/WebKitLegacy/mac/Misc/WebCache.mm (revision 240091) >+++ Source/WebKitLegacy/mac/Misc/WebCache.mm (working copy) >@@ -38,6 +38,7 @@ > #import <WebCore/Document.h> > #import <WebCore/MemoryCache.h> > #import <WebCore/NetworkStorageSession.h> >+#import <WebCore/StorageSessionProvider.h> > #import <wtf/MainThread.h> > #import <wtf/RunLoop.h> > >@@ -50,6 +51,13 @@ > #import <WebCore/WebCoreThreadRun.h> > #endif > >+class DefaultStorageSessionProvider : public WebCore::StorageSessionProvider { >+ WebCore::NetworkStorageSession* storageSession() const final >+ { >+ return &WebCore::NetworkStorageSession::defaultStorageSession(); >+ } >+}; >+ > @implementation WebCache > > + (void)initialize >@@ -165,7 +173,8 @@ + (bool)addImageToCache:(CGImageRef)imag > if (!image || !url || ![[url absoluteString] length]) > return false; > >- return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, frame ? core(frame)->document()->domainForCachePartition() : emptyString(), PAL::SessionID::defaultSessionID(), WebCore::CookieJar::create().ptr()); >+ auto provider = adoptRef(*new DefaultStorageSessionProvider); >+ return WebCore::MemoryCache::singleton().addImageToCache(RetainPtr<CGImageRef>(image), url, frame ? core(frame)->document()->domainForCachePartition() : emptyString(), PAL::SessionID::defaultSessionID(), WebCore::CookieJar::create(WTFMove(provider)).ptr()); > } > > + (void)removeImageFromCacheForURL:(NSURL *)url >Index: Source/WebKitLegacy/mac/WebView/WebView.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebView.mm (revision 240091) >+++ Source/WebKitLegacy/mac/WebView/WebView.mm (working copy) >@@ -37,6 +37,7 @@ > #import "DOMInternal.h" > #import "DOMNodeInternal.h" > #import "DOMRangeInternal.h" >+#import "PageStorageSessionProvider.h" > #import "StorageThread.h" > #import "WebAlternativeTextClient.h" > #import "WebApplicationCacheInternal.h" >@@ -1440,13 +1441,14 @@ - (void)_commonInitializationWithFrameNa > _private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath); > _private->group->addWebView(self); > >+ auto storageProvider = PageStorageSessionProvider::create(); > PageConfiguration pageConfiguration( > makeUniqueRef<WebEditorClient>(self), > SocketProvider::create(), > LibWebRTCProvider::create(), > WebCore::CacheStorageProvider::create(), > BackForwardList::create(self), >- CookieJar::create() >+ CookieJar::create(storageProvider.copyRef()) > ); > #if !PLATFORM(IOS_FAMILY) > pageConfiguration.chromeClient = new WebChromeClient(self); >@@ -1477,6 +1479,7 @@ - (void)_commonInitializationWithFrameNa > pageConfiguration.userContentProvider = &_private->group->userContentController(); > pageConfiguration.visitedLinkStore = &_private->group->visitedLinkStore(); > _private->page = new Page(WTFMove(pageConfiguration)); >+ storageProvider->setPage(*_private->page); > > _private->page->setGroupName(groupName); > >@@ -1706,13 +1709,14 @@ - (id)initSimpleHTMLDocumentWithStyle:(N > _private->group = WebViewGroup::getOrCreate(groupName, _private->preferences._localStorageDatabasePath); > _private->group->addWebView(self); > >+ auto storageProvider = PageStorageSessionProvider::create(); > PageConfiguration pageConfiguration( > makeUniqueRef<WebEditorClient>(self), > SocketProvider::create(), > LibWebRTCProvider::create(), > WebCore::CacheStorageProvider::create(), > BackForwardList::create(self), >- CookieJar::create() >+ CookieJar::create(storageProvider.copyRef()) > ); > pageConfiguration.chromeClient = new WebChromeClientIOS(self); > #if ENABLE(DRAG_SUPPORT) >@@ -1734,6 +1738,7 @@ - (id)initSimpleHTMLDocumentWithStyle:(N > pageConfiguration.pluginInfoProvider = &WebPluginInfoProvider::singleton(); > > _private->page = new Page(WTFMove(pageConfiguration)); >+ storageProvider->setPage(*_private->page); > > [self setSmartInsertDeleteEnabled:YES]; > >Index: Source/WebKitLegacy/win/ChangeLog >=================================================================== >--- Source/WebKitLegacy/win/ChangeLog (revision 240091) >+++ Source/WebKitLegacy/win/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2019-01-16 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using NetworkStorageSession::storageSession in WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=193529 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView.cpp: >+ (WebView::initWithFrame): >+ > 2019-01-15 Alex Christensen <achristensen@webkit.org> > > Reduce use of NetworkStorageSession::defaultStorageSession in WebCore >Index: Source/WebKitLegacy/win/WebView.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebView.cpp (revision 240091) >+++ Source/WebKitLegacy/win/WebView.cpp (working copy) >@@ -32,6 +32,7 @@ > #include "DOMCoreClasses.h" > #include "FullscreenVideoController.h" > #include "MarshallingHelpers.h" >+#include "PageStorageSessionProvider.h" > #include "PluginDatabase.h" > #include "PluginView.h" > #include "WebApplicationCache.h" >@@ -3106,13 +3107,14 @@ HRESULT WebView::initWithFrame(RECT fram > > m_inspectorClient = new WebInspectorClient(this); > >+ auto storageProvider = PageStorageSessionProvider::create(); > PageConfiguration configuration( > makeUniqueRef<WebEditorClient>(this), > SocketProvider::create(), > makeUniqueRef<LibWebRTCProvider>(), > WebCore::CacheStorageProvider::create(), > BackForwardList::create(), >- CookieJar::create() >+ CookieJar::create(storageProvider.copyRef()) > ); > configuration.chromeClient = new WebChromeClient(this); > configuration.contextMenuClient = new WebContextMenuClient(this); >@@ -3128,6 +3130,7 @@ HRESULT WebView::initWithFrame(RECT fram > configuration.pluginInfoProvider = &WebPluginInfoProvider::singleton(); > > m_page = new Page(WTFMove(configuration)); >+ storageProvider->setPage(*page); > provideGeolocationTo(m_page, *new WebGeolocationClient(this)); > > m_page->addLayoutMilestones({ DidFirstLayout, DidFirstVisuallyNonEmptyLayout });
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193529
:
359352
|
359353
|
359355
|
359356
|
359357
|
359358
|
359360
|
359361
|
359382