WebKit Bugzilla
Attachment 359039 Details for
Bug 161106
: Stop using CookiesStrategy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-161106-20190114090455.patch (text/plain), 83.51 KB, created by
Alex Christensen
on 2019-01-14 09:04:57 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-14 09:04:57 PST
Size:
83.51 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 239927) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,63 @@ >+2019-01-14 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using CookiesStrategy >+ https://bugs.webkit.org/show_bug.cgi?id=161106 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Modules/websockets/WebSocketChannel.cpp: >+ (WebCore::WebSocketChannel::processBuffer): >+ * Modules/websockets/WebSocketHandshake.cpp: >+ (WebCore::WebSocketHandshake::clientHandshakeRequest const): >+ (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const): >+ * WebCore.xcodeproj/project.pbxproj: >+ * dom/Document.cpp: >+ (WebCore::Document::cookie): >+ (WebCore::Document::setCookie): >+ * inspector/agents/InspectorPageAgent.cpp: >+ (WebCore::InspectorPageAgent::getCookies): >+ (WebCore::InspectorPageAgent::deleteCookie): >+ * loader/CookieJar.cpp: >+ (WebCore::CookieJar::shouldIncludeSecureCookies): >+ (WebCore::CookieJar::sameSiteInfo): >+ (WebCore::CookieJar::cookies): >+ (WebCore::CookieJar::cookieRequestHeaderFieldProxy): >+ (WebCore::CookieJar::setCookies): >+ (WebCore::CookieJar::cookiesEnabled): >+ (WebCore::CookieJar::cookieRequestHeaderFieldValue): >+ (WebCore::CookieJar::getRawCookies): >+ (WebCore::CookieJar::deleteCookie): >+ (WebCore::shouldIncludeSecureCookies): Deleted. >+ (WebCore::sameSiteInfo): Deleted. >+ (WebCore::cookies): Deleted. >+ (WebCore::cookieRequestHeaderFieldProxy): Deleted. >+ (WebCore::setCookies): Deleted. >+ (WebCore::cookiesEnabled): Deleted. >+ (WebCore::cookieRequestHeaderFieldValue): Deleted. >+ (WebCore::getRawCookies): Deleted. >+ (WebCore::deleteCookie): Deleted. >+ * loader/CookieJar.h: >+ * loader/EmptyClients.cpp: >+ (WebCore::pageConfigurationWithEmptyClients): >+ * page/Navigator.cpp: >+ (WebCore::Navigator::cookieEnabled const): >+ * page/Page.cpp: >+ (WebCore::Page::Page): >+ * page/Page.h: >+ (WebCore::Page::cookieJar): >+ * page/PageConfiguration.cpp: >+ (WebCore::PageConfiguration::PageConfiguration): >+ * page/PageConfiguration.h: >+ * platform/CookiesStrategy.h: Removed. >+ * platform/PlatformStrategies.h: >+ (WebCore::PlatformStrategies::cookiesStrategy): Deleted. >+ * platform/network/CacheValidation.cpp: >+ (WebCore::headerValueForVary): >+ * platform/network/CookieRequestHeaderFieldProxy.h: >+ * platform/network/cocoa/NetworkStorageSessionCocoa.mm: >+ * testing/Internals.cpp: >+ (WebCore::Internals::getCookies const): >+ > 2019-01-14 Zan Dobersek <zdobersek@igalia.com> > > DOMCacheStorage: use-after-move in doSequentialMatch() >Index: Source/WebCore/Modules/websockets/WebSocketChannel.cpp >=================================================================== >--- Source/WebCore/Modules/websockets/WebSocketChannel.cpp (revision 239927) >+++ Source/WebCore/Modules/websockets/WebSocketChannel.cpp (working copy) >@@ -450,8 +450,8 @@ bool WebSocketChannel::processBuffer() > InspectorInstrumentation::didReceiveWebSocketHandshakeResponse(m_document, m_identifier, m_handshake->serverHandshakeResponse()); > String serverSetCookie = m_handshake->serverSetCookie(); > if (!serverSetCookie.isEmpty()) { >- if (m_document && cookiesEnabled(*m_document)) >- setCookies(*m_document, m_handshake->httpURLForAuthenticationAndCookies(), serverSetCookie); >+ if (m_document && m_document->page() && m_document->page()->cookieJar().cookiesEnabled(*m_document)) >+ m_document->page()->cookieJar().setCookies(*m_document, m_handshake->httpURLForAuthenticationAndCookies(), serverSetCookie); > } > LOG(Network, "WebSocketChannel %p Connected", this); > skipBuffer(headerLength); >Index: Source/WebCore/Modules/websockets/WebSocketHandshake.cpp >=================================================================== >--- Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (revision 239927) >+++ Source/WebCore/Modules/websockets/WebSocketHandshake.cpp (working copy) >@@ -242,9 +242,9 @@ ResourceRequest WebSocketHandshake::clie > request.setHTTPHeaderField(HTTPHeaderName::SecWebSocketProtocol, m_clientProtocol); > > URL url = httpURLForAuthenticationAndCookies(); >- if (m_allowCookies && m_document) { >+ if (m_allowCookies && m_document && m_document->page()) { > RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(InspectorInstrumentation::hasFrontends()); >- String cookie = cookieRequestHeaderFieldValue(*m_document, url); >+ String cookie = m_document->page()->cookieJar().cookieRequestHeaderFieldValue(*m_document, url); > if (!cookie.isEmpty()) > request.setHTTPHeaderField(HTTPHeaderName::Cookie, cookie); > } >@@ -268,7 +268,7 @@ Optional<CookieRequestHeaderFieldProxy> > { > if (!m_document || !m_allowCookies) > return WTF::nullopt; >- return cookieRequestHeaderFieldProxy(*m_document, httpURLForAuthenticationAndCookies()); >+ return CookieJar::cookieRequestHeaderFieldProxy(*m_document, httpURLForAuthenticationAndCookies()); > } > > void WebSocketHandshake::reset() >Index: Source/WebCore/WebCore.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebCore/WebCore.xcodeproj/project.pbxproj (revision 239927) >+++ Source/WebCore/WebCore.xcodeproj/project.pbxproj (working copy) >@@ -1013,7 +1013,6 @@ > 31FE6DFA15004C2A0004EBC4 /* NotificationPermissionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 31EC1DAC14FF26EA00C94662 /* NotificationPermissionCallback.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 33503C9A10179A74003B47E1 /* NotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 339B5B63131DAA3200F48D02 /* CookiesStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 339B5B62131DAA3200F48D02 /* CookiesStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 33D0212D131DB37B004091A8 /* CookieStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = E13F01EA1270E10D00DFBA71 /* CookieStorage.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 3717D7E817ECC591003C276D /* extract-localizable-strings.pl in Copy Scripts */ = {isa = PBXBuildFile; fileRef = 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */; }; > 371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */; }; >@@ -7162,7 +7161,6 @@ > 33503C9F10179AD7003B47E1 /* JSNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotification.cpp; sourceTree = "<group>"; }; > 33503CA010179AD7003B47E1 /* JSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotification.h; sourceTree = "<group>"; }; > 33503CC61017A1B1003B47E1 /* Notification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Notification.cpp; sourceTree = "<group>"; }; >- 339B5B62131DAA3200F48D02 /* CookiesStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CookiesStrategy.h; sourceTree = "<group>"; }; > 3662F984047CEDBE5DDDAFAA /* RenderMathMLMenclose.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMathMLMenclose.cpp; sourceTree = "<group>"; }; > 37119A7920CCB610002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; }; > 3717D7E517ECC3A6003C276D /* extract-localizable-strings.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; name = "extract-localizable-strings.pl"; path = "Scripts/extract-localizable-strings.pl"; sourceTree = "<group>"; }; >@@ -25240,7 +25238,6 @@ > 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */, > 311C08BC18E35D6800B65615 /* ControlStates.h */, > D8B6152E1032495100C8554A /* Cookie.h */, >- 339B5B62131DAA3200F48D02 /* CookiesStrategy.h */, > 862F129D18C1572C005C54AF /* CountedUserActivity.h */, > 46C696CA1E7205E400597937 /* CPUMonitor.cpp */, > 46C696C91E7205E400597937 /* CPUMonitor.h */, >@@ -28539,7 +28536,6 @@ > D8B6152F1032495100C8554A /* Cookie.h in Headers */, > E1424C94164B52C800F32D40 /* CookieJar.h in Headers */, > 7A5699702086C619000E0433 /* CookieRequestHeaderFieldProxy.h in Headers */, >- 339B5B63131DAA3200F48D02 /* CookiesStrategy.h in Headers */, > 33D0212D131DB37B004091A8 /* CookieStorage.h in Headers */, > 5120BBAF1F1CECE700EFEBF1 /* CookieStorageObserver.h in Headers */, > 9746AF2114F4DDE6003E7A71 /* Coordinates.h in Headers */, >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 239927) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -4824,8 +4824,8 @@ ExceptionOr<String> Document::cookie() > if (cookieURL.isEmpty()) > return String(); > >- if (!isDOMCookieCacheValid()) >- setCachedDOMCookies(cookies(*this, cookieURL)); >+ if (!isDOMCookieCacheValid() && page()) >+ setCachedDOMCookies(page()->cookieJar().cookies(*this, cookieURL)); > > return String { cachedDOMCookies() }; > } >@@ -4846,7 +4846,8 @@ ExceptionOr<void> Document::setCookie(co > return { }; > > invalidateDOMCookieCache(); >- setCookies(*this, cookieURL, value); >+ if (page()) >+ page()->cookieJar().setCookies(*this, cookieURL, value); > return { }; > } > >Index: Source/WebCore/inspector/agents/InspectorPageAgent.cpp >=================================================================== >--- Source/WebCore/inspector/agents/InspectorPageAgent.cpp (revision 239927) >+++ Source/WebCore/inspector/agents/InspectorPageAgent.cpp (working copy) >@@ -439,12 +439,12 @@ void InspectorPageAgent::getCookies(Erro > > for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { > Document* document = frame->document(); >- if (!document) >+ if (!document || !document->page()) > continue; > > for (auto& url : allResourcesURLsForFrame(frame)) { > Vector<Cookie> docCookiesList; >- rawCookiesImplemented = getRawCookies(*document, URL({ }, url), docCookiesList); >+ rawCookiesImplemented = document->page()->cookieJar().getRawCookies(*document, URL({ }, url), docCookiesList); > > if (!rawCookiesImplemented) { > // FIXME: We need duplication checking for the String representation of cookies. >@@ -469,8 +469,10 @@ void InspectorPageAgent::deleteCookie(Er > { > URL parsedURL({ }, url); > for (Frame* frame = &m_page.mainFrame(); frame; frame = frame->tree().traverseNext()) { >- if (auto* document = frame->document()) >- WebCore::deleteCookie(*document, parsedURL, cookieName); >+ if (auto* document = frame->document()) { >+ if (auto* page = document->page()) >+ page->cookieJar().deleteCookie(*document, parsedURL, cookieName); >+ } > } > } > >Index: Source/WebCore/loader/CookieJar.cpp >=================================================================== >--- Source/WebCore/loader/CookieJar.cpp (revision 239927) >+++ Source/WebCore/loader/CookieJar.cpp (working copy) >@@ -27,7 +27,6 @@ > #include "CookieJar.h" > > #include "CookieRequestHeaderFieldProxy.h" >-#include "CookiesStrategy.h" > #include "Document.h" > #include "DocumentLoader.h" > #include "Frame.h" >@@ -41,30 +40,38 @@ > > namespace WebCore { > >-static IncludeSecureCookies shouldIncludeSecureCookies(const Document& document, const URL& url) >+IncludeSecureCookies CookieJar::shouldIncludeSecureCookies(const Document& document, const URL& url) > { > return (url.protocolIs("https") && !document.foundMixedContent().contains(SecurityContext::MixedContentType::Active)) ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; > } > >-static inline SameSiteInfo sameSiteInfo(const Document& document) >+SameSiteInfo CookieJar::sameSiteInfo(const Document& document) > { > if (auto* loader = document.loader()) > return SameSiteInfo::create(loader->request()); > return { }; > } > >-String cookies(Document& document, const URL& url) >+CookieJar::~CookieJar() = default; >+ >+String CookieJar::cookies(Document& document, const URL& url) > { > TraceScope scope(FetchCookiesStart, FetchCookiesEnd); > > auto includeSecureCookies = shouldIncludeSecureCookies(document, url); > >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ > std::pair<String, bool> result; >- auto frame = document.frame(); >- if (frame) >- result = platformStrategies()->cookiesStrategy()->cookiesForDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies); >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ result = session->cookiesForDOM(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, includeSecureCookies); > else >- result = platformStrategies()->cookiesStrategy()->cookiesForDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies); >+ ASSERT_NOT_REACHED(); > > if (result.second) > document.setSecureCookiesAccessed(); >@@ -72,7 +79,7 @@ String cookies(Document& document, const > return result.first; > } > >-CookieRequestHeaderFieldProxy cookieRequestHeaderFieldProxy(const Document& document, const URL& url) >+CookieRequestHeaderFieldProxy CookieJar::cookieRequestHeaderFieldProxy(const Document& document, const URL& url) > { > TraceScope scope(FetchCookiesStart, FetchCookiesEnd); > >@@ -89,49 +96,74 @@ CookieRequestHeaderFieldProxy cookieRequ > return proxy; > } > >-void setCookies(Document& document, const URL& url, const String& cookieString) >+void CookieJar::setCookies(Document& document, const URL& url, const String& cookieString) > { >- auto frame = document.frame(); >- if (frame) >- platformStrategies()->cookiesStrategy()->setCookiesFromDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookieString); >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ session->setCookiesFromDOM(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, cookieString); > else >- platformStrategies()->cookiesStrategy()->setCookiesFromDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookieString); >+ ASSERT_NOT_REACHED(); > } > >-bool cookiesEnabled(const Document& document) >+bool CookieJar::cookiesEnabled(const Document& document) > { >- return platformStrategies()->cookiesStrategy()->cookiesEnabled(document.sessionID()); >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ return session->cookiesEnabled(); >+ >+ ASSERT_NOT_REACHED(); >+ return false; > } > >-String cookieRequestHeaderFieldValue(Document& document, const URL& url) >+String CookieJar::cookieRequestHeaderFieldValue(Document& document, const URL& url) > { > auto includeSecureCookies = shouldIncludeSecureCookies(document, url); > >- std::pair<String, bool> result; >- auto frame = document.frame(); >- if (frame) >- result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), includeSecureCookies); >- else >- result = platformStrategies()->cookiesStrategy()->cookieRequestHeaderFieldValue(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, includeSecureCookies); >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } > >- if (result.second) >- document.setSecureCookiesAccessed(); >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) { >+ std::pair<String, bool> result = session->cookieRequestHeaderFieldValue(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, includeSecureCookies); >+ if (result.second) >+ document.setSecureCookiesAccessed(); >+ return result.first; >+ } > >- return result.first; >+ ASSERT_NOT_REACHED(); >+ return { }; > } > >-bool getRawCookies(const Document& document, const URL& url, Vector<Cookie>& cookies) >+bool CookieJar::getRawCookies(const Document& document, const URL& url, Vector<Cookie>& cookies) > { >- auto frame = document.frame(); >- if (frame) >- return platformStrategies()->cookiesStrategy()->getRawCookies(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frame->loader().client().frameID(), frame->loader().client().pageID(), cookies); >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } > >- return platformStrategies()->cookiesStrategy()->getRawCookies(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, WTF::nullopt, WTF::nullopt, cookies); >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ return session->getRawCookies(document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, cookies); >+ >+ ASSERT_NOT_REACHED(); >+ return false; > } > >-void deleteCookie(const Document& document, const URL& url, const String& cookieName) >+void CookieJar::deleteCookie(const Document& document, const URL& url, const String& cookieName) > { >- platformStrategies()->cookiesStrategy()->deleteCookie(document.sessionID(), url, cookieName); >+ if (auto* session = NetworkStorageSession::storageSession(document.sessionID())) >+ session->deleteCookie(url, cookieName); >+ else >+ ASSERT_NOT_REACHED(); > } > > } >Index: Source/WebCore/loader/CookieJar.h >=================================================================== >--- Source/WebCore/loader/CookieJar.h (revision 239927) >+++ Source/WebCore/loader/CookieJar.h (working copy) >@@ -30,20 +30,29 @@ > > namespace WebCore { > >+enum class IncludeSecureCookies : bool { No, Yes }; >+ > class Document; > struct Cookie; > struct CookieRequestHeaderFieldProxy; >+struct SameSiteInfo; > >-// Functions in this file take a Document pointer to determine which cookie storage to use. We should merge that into call sites, and use PlatformCookieJar directly. >- >-// These two functions implement document.cookie API, with special rules for HttpOnly cookies. >-WEBCORE_EXPORT String cookies(Document&, const URL&); >-WEBCORE_EXPORT void setCookies(Document&, const URL&, const String& cookieString); >- >-WEBCORE_EXPORT bool cookiesEnabled(const Document&); >-WEBCORE_EXPORT String cookieRequestHeaderFieldValue(Document&, const URL&); >-WEBCORE_EXPORT CookieRequestHeaderFieldProxy cookieRequestHeaderFieldProxy(const Document&, const URL&); >-WEBCORE_EXPORT bool getRawCookies(const Document&, const URL&, Vector<Cookie>&); >-WEBCORE_EXPORT void deleteCookie(const Document&, const URL&, const String& cookieName); >+class WEBCORE_EXPORT CookieJar { >+public: >+ static CookieRequestHeaderFieldProxy cookieRequestHeaderFieldProxy(const Document&, const URL&); >+ >+ // These two functions implement document.cookie API, with special rules for HttpOnly cookies. >+ virtual String cookies(Document&, const URL&); >+ virtual void setCookies(Document&, const URL&, const String& cookieString); >+ virtual bool cookiesEnabled(const Document&); >+ virtual String cookieRequestHeaderFieldValue(Document&, const URL&); >+ virtual bool getRawCookies(const Document&, const URL&, Vector<Cookie>&); >+ virtual void deleteCookie(const Document&, const URL&, const String& cookieName); >+ >+ virtual ~CookieJar(); >+protected: >+ static SameSiteInfo sameSiteInfo(const Document&); >+ static IncludeSecureCookies shouldIncludeSecureCookies(const Document&, const URL&); >+}; > > } // namespace WebCore >Index: Source/WebCore/loader/EmptyClients.cpp >=================================================================== >--- Source/WebCore/loader/EmptyClients.cpp (revision 239927) >+++ Source/WebCore/loader/EmptyClients.cpp (working copy) >@@ -33,6 +33,7 @@ > #include "CacheStorageProvider.h" > #include "ColorChooser.h" > #include "ContextMenuClient.h" >+#include "CookieJar.h" > #include "DataListSuggestionPicker.h" > #include "DatabaseProvider.h" > #include "DiagnosticLoggingClient.h" >@@ -541,7 +542,8 @@ PageConfiguration pageConfigurationWithE > SocketProvider::create(), > LibWebRTCProvider::create(), > CacheStorageProvider::create(), >- adoptRef(*new EmptyBackForwardClient) >+ adoptRef(*new EmptyBackForwardClient), >+ makeUniqueRef<CookieJar>() > }; > > static NeverDestroyed<EmptyChromeClient> dummyChromeClient; >Index: Source/WebCore/page/Navigator.cpp >=================================================================== >--- Source/WebCore/page/Navigator.cpp (revision 239927) >+++ Source/WebCore/page/Navigator.cpp (working copy) >@@ -192,14 +192,18 @@ bool Navigator::cookieEnabled() const > if (RuntimeEnabledFeatures::sharedFeatures().webAPIStatisticsEnabled()) > ResourceLoadObserver::shared().logNavigatorAPIAccessed(*frame->document(), ResourceLoadStatistics::NavigatorAPI::CookieEnabled); > >- if (frame->page() && !frame->page()->settings().cookieEnabled()) >+ auto* page = frame->page(); >+ if (!page) >+ return false; >+ >+ if (!page->settings().cookieEnabled()) > return false; > > auto* document = frame->document(); > if (!document) > return false; > >- return cookiesEnabled(*document); >+ return page->cookieJar().cookiesEnabled(*document); > } > > bool Navigator::javaEnabled() const >Index: Source/WebCore/page/Page.cpp >=================================================================== >--- Source/WebCore/page/Page.cpp (revision 239927) >+++ Source/WebCore/page/Page.cpp (working copy) >@@ -34,6 +34,7 @@ > #include "ConstantPropertyMap.h" > #include "ContextMenuClient.h" > #include "ContextMenuController.h" >+#include "CookieJar.h" > #include "DOMRect.h" > #include "DOMRectList.h" > #include "DatabaseProvider.h" >@@ -238,6 +239,7 @@ Page::Page(PageConfiguration&& pageConfi > , m_inspectorDebuggable(std::make_unique<PageDebuggable>(*this)) > #endif > , m_socketProvider(WTFMove(pageConfiguration.socketProvider)) >+ , m_cookieJar(WTFMove(pageConfiguration.cookieJar)) > , m_applicationCacheStorage(*WTFMove(pageConfiguration.applicationCacheStorage)) > , m_cacheStorageProvider(WTFMove(pageConfiguration.cacheStorageProvider)) > , m_databaseProvider(*WTFMove(pageConfiguration.databaseProvider)) >Index: Source/WebCore/page/Page.h >=================================================================== >--- Source/WebCore/page/Page.h (revision 239927) >+++ Source/WebCore/page/Page.h (working copy) >@@ -86,6 +86,7 @@ class ChromeClient; > class Color; > class ContextMenuClient; > class ContextMenuController; >+class CookieJar; > class DOMRect; > class DOMRectList; > class DatabaseProvider; >@@ -574,6 +575,7 @@ public: > DatabaseProvider& databaseProvider() { return m_databaseProvider; } > CacheStorageProvider& cacheStorageProvider() { return m_cacheStorageProvider; } > SocketProvider& socketProvider() { return m_socketProvider; } >+ CookieJar& cookieJar() { return m_cookieJar.get(); } > > StorageNamespaceProvider& storageNamespaceProvider() { return m_storageNamespaceProvider.get(); } > void setStorageNamespaceProvider(Ref<StorageNamespaceProvider>&&); >@@ -873,6 +875,7 @@ private: > unsigned m_forbidPromptsDepth { 0 }; > > Ref<SocketProvider> m_socketProvider; >+ UniqueRef<CookieJar> m_cookieJar; > Ref<ApplicationCacheStorage> m_applicationCacheStorage; > Ref<CacheStorageProvider> m_cacheStorageProvider; > Ref<DatabaseProvider> m_databaseProvider; >Index: Source/WebCore/page/PageConfiguration.cpp >=================================================================== >--- Source/WebCore/page/PageConfiguration.cpp (revision 239927) >+++ Source/WebCore/page/PageConfiguration.cpp (working copy) >@@ -48,11 +48,12 @@ > > namespace WebCore { > >-PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<BackForwardClient>&& backForwardClient) >+PageConfiguration::PageConfiguration(UniqueRef<EditorClient>&& editorClient, Ref<SocketProvider>&& socketProvider, UniqueRef<LibWebRTCProvider>&& libWebRTCProvider, Ref<CacheStorageProvider>&& cacheStorageProvider, Ref<BackForwardClient>&& backForwardClient, UniqueRef<CookieJar>&& cookieJar) > : editorClient(WTFMove(editorClient)) > , socketProvider(WTFMove(socketProvider)) > , libWebRTCProvider(WTFMove(libWebRTCProvider)) > , backForwardClient(WTFMove(backForwardClient)) >+ , cookieJar(WTFMove(cookieJar)) > , cacheStorageProvider(WTFMove(cacheStorageProvider)) > { > } >Index: Source/WebCore/page/PageConfiguration.h >=================================================================== >--- Source/WebCore/page/PageConfiguration.h (revision 239927) >+++ Source/WebCore/page/PageConfiguration.h (working copy) >@@ -41,6 +41,7 @@ class ApplicationCacheStorage; > class AuthenticatorCoordinatorClient; > class BackForwardClient; > class CacheStorageProvider; >+class CookieJar; > class ChromeClient; > class ContextMenuClient; > class DatabaseProvider; >@@ -65,7 +66,7 @@ class WebGLStateTracker; > class PageConfiguration { > WTF_MAKE_NONCOPYABLE(PageConfiguration); WTF_MAKE_FAST_ALLOCATED; > public: >- WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<BackForwardClient>&&); >+ WEBCORE_EXPORT PageConfiguration(UniqueRef<EditorClient>&&, Ref<SocketProvider>&&, UniqueRef<LibWebRTCProvider>&&, Ref<CacheStorageProvider>&&, Ref<BackForwardClient>&&, UniqueRef<CookieJar>&&); > WEBCORE_EXPORT ~PageConfiguration(); > PageConfiguration(PageConfiguration&&); > >@@ -95,6 +96,7 @@ public: > PlugInClient* plugInClient { nullptr }; > ProgressTrackerClient* progressTrackerClient { nullptr }; > Ref<BackForwardClient> backForwardClient; >+ UniqueRef<CookieJar> cookieJar; > std::unique_ptr<ValidationMessageClient> validationMessageClient; > FrameLoaderClient* loaderClientForMainFrame { nullptr }; > std::unique_ptr<DiagnosticLoggingClient> diagnosticLoggingClient; >Index: Source/WebCore/platform/CookiesStrategy.h >=================================================================== >--- Source/WebCore/platform/CookiesStrategy.h (revision 239927) >+++ Source/WebCore/platform/CookiesStrategy.h (nonexistent) >@@ -1,54 +0,0 @@ >-/* >- * Copyright (C) 2011-2017 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 <pal/SessionID.h> >-#include <wtf/Forward.h> >-#include <wtf/text/WTFString.h> >- >-namespace WebCore { >- >-class NetworkStorageSession; >- >-struct Cookie; >-struct SameSiteInfo; >- >-enum class IncludeSecureCookies : bool { No, Yes }; >- >-class CookiesStrategy { >-public: >- virtual std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0; >- virtual void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) = 0; >- virtual bool cookiesEnabled(const PAL::SessionID&) = 0; >- virtual std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies) = 0; >- virtual bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>&) = 0; >- virtual void deleteCookie(const PAL::SessionID&, const URL&, const String& cookieName) = 0; >- >-protected: >- virtual ~CookiesStrategy() = default; >-}; >- >-} // namespace WebCore > >Property changes on: Source/WebCore/platform/CookiesStrategy.h >___________________________________________________________________ >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Index: Source/WebCore/platform/PlatformStrategies.h >=================================================================== >--- Source/WebCore/platform/PlatformStrategies.h (revision 239927) >+++ Source/WebCore/platform/PlatformStrategies.h (working copy) >@@ -28,19 +28,11 @@ > namespace WebCore { > > class BlobRegistry; >-class CookiesStrategy; > class LoaderStrategy; > class PasteboardStrategy; > > class PlatformStrategies { > public: >- CookiesStrategy* cookiesStrategy() >- { >- if (!m_cookiesStrategy) >- m_cookiesStrategy = createCookiesStrategy(); >- return m_cookiesStrategy; >- } >- > LoaderStrategy* loaderStrategy() > { > if (!m_loaderStrategy) >@@ -70,12 +62,10 @@ protected: > } > > private: >- virtual CookiesStrategy* createCookiesStrategy() = 0; > virtual LoaderStrategy* createLoaderStrategy() = 0; > virtual PasteboardStrategy* createPasteboardStrategy() = 0; > virtual BlobRegistry* createBlobRegistry() = 0; > >- CookiesStrategy* m_cookiesStrategy { }; > LoaderStrategy* m_loaderStrategy { }; > PasteboardStrategy* m_pasteboardStrategy { }; > BlobRegistry* m_blobRegistry { }; >Index: Source/WebCore/platform/network/CacheValidation.cpp >=================================================================== >--- Source/WebCore/platform/network/CacheValidation.cpp (revision 239927) >+++ Source/WebCore/platform/network/CacheValidation.cpp (working copy) >@@ -26,7 +26,7 @@ > #include "config.h" > #include "CacheValidation.h" > >-#include "CookiesStrategy.h" >+#include "CookieJar.h" > #include "HTTPHeaderMap.h" > #include "NetworkStorageSession.h" > #include "PlatformStrategies.h" >@@ -334,12 +334,10 @@ static String headerValueForVary(const R > // is a blocking operation. This should be sufficient to cover reasonable cases. > if (headerName == httpHeaderNameString(HTTPHeaderName::Cookie)) { > auto includeSecureCookies = request.url().protocolIs("https") ? IncludeSecureCookies::Yes : IncludeSecureCookies::No; >- auto* cookieStrategy = platformStrategies() ? platformStrategies()->cookiesStrategy() : nullptr; >- if (!cookieStrategy) { >- ASSERT(sessionID == PAL::SessionID::defaultSessionID()); >- return NetworkStorageSession::defaultStorageSession().cookieRequestHeaderFieldValue(request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; >- } >- return cookieStrategy->cookieRequestHeaderFieldValue(sessionID, request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; >+ if (auto* session = NetworkStorageSession::storageSession(sessionID)) >+ return session->cookieRequestHeaderFieldValue(request.firstPartyForCookies(), SameSiteInfo::create(request), request.url(), WTF::nullopt, WTF::nullopt, includeSecureCookies).first; >+ ASSERT_NOT_REACHED(); >+ return { }; > } > return request.httpHeaderField(headerName); > } >Index: Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h >=================================================================== >--- Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h (revision 239927) >+++ Source/WebCore/platform/network/CookieRequestHeaderFieldProxy.h (working copy) >@@ -25,7 +25,7 @@ > > #pragma once > >-#include "CookiesStrategy.h" >+#include "CookieJar.h" > #include "SameSiteInfo.h" > #include <pal/SessionID.h> > #include <wtf/URL.h> >Index: Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm >=================================================================== >--- Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (revision 239927) >+++ Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (working copy) >@@ -29,7 +29,6 @@ > #import "Cookie.h" > #import "CookieRequestHeaderFieldProxy.h" > #import "CookieStorageObserver.h" >-#import "CookiesStrategy.h" > #import "SameSiteInfo.h" > #import <pal/spi/cf/CFNetworkSPI.h> > #import <wtf/BlockObjCExceptions.h> >Index: Source/WebCore/testing/Internals.cpp >=================================================================== >--- Source/WebCore/testing/Internals.cpp (revision 239927) >+++ Source/WebCore/testing/Internals.cpp (working copy) >@@ -4852,8 +4852,12 @@ auto Internals::getCookies() const -> Ve > if (!document) > return { }; > >+ auto* page = document->page(); >+ if (!page) >+ return { }; >+ > Vector<Cookie> cookies; >- getRawCookies(*document, document->cookieURL(), cookies); >+ page->cookieJar().getRawCookies(*document, document->cookieURL(), cookies); > return WTF::map(cookies, [](auto& cookie) { > return CookieData { cookie }; > }); >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 239927) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,42 @@ >+2019-01-14 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using CookiesStrategy >+ https://bugs.webkit.org/show_bug.cgi?id=161106 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/NetworkProcessPlatformStrategies.cpp: >+ (WebKit::NetworkProcessPlatformStrategies::createCookiesStrategy): Deleted. >+ * NetworkProcess/NetworkProcessPlatformStrategies.h: >+ * Scripts/webkit/messages.py: >+ * Sources.txt: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/Automation/WebAutomationSessionProxy.cpp: >+ (WebKit::WebAutomationSessionProxy::getCookiesForFrame): >+ (WebKit::WebAutomationSessionProxy::deleteCookie): >+ * WebProcess/Plugins/PluginView.cpp: >+ (WebKit::PluginView::cookiesForURL): >+ (WebKit::PluginView::setCookiesForURL): >+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: >+ (WebKit::WebPlatformStrategies::createCookiesStrategy): Deleted. >+ (WebKit::WebPlatformStrategies::cookiesForDOM): Deleted. >+ (WebKit::WebPlatformStrategies::setCookiesFromDOM): Deleted. >+ (WebKit::WebPlatformStrategies::cookiesEnabled): Deleted. >+ (WebKit::WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted. >+ (WebKit::WebPlatformStrategies::getRawCookies): Deleted. >+ (WebKit::WebPlatformStrategies::deleteCookie): Deleted. >+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h: >+ * WebProcess/WebPage/WebCookieJar.cpp: Added. >+ (WebKit::WebCookieJar::cookies): >+ (WebKit::WebCookieJar::setCookies): >+ (WebKit::WebCookieJar::cookiesEnabled): >+ (WebKit::WebCookieJar::cookieRequestHeaderFieldValue): >+ (WebKit::WebCookieJar::getRawCookies): >+ (WebKit::WebCookieJar::deleteCookie): >+ * WebProcess/WebPage/WebCookieJar.h: Added. >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::m_shouldAttachDrawingAreaOnPageTransition): >+ > 2019-01-14 Carlos Garcia Campos <cgarcia@igalia.com> > > Unreviewed. Update OptionsGTK.cmake and NEWS for 2.23.3 release >Index: Source/WebKit/Sources.txt >=================================================================== >--- Source/WebKit/Sources.txt (revision 239927) >+++ Source/WebKit/Sources.txt (working copy) >@@ -538,6 +538,7 @@ WebProcess/WebPage/RemoteWebInspectorUI. > WebProcess/WebPage/VisitedLinkTableController.cpp > WebProcess/WebPage/WebBackForwardListProxy.cpp > WebProcess/WebPage/WebContextMenu.cpp >+WebProcess/WebPage/WebCookieJar.cpp > WebProcess/WebPage/WebDocumentLoader.cpp > WebProcess/WebPage/WebFrame.cpp > WebProcess/WebPage/WebInspector.cpp >Index: Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp (revision 239927) >+++ Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.cpp (working copy) >@@ -38,11 +38,6 @@ void NetworkProcessPlatformStrategies::i > setPlatformStrategies(&platformStrategies.get()); > } > >-CookiesStrategy* NetworkProcessPlatformStrategies::createCookiesStrategy() >-{ >- return nullptr; >-} >- > LoaderStrategy* NetworkProcessPlatformStrategies::createLoaderStrategy() > { > return nullptr; >Index: Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.h >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.h (revision 239927) >+++ Source/WebKit/NetworkProcess/NetworkProcessPlatformStrategies.h (working copy) >@@ -23,8 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef NetworkProcessPlatformStrategies_h >-#define NetworkProcessPlatformStrategies_h >+#pragma once > > #include <WebCore/LoaderStrategy.h> > #include <WebCore/PlatformStrategies.h> >@@ -37,13 +36,9 @@ public: > > private: > // WebCore::PlatformStrategies >- WebCore::CookiesStrategy* createCookiesStrategy() override; > WebCore::LoaderStrategy* createLoaderStrategy() override; > WebCore::PasteboardStrategy* createPasteboardStrategy() override; > WebCore::BlobRegistry* createBlobRegistry() override; > }; > > } // namespace WebKit >- >- >-#endif // NetworkProcessPlatformStrategies_h >Index: Source/WebKit/Scripts/webkit/messages.py >=================================================================== >--- Source/WebKit/Scripts/webkit/messages.py (revision 239927) >+++ Source/WebKit/Scripts/webkit/messages.py (working copy) >@@ -406,7 +406,7 @@ def headers_for_type(type): > 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::HasInsecureContent': ['<WebCore/FrameLoaderTypes.h>'], > 'WebCore::Highlight': ['<WebCore/InspectorOverlay.h>'], >- 'WebCore::IncludeSecureCookies': ['<WebCore/CookiesStrategy.h>'], >+ 'WebCore::IncludeSecureCookies': ['<WebCore/CookieJar.h>'], > 'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'], > 'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'], > 'WebCore::LockBackForwardList': ['<WebCore/FrameLoaderTypes.h>'], >Index: Source/WebKit/WebKit.xcodeproj/project.pbxproj >=================================================================== >--- Source/WebKit/WebKit.xcodeproj/project.pbxproj (revision 239927) >+++ Source/WebKit/WebKit.xcodeproj/project.pbxproj (working copy) >@@ -1050,6 +1050,7 @@ > 5C359C0D2154739F009E7948 /* WKDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C359C0C21547321009E7948 /* WKDeprecated.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 5C4B9D8B210A8CCF008F14D1 /* UndoOrRedo.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4B9D8A210A8C46008F14D1 /* UndoOrRedo.h */; }; > 5C62FDF91EFC271C00CE072E /* WKURLSchemeTaskPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 5C7FB47021E97DC5009E3241 /* WebCookieJar.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7FB46F21E97C0C009E3241 /* WebCookieJar.h */; }; > 5C8BC797218CBB4800813886 /* SafeBrowsing.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5C8BC796218CB58A00813886 /* SafeBrowsing.xcassets */; }; > 5C8DD3801FE4521600F2A556 /* WebsiteAutoplayPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C8DD37F1FE4519200F2A556 /* WebsiteAutoplayPolicy.h */; }; > 5C9E56831DF7F1B300C9EE33 /* WKWebsitePolicies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C9E56811DF7F05500C9EE33 /* WKWebsitePolicies.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -3428,6 +3429,8 @@ > 5C7706731D111D8B0012700F /* WebSocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketProvider.cpp; path = Network/WebSocketProvider.cpp; sourceTree = "<group>"; }; > 5C7ACFD1218DD8BD004CBB59 /* Network-OSX.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Network-OSX.entitlements"; sourceTree = "<group>"; }; > 5C7C88DC1D0F41A0009D2F6D /* WebSocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocketProvider.h; path = Network/WebSocketProvider.h; sourceTree = "<group>"; }; >+ 5C7FB46E21E97C0B009E3241 /* WebCookieJar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCookieJar.cpp; sourceTree = "<group>"; }; >+ 5C7FB46F21E97C0C009E3241 /* WebCookieJar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCookieJar.h; sourceTree = "<group>"; }; > 5C84CF901F96AC4E00B6705A /* NetworkSessionCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkSessionCreationParameters.h; sourceTree = "<group>"; }; > 5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PendingDownload.cpp; sourceTree = "<group>"; }; > 5C89DF5621AF61FF004645E8 /* NetworkSessionCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkSessionCreationParameters.cpp; sourceTree = "<group>"; }; >@@ -7217,6 +7220,8 @@ > BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */, > 51871B59127CB89D00F76232 /* WebContextMenu.cpp */, > 51871B5A127CB89D00F76232 /* WebContextMenu.h */, >+ 5C7FB46E21E97C0B009E3241 /* WebCookieJar.cpp */, >+ 5C7FB46F21E97C0C009E3241 /* WebCookieJar.h */, > 1A5B1C5218987EDF004FCF9B /* WebDocumentLoader.cpp */, > 1A5B1C5318987EDF004FCF9B /* WebDocumentLoader.h */, > BC111ADC112F5B9300337BAB /* WebFrame.cpp */, >@@ -9354,6 +9359,7 @@ > 51ACBB82127A8BAD00D203B9 /* WebContextMenuProxy.h in Headers */, > 51ACBBA0127A8F2C00D203B9 /* WebContextMenuProxyMac.h in Headers */, > BCF4DE25168FA44800C94AFC /* WebContextSupplement.h in Headers */, >+ 5C7FB47021E97DC5009E3241 /* WebCookieJar.h in Headers */, > 330934501315B94D0097A7BC /* WebCookieManager.h in Headers */, > 330934481315B9220097A7BC /* WebCookieManagerMessages.h in Headers */, > 330934561315B9750097A7BC /* WebCookieManagerProxy.h in Headers */, >Index: Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp >=================================================================== >--- Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (revision 239927) >+++ Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp (working copy) >@@ -750,7 +750,7 @@ void WebAutomationSessionProxy::getCooki > auto& document = *frame->coreFrame()->document(); > Vector<WebCore::Cookie> foundCookies; > if (!document.cookieURL().isEmpty()) >- WebCore::getRawCookies(document, document.cookieURL(), foundCookies); >+ page->corePage()->cookieJar().getRawCookies(document, document.cookieURL(), foundCookies); > > WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidGetCookiesForFrame(callbackID, foundCookies, String()), 0); > } >@@ -772,7 +772,7 @@ void WebAutomationSessionProxy::deleteCo > } > > auto& document = *frame->coreFrame()->document(); >- WebCore::deleteCookie(document, document.cookieURL(), cookieName); >+ page->corePage()->cookieJar().deleteCookie(document, document.cookieURL(), cookieName); > > WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidDeleteCookie(callbackID, String()), 0); > } >Index: Source/WebKit/WebProcess/Plugins/PluginView.cpp >=================================================================== >--- Source/WebKit/WebProcess/Plugins/PluginView.cpp (revision 239927) >+++ Source/WebKit/WebProcess/Plugins/PluginView.cpp (working copy) >@@ -1581,12 +1581,18 @@ String PluginView::proxiesForURL(const S > > String PluginView::cookiesForURL(const String& urlString) > { >- return cookies(m_pluginElement->document(), URL(URL(), urlString)); >+ if (auto* page = m_pluginElement->document().page()) >+ return page->cookieJar().cookies(m_pluginElement->document(), URL(URL(), urlString)); >+ ASSERT_NOT_REACHED(); >+ return { }; > } > > void PluginView::setCookiesForURL(const String& urlString, const String& cookieString) > { >- setCookies(m_pluginElement->document(), URL(URL(), urlString), cookieString); >+ if (auto* page = m_pluginElement->document().page()) >+ page->cookieJar().setCookies(m_pluginElement->document(), URL(URL(), urlString), cookieString); >+ else >+ ASSERT_NOT_REACHED(); > } > > bool PluginView::getAuthenticationInfo(const ProtectionSpace& protectionSpace, String& username, String& password) >Index: Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (revision 239927) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (working copy) >@@ -84,11 +84,6 @@ WebPlatformStrategies::WebPlatformStrate > { > } > >-CookiesStrategy* WebPlatformStrategies::createCookiesStrategy() >-{ >- return this; >-} >- > LoaderStrategy* WebPlatformStrategies::createLoaderStrategy() > { > return &WebProcess::singleton().webLoaderStrategy(); >@@ -104,52 +99,6 @@ BlobRegistry* WebPlatformStrategies::cre > return new BlobRegistryProxy; > } > >-// CookiesStrategy >- >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- String cookieString; >- bool secureCookiesAccessed = false; >- if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(sessionID, firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookieString, secureCookiesAccessed), 0)) >- return { String(), false }; >- >- return { cookieString, secureCookiesAccessed }; >-} >- >-void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const WebCore::SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) >-{ >- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(sessionID, firstParty, sameSiteInfo, url, frameID, pageID, cookieString), 0); >-} >- >-bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID) >-{ >- bool result; >- if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(sessionID), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) >- return false; >- return result; >-} >- >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- String cookieString; >- bool secureCookiesAccessed = false; >- if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(sessionID, firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(cookieString, secureCookiesAccessed), 0)) >- return { String(), false }; >- return { cookieString, secureCookiesAccessed }; >-} >- >-bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >-{ >- if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(sessionID, firstParty, sameSiteInfo, url, frameID, pageID), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) >- return false; >- return true; >-} >- >-void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName) >-{ >- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(sessionID, url, cookieName), 0); >-} >- > #if PLATFORM(COCOA) > // PasteboardStrategy > >Index: Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (revision 239927) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.h (working copy) >@@ -25,14 +25,13 @@ > > #pragma once > >-#include <WebCore/CookiesStrategy.h> > #include <WebCore/LoaderStrategy.h> > #include <WebCore/PasteboardStrategy.h> > #include <WebCore/PlatformStrategies.h> > > namespace WebKit { > >-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PasteboardStrategy { >+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PasteboardStrategy { > friend NeverDestroyed<WebPlatformStrategies>; > public: > static void initialize(); >@@ -41,19 +40,10 @@ private: > WebPlatformStrategies(); > > // WebCore::PlatformStrategies >- WebCore::CookiesStrategy* createCookiesStrategy() override; > WebCore::LoaderStrategy* createLoaderStrategy() override; > WebCore::PasteboardStrategy* createPasteboardStrategy() override; > WebCore::BlobRegistry* createBlobRegistry() override; > >- // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override; >- bool cookiesEnabled(const PAL::SessionID&) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; >- void deleteCookie(const PAL::SessionID&, const URL&, const String&) override; >- > // WebCore::PasteboardStrategy > #if PLATFORM(IOS_FAMILY) > void writeToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName) override; >Index: Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp (nonexistent) >+++ Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp (working copy) >@@ -0,0 +1,112 @@ >+/* >+ * 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. >+ */ >+ >+#include "config.h" >+#include "WebCookieJar.h" >+ >+#include "NetworkConnectionToWebProcessMessages.h" >+#include "NetworkProcessConnection.h" >+#include "WebProcess.h" >+#include <WebCore/CookieRequestHeaderFieldProxy.h> >+#include <WebCore/Document.h> >+#include <WebCore/Frame.h> >+#include <WebCore/FrameLoader.h> >+#include <WebCore/FrameLoaderClient.h> >+ >+namespace WebKit { >+ >+String WebCookieJar::cookies(WebCore::Document& document, const URL& url) >+{ >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ >+ String cookieString; >+ bool secureCookiesAccessed = false; >+ if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesForDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, shouldIncludeSecureCookies(document, url)), Messages::NetworkConnectionToWebProcess::CookiesForDOM::Reply(cookieString, secureCookiesAccessed), 0)) >+ return { }; >+ >+ return cookieString; >+} >+ >+void WebCookieJar::setCookies(WebCore::Document& document, const URL& url, const String& cookieString) >+{ >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ >+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::SetCookiesFromDOM(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, cookieString), 0); >+} >+ >+bool WebCookieJar::cookiesEnabled(const WebCore::Document& document) >+{ >+ bool result = false; >+ if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookiesEnabled(document.sessionID()), Messages::NetworkConnectionToWebProcess::CookiesEnabled::Reply(result), 0)) >+ return false; >+ return result; >+} >+ >+String WebCookieJar::cookieRequestHeaderFieldValue(WebCore::Document& document, const URL& url) >+{ >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ >+ String cookieString; >+ bool secureCookiesAccessed = false; >+ if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID, shouldIncludeSecureCookies(document, url)), Messages::NetworkConnectionToWebProcess::CookieRequestHeaderFieldValue::Reply(cookieString, secureCookiesAccessed), 0)) >+ return { }; >+ return cookieString; >+} >+ >+bool WebCookieJar::getRawCookies(const WebCore::Document& document, const URL& url, Vector<WebCore::Cookie>& rawCookies) >+{ >+ Optional<uint64_t> frameID; >+ Optional<uint64_t> pageID; >+ if (auto* frame = document.frame()) { >+ frameID = frame->loader().client().frameID(); >+ pageID = frame->loader().client().pageID(); >+ } >+ >+ if (!WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::NetworkConnectionToWebProcess::GetRawCookies(document.sessionID(), document.firstPartyForCookies(), sameSiteInfo(document), url, frameID, pageID), Messages::NetworkConnectionToWebProcess::GetRawCookies::Reply(rawCookies), 0)) >+ return false; >+ return true; >+} >+ >+void WebCookieJar::deleteCookie(const WebCore::Document& document, const URL& url, const String& cookieName) >+{ >+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(document.sessionID(), url, cookieName), 0); >+} >+ >+} // namespace WebKit >Index: Source/WebKit/WebProcess/WebPage/WebCookieJar.h >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebCookieJar.h (nonexistent) >+++ Source/WebKit/WebProcess/WebPage/WebCookieJar.h (working copy) >@@ -0,0 +1,42 @@ >+/* >+ * 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 <WebCore/CookieJar.h> >+ >+namespace WebKit { >+ >+class WebCookieJar final : public WebCore::CookieJar { >+public: >+ String cookies(WebCore::Document&, const URL&) final; >+ void setCookies(WebCore::Document&, const URL&, const String& cookieString) final; >+ bool cookiesEnabled(const WebCore::Document&) final; >+ String cookieRequestHeaderFieldValue(WebCore::Document&, const URL&) final; >+ bool getRawCookies(const WebCore::Document&, const URL&, Vector<WebCore::Cookie>&) final; >+ void deleteCookie(const WebCore::Document&, const URL&, const String& cookieName) final; >+}; >+ >+} // namespace WebKit >Index: Source/WebKit/WebProcess/WebPage/WebPage.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebPage/WebPage.cpp (revision 239927) >+++ Source/WebKit/WebProcess/WebPage/WebPage.cpp (working copy) >@@ -75,6 +75,7 @@ > #include "WebColorChooser.h" > #include "WebContextMenu.h" > #include "WebContextMenuClient.h" >+#include "WebCookieJar.h" > #include "WebCoreArgumentCoders.h" > #include "WebDataListSuggestionPicker.h" > #include "WebDatabaseProvider.h" >@@ -417,7 +418,8 @@ WebPage::WebPage(uint64_t pageID, WebPag > WebSocketProvider::create(), > makeUniqueRef<WebKit::LibWebRTCProvider>(), > WebProcess::singleton().cacheStorageProvider(), >- WebBackForwardListProxy::create(*this) >+ WebBackForwardListProxy::create(*this), >+ makeUniqueRef<WebCookieJar>() > ); > pageConfiguration.chromeClient = new WebChromeClient(*this); > #if ENABLE(CONTEXT_MENUS) >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 239927) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,29 @@ >+2019-01-14 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using CookiesStrategy >+ https://bugs.webkit.org/show_bug.cgi?id=161106 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm: >+ (WebKit::NetscapePluginInstanceProxy::getCookies): >+ (WebKit::NetscapePluginInstanceProxy::setCookies): >+ * Plugins/WebNetscapePluginView.mm: >+ (-[WebNetscapePluginView getVariable:forURL:value:length:]): >+ (-[WebNetscapePluginView setVariable:forURL:value:length:]): >+ * WebCoreSupport/WebPlatformStrategies.h: >+ * WebCoreSupport/WebPlatformStrategies.mm: >+ (WebPlatformStrategies::createCookiesStrategy): Deleted. >+ (WebPlatformStrategies::cookiesForDOM): Deleted. >+ (WebPlatformStrategies::setCookiesFromDOM): Deleted. >+ (WebPlatformStrategies::cookiesEnabled): Deleted. >+ (WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted. >+ (WebPlatformStrategies::getRawCookies): Deleted. >+ (WebPlatformStrategies::deleteCookie): Deleted. >+ * WebView/WebView.mm: >+ (-[WebView _commonInitializationWithFrameName:groupName:]): >+ (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): >+ > 2019-01-13 Dan Bernstein <mitz@apple.com> > > Tried to fix USE(APPLE_INTERNAL_SDK) builds after r239901. >Index: Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm >=================================================================== >--- Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm (revision 239927) >+++ Source/WebKitLegacy/mac/Plugins/WebNetscapePluginView.mm (working copy) >@@ -2134,8 +2134,12 @@ - (NPError)getVariable:(NPNURLVariable)v > auto* document = frame->document(); > if (!document) > break; >+ >+ auto* page = document->page(); >+ if (!page) >+ break; > >- String cookieString = cookies(*document, URL); >+ String cookieString = page->cookieJar().cookies(*document, URL); > CString cookieStringUTF8 = cookieString.utf8(); > if (cookieStringUTF8.isNull()) > return NPERR_GENERIC_ERROR; >@@ -2185,8 +2189,10 @@ - (NPError)setVariable:(NPNURLVariable)v > break; > > if (Frame* frame = core([self webFrame])) { >- if (auto* document = frame->document()) >- setCookies(*document, URL, cookieString); >+ if (auto* document = frame->document()) { >+ if (auto* page = document->page()) >+ page->cookieJar().setCookies(*document, URL, cookieString); >+ } > return NPERR_NO_ERROR; > } > >Index: Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm >=================================================================== >--- Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (revision 239927) >+++ Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (working copy) >@@ -54,6 +54,7 @@ > #import <WebCore/Frame.h> > #import <WebCore/FrameLoader.h> > #import <WebCore/FrameTree.h> >+#import <WebCore/Page.h> > #import <WebCore/PlatformEventFactoryMac.h> > #import <WebCore/ProxyServer.h> > #import <WebCore/ScriptController.h> >@@ -1567,8 +1568,12 @@ bool NetscapePluginInstanceProxy::getCoo > auto* document = frame->document(); > if (!document) > return false; >+ >+ auto* page = document->page(); >+ if (!page) >+ return false; > >- String cookieString = cookies(*document, url); >+ String cookieString = page->cookieJar().cookies(*document, url); > WTF::CString cookieStringUTF8 = cookieString.utf8(); > if (cookieStringUTF8.isNull()) > return false; >@@ -1600,7 +1605,11 @@ bool NetscapePluginInstanceProxy::setCoo > if (!document) > return false; > >- WebCore::setCookies(*document, url, cookieString); >+ auto* page = document->page(); >+ if (!page) >+ return false; >+ >+ page->cookieJar().setCookies(*document, url, cookieString); > return true; > } > >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (revision 239927) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.h (working copy) >@@ -25,7 +25,6 @@ > > #pragma once > >-#include <WebCore/CookiesStrategy.h> > #include <WebCore/LoaderStrategy.h> > #include <WebCore/PasteboardStrategy.h> > #include <WebCore/PlatformStrategies.h> >@@ -34,7 +33,7 @@ struct PasteboardImage; > struct PasteboardWebContent; > struct PasteboardCustomData; > >-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy, private WebCore::PasteboardStrategy { >+class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::PasteboardStrategy { > public: > static void initializeIfNecessary(); > >@@ -42,19 +41,10 @@ private: > WebPlatformStrategies(); > > // WebCore::PlatformStrategies >- WebCore::CookiesStrategy* createCookiesStrategy() override; > WebCore::LoaderStrategy* createLoaderStrategy() override; > WebCore::PasteboardStrategy* createPasteboardStrategy() override; > WebCore::BlobRegistry* createBlobRegistry() override; > >- // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&) override; >- bool cookiesEnabled(const PAL::SessionID&) override; >- std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&) override; >- void deleteCookie(const PAL::SessionID&, const URL&, const String&) override; >- > // WebCore::PasteboardStrategy > #if PLATFORM(IOS_FAMILY) > void writeToPasteboard(const WebCore::PasteboardURL&, const String& pasteboardName) override; >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (revision 239927) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebPlatformStrategies.mm (working copy) >@@ -52,11 +52,6 @@ WebPlatformStrategies::WebPlatformStrate > { > } > >-CookiesStrategy* WebPlatformStrategies::createCookiesStrategy() >-{ >- return this; >-} >- > LoaderStrategy* WebPlatformStrategies::createLoaderStrategy() > { > return new WebResourceLoadScheduler; >@@ -72,42 +67,6 @@ BlobRegistry* WebPlatformStrategies::cre > return new WebCore::BlobRegistryImpl; > } > >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); >-} >- >-void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); >-} >- >-bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookiesEnabled(); >-} >- >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); >-} >- >-bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies); >-} >- >-void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- session.deleteCookie(url, cookieName); >-} >- > void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName) > { > PlatformPasteboard(pasteboardName).getTypes(types); >Index: Source/WebKitLegacy/mac/WebView/WebView.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebView.mm (revision 239927) >+++ Source/WebKitLegacy/mac/WebView/WebView.mm (working copy) >@@ -134,6 +134,7 @@ > #import <WebCore/CacheStorageProvider.h> > #import <WebCore/Chrome.h> > #import <WebCore/ColorMac.h> >+#import <WebCore/CookieJar.h> > #import <WebCore/DatabaseManager.h> > #import <WebCore/DeprecatedGlobalSettings.h> > #import <WebCore/DictionaryLookup.h> >@@ -1445,7 +1446,8 @@ - (void)_commonInitializationWithFrameNa > SocketProvider::create(), > LibWebRTCProvider::create(), > WebCore::CacheStorageProvider::create(), >- BackForwardList::create(self) >+ BackForwardList::create(self), >+ makeUniqueRef<CookieJar>() > ); > #if !PLATFORM(IOS_FAMILY) > pageConfiguration.chromeClient = new WebChromeClient(self); >@@ -1710,7 +1712,8 @@ - (id)initSimpleHTMLDocumentWithStyle:(N > SocketProvider::create(), > LibWebRTCProvider::create(), > WebCore::CacheStorageProvider::create(), >- BackForwardList::create(self) >+ BackForwardList::create(self), >+ makeUniqueRef<CookieJar>() > ); > pageConfiguration.chromeClient = new WebChromeClientIOS(self); > #if ENABLE(DRAG_SUPPORT) >Index: Source/WebKitLegacy/win/ChangeLog >=================================================================== >--- Source/WebKitLegacy/win/ChangeLog (revision 239927) >+++ Source/WebKitLegacy/win/ChangeLog (working copy) >@@ -1,3 +1,29 @@ >+2019-01-14 Alex Christensen <achristensen@webkit.org> >+ >+ Stop using CookiesStrategy >+ https://bugs.webkit.org/show_bug.cgi?id=161106 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Plugins/PluginView.cpp: >+ (WebCore::PluginView::getValueForURL): >+ (PluginView::setValueForURL): >+ (WebCore::PluginView::setValueForURL): Deleted. >+ (WebCore::PluginView::getAuthenticationInfo): Deleted. >+ (WebCore::PluginView::privateBrowsingStateChanged): Deleted. >+ * WebCoreSupport/WebPlatformStrategies.cpp: >+ (WebPlatformStrategies::createBlobRegistry): >+ (WebPlatformStrategies::createCookiesStrategy): Deleted. >+ (WebPlatformStrategies::cookiesForDOM): Deleted. >+ (WebPlatformStrategies::setCookiesFromDOM): Deleted. >+ (WebPlatformStrategies::cookiesEnabled): Deleted. >+ (WebPlatformStrategies::cookieRequestHeaderFieldValue): Deleted. >+ (WebPlatformStrategies::getRawCookies): Deleted. >+ (WebPlatformStrategies::deleteCookie): Deleted. >+ * WebCoreSupport/WebPlatformStrategies.h: >+ * WebView.cpp: >+ (WebView::initWithFrame): >+ > 2019-01-08 Alex Christensen <achristensen@webkit.org> > > Stop using NetworkStorageSession in WebProcess >Index: Source/WebKitLegacy/win/WebView.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebView.cpp (revision 239927) >+++ Source/WebKitLegacy/win/WebView.cpp (working copy) >@@ -3110,7 +3110,8 @@ HRESULT WebView::initWithFrame(RECT fram > SocketProvider::create(), > makeUniqueRef<LibWebRTCProvider>(), > WebCore::CacheStorageProvider::create(), >- BackForwardList::create() >+ BackForwardList::create(), >+ makeUniqueRef<CookieJar>() > ); > configuration.chromeClient = new WebChromeClient(this); > configuration.contextMenuClient = new WebContextMenuClient(this); >Index: Source/WebKitLegacy/win/Plugins/PluginView.cpp >=================================================================== >--- Source/WebKitLegacy/win/Plugins/PluginView.cpp (revision 239927) >+++ Source/WebKitLegacy/win/Plugins/PluginView.cpp (working copy) >@@ -1276,19 +1276,21 @@ NPError PluginView::getValueForURL(NPNUR > if (u.isValid()) { > Frame* frame = getFrame(parentFrame(), m_element); > if (frame && frame->document()) { >- const CString cookieStr = cookies(*frame->document(), u).utf8(); >- if (!cookieStr.isNull()) { >- const int size = cookieStr.length(); >- *value = static_cast<char*>(NPN_MemAlloc(size+1)); >- if (*value) { >- memset(*value, 0, size+1); >- memcpy(*value, cookieStr.data(), size+1); >- if (len) >- *len = size; >- } else >- result = NPERR_OUT_OF_MEMORY_ERROR; >+ if (auto* page = frame->document()->page()) { >+ const CString cookieStr = page->cookieJar().cookies(*frame->document(), u).utf8(); >+ if (!cookieStr.isNull()) { >+ const int size = cookieStr.length(); >+ *value = static_cast<char*>(NPN_MemAlloc(size+1)); >+ if (*value) { >+ memset(*value, 0, size+1); >+ memcpy(*value, cookieStr.data(), size+1); >+ if (len) >+ *len = size; >+ } else >+ result = NPERR_OUT_OF_MEMORY_ERROR; >+ } > } >- } >+ } > } else > result = NPERR_INVALID_URL; > break; >@@ -1334,8 +1336,10 @@ NPError PluginView::setValueForURL(NPNUR > if (u.isValid()) { > const String cookieStr = String::fromUTF8(value, len); > Frame* frame = getFrame(parentFrame(), m_element); >- if (frame && frame->document() && !cookieStr.isEmpty()) >- setCookies(*frame->document(), u, cookieStr); >+ if (frame && frame->document() && !cookieStr.isEmpty()) { >+ if (auto* page = frame->document()->page()) >+ page->cookieJar().setCookies(*frame->document(), u, cookieStr); >+ } > } else > result = NPERR_INVALID_URL; > break; >Index: Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp >=================================================================== >--- Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp (revision 239927) >+++ Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.cpp (working copy) >@@ -49,11 +49,6 @@ WebPlatformStrategies::WebPlatformStrate > setPlatformStrategies(this); > } > >-CookiesStrategy* WebPlatformStrategies::createCookiesStrategy() >-{ >- return this; >-} >- > LoaderStrategy* WebPlatformStrategies::createLoaderStrategy() > { > return new WebResourceLoadScheduler; >@@ -68,39 +63,3 @@ BlobRegistry* WebPlatformStrategies::cre > { > return new BlobRegistryImpl; > } >- >-std::pair<String, bool> WebPlatformStrategies::cookiesForDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookiesForDOM(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); >-} >- >-void WebPlatformStrategies::setCookiesFromDOM(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String& cookieString) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- session.setCookiesFromDOM(firstParty, sameSiteInfo, url, frameID, pageID, cookieString); >-} >- >-bool WebPlatformStrategies::cookiesEnabled(const PAL::SessionID& sessionID) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookiesEnabled(); >-} >- >-std::pair<String, bool> WebPlatformStrategies::cookieRequestHeaderFieldValue(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, IncludeSecureCookies includeSecureCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.cookieRequestHeaderFieldValue(firstParty, sameSiteInfo, url, frameID, pageID, includeSecureCookies); >-} >- >-bool WebPlatformStrategies::getRawCookies(const PAL::SessionID& sessionID, const URL& firstParty, const SameSiteInfo& sameSiteInfo, const URL& url, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<Cookie>& rawCookies) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- return session.getRawCookies(firstParty, sameSiteInfo, url, frameID, pageID, rawCookies); >-} >- >-void WebPlatformStrategies::deleteCookie(const PAL::SessionID& sessionID, const URL& url, const String& cookieName) >-{ >- auto& session = sessionID.isEphemeral() ? WebFrameNetworkingContext::ensurePrivateBrowsingSession() : NetworkStorageSession::defaultStorageSession(); >- session.deleteCookie(url, cookieName); >-} >Index: Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h >=================================================================== >--- Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h (revision 239927) >+++ Source/WebKitLegacy/win/WebCoreSupport/WebPlatformStrategies.h (working copy) >@@ -30,7 +30,7 @@ > #include <WebCore/PlatformStrategies.h> > #include <wtf/Forward.h> > >-class WebPlatformStrategies : public WebCore::PlatformStrategies, private WebCore::CookiesStrategy { >+class WebPlatformStrategies : public WebCore::PlatformStrategies { > public: > static void initialize(); > >@@ -39,16 +39,7 @@ private: > WebPlatformStrategies(); > > // WebCore::PlatformStrategies >- virtual WebCore::CookiesStrategy* createCookiesStrategy(); > virtual WebCore::LoaderStrategy* createLoaderStrategy(); > virtual WebCore::PasteboardStrategy* createPasteboardStrategy(); > virtual WebCore::BlobRegistry* createBlobRegistry(); >- >- // WebCore::CookiesStrategy >- std::pair<String, bool> cookiesForDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- virtual void setCookiesFromDOM(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, const String&); >- virtual bool cookiesEnabled(const PAL::SessionID&); >- std::pair<String, bool> cookieRequestHeaderFieldValue(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, WebCore::IncludeSecureCookies) override; >- virtual bool getRawCookies(const PAL::SessionID&, const URL& firstParty, const WebCore::SameSiteInfo&, const URL&, Optional<uint64_t> frameID, Optional<uint64_t> pageID, Vector<WebCore::Cookie>&); >- virtual void deleteCookie(const PAL::SessionID&, const URL&, const String&); > };
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 161106
:
286781
|
286794
|
286899
|
286905
|
286910
|
286927
|
359037
|
359039
|
359042
|
359051
|
359062
|
359069
|
359186
|
359195
|
359197
|
359201
|
359203
|
359204
|
359206