Diff
Modified: trunk/Source/WebCore/ChangeLog (213758 => 213759)
--- trunk/Source/WebCore/ChangeLog 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/ChangeLog 2017-03-11 16:44:00 UTC (rev 213759)
@@ -1,3 +1,58 @@
+2017-03-11 Brady Eidson <[email protected]>
+
+ Cleanup "addCookie" and its sole user.
+ https://bugs.webkit.org/show_bug.cgi?id=169486
+
+ Reviewed by Brian Burg.
+
+ No new tests (Refactor, no behavior change)
+
+ * WebCore.xcodeproj/project.pbxproj:
+
+ * loader/CookieJar.cpp:
+ (WebCore::addCookie): Deleted.
+ * loader/CookieJar.h:
+
+ * platform/Cookie.h:
+ (WebCore::Cookie::Cookie):
+ (WebCore::CookieHash::hash):
+ (WebCore::CookieHash::equal):
+ (WebCore::Cookie::encode):
+ (WebCore::Cookie::decode):
+
+ * platform/CookiesStrategy.h:
+
+ * platform/network/NetworkStorageSession.h:
+
+ * platform/network/PlatformCookieJar.h:
+
+ * platform/network/cf/CookieJarCFNet.cpp:
+ (WebCore::addCookie): Deleted.
+
+ * platform/network/cocoa/CookieCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
+ (WebCore::Cookie::operator NSHTTPCookie *):
+
+ * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Copied from Source/WebCore/loader/CookieJar.h.
+ (WebCore::NetworkStorageSession::setCookies):
+ (WebCore::NetworkStorageSession::nsCookieStorage):
+
+ * platform/network/curl/CookieJarCurl.cpp:
+ (WebCore::addCookie): Deleted.
+
+ * platform/network/mac/CookieJarMac.mm:
+ (WebCore::deleteCookiesForHostnames):
+ (WebCore::deleteAllCookiesModifiedSince):
+ (WebCore::addCookie): Deleted.
+ (WebCore::cookieStorage): Deleted.
+
+ * platform/network/soup/CookieJarSoup.cpp:
+ (WebCore::toSoupCookie): Deleted.
+ (WebCore::addCookie): Deleted.
+
+ * platform/network/soup/NetworkStorageSessionSoup.cpp:
+ (WebCore::toSoupCookie):
+ (WebCore::NetworkStorageSession::setCookies):
+
2017-03-10 Alex Christensen <[email protected]>
Fix watch and tv builds after r213294
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213758 => 213759)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-11 16:44:00 UTC (rev 213759)
@@ -2278,6 +2278,8 @@
51C81B8A0C4422F70019ECE3 /* FTPDirectoryParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C81B880C4422F70019ECE3 /* FTPDirectoryParser.h */; };
51CBFC990D10E483002DBF51 /* CachedFramePlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51CBFC980D10E483002DBF51 /* CachedFramePlatformData.h */; settings = {ATTRIBUTES = (Private, ); }; };
51D0C5160DAA90B7003B3831 /* JSStorageCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D0C5150DAA90B7003B3831 /* JSStorageCustom.cpp */; };
+ 51D1248B1E73627F002B2820 /* NetworkStorageSessionCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D1248A1E73625C002B2820 /* NetworkStorageSessionCocoa.mm */; };
+ 51D1248D1E7364AA002B2820 /* CookieCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D1248C1E736456002B2820 /* CookieCocoa.mm */; };
51D7236C1BB6174900478CA3 /* IDBResultData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D7236A1BB60BFE00478CA3 /* IDBResultData.cpp */; };
51D7236D1BB6174900478CA3 /* IDBResultData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D7236B1BB60BFE00478CA3 /* IDBResultData.h */; settings = {ATTRIBUTES = (Private, ); }; };
51D7EFEA1BDE8F8C00E93E10 /* ThreadSafeDataBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 511FAEA91BDC989A00B4AFE4 /* ThreadSafeDataBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9715,6 +9717,8 @@
51C81B880C4422F70019ECE3 /* FTPDirectoryParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FTPDirectoryParser.h; sourceTree = "<group>"; };
51CBFC980D10E483002DBF51 /* CachedFramePlatformData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFramePlatformData.h; sourceTree = "<group>"; };
51D0C5150DAA90B7003B3831 /* JSStorageCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStorageCustom.cpp; sourceTree = "<group>"; };
+ 51D1248A1E73625C002B2820 /* NetworkStorageSessionCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkStorageSessionCocoa.mm; sourceTree = "<group>"; };
+ 51D1248C1E736456002B2820 /* CookieCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CookieCocoa.mm; sourceTree = "<group>"; };
51D7196C181106DF0016DC51 /* DOMWindowIndexedDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowIndexedDatabase.cpp; sourceTree = "<group>"; };
51D7196D181106DF0016DC51 /* DOMWindowIndexedDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowIndexedDatabase.h; sourceTree = "<group>"; };
51D7196E181106DF0016DC51 /* DOMWindowIndexedDatabase.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindowIndexedDatabase.idl; sourceTree = "<group>"; };
@@ -19095,9 +19099,11 @@
7E7DE1FE195CEF2D0035363B /* cocoa */ = {
isa = PBXGroup;
children = (
+ 51D1248C1E736456002B2820 /* CookieCocoa.mm */,
3792917C1987678F00F4B661 /* CredentialCocoa.h */,
3792917B1987678F00F4B661 /* CredentialCocoa.mm */,
5C9B860B1C21E3C600110F36 /* NetworkLoadMetrics.mm */,
+ 51D1248A1E73625C002B2820 /* NetworkStorageSessionCocoa.mm */,
372ADA37197F47B900FC501E /* ProtectionSpaceCocoa.h */,
372ADA39197F687600FC501E /* ProtectionSpaceCocoa.mm */,
7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */,
@@ -30177,6 +30183,7 @@
CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */,
5D8C4DBF1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp in Sources */,
FD31609012B026F700C1A359 /* Distance.cpp in Sources */,
+ 51D1248B1E73627F002B2820 /* NetworkStorageSessionCocoa.mm in Sources */,
A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */,
B2F34FE90E82F82700F627CD /* DNSCFNet.cpp in Sources */,
F293B27E56C112F373FFF27E /* DNSResolveQueue.cpp in Sources */,
@@ -32140,6 +32147,7 @@
BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */,
0F09087F1444FDB200028917 /* ScrollbarTheme.cpp in Sources */,
BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */,
+ 51D1248D1E7364AA002B2820 /* CookieCocoa.mm in Sources */,
44C991820F3D1E0D00586670 /* ScrollbarThemeIOS.mm in Sources */,
BCEF869F0E844E9D00A85CD5 /* ScrollbarThemeMac.mm in Sources */,
0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */,
Modified: trunk/Source/WebCore/loader/CookieJar.cpp (213758 => 213759)
--- trunk/Source/WebCore/loader/CookieJar.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/loader/CookieJar.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -83,9 +83,4 @@
platformStrategies()->cookiesStrategy()->deleteCookie(storageSession(document), url, cookieName);
}
-void addCookie(const Document& document, const URL& url, const Cookie& cookie)
-{
- platformStrategies()->cookiesStrategy()->addCookie(storageSession(document), url, cookie);
}
-
-}
Modified: trunk/Source/WebCore/loader/CookieJar.h (213758 => 213759)
--- trunk/Source/WebCore/loader/CookieJar.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/loader/CookieJar.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -45,6 +45,5 @@
WEBCORE_EXPORT String cookieRequestHeaderFieldValue(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);
-WEBCORE_EXPORT void addCookie(const Document&, const URL&, const Cookie&);
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/Cookie.h (213758 => 213759)
--- trunk/Source/WebCore/platform/Cookie.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/Cookie.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -29,49 +29,95 @@
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
+#ifdef __OBJC__
+#include <objc/objc.h>
+#endif
+
namespace WebCore {
- struct Cookie {
- Cookie() { }
+struct Cookie {
+ Cookie() { }
- Cookie(const String& name, const String& value, const String& domain,
- const String& path, double expires, bool httpOnly, bool secure,
- bool session)
- : name(name)
- , value(value)
- , domain(domain)
- , path(path)
- , expires(expires)
- , httpOnly(httpOnly)
- , secure(secure)
- , session(session)
- {
- }
+ Cookie(const String& name, const String& value, const String& domain, const String& path, double expires, bool httpOnly, bool secure, bool session)
+ : name(name)
+ , value(value)
+ , domain(domain)
+ , path(path)
+ , expires(expires)
+ , httpOnly(httpOnly)
+ , secure(secure)
+ , session(session)
+ {
+ }
- String name;
- String value;
- String domain;
- String path;
- // Expiration date, expressed as milliseconds since the UNIX epoch.
- double expires;
- bool httpOnly;
- bool secure;
- bool session;
- };
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static bool decode(Decoder&, Cookie&);
- struct CookieHash {
- static unsigned hash(const Cookie& key)
- {
- return StringHash::hash(key.name) + StringHash::hash(key.domain) + StringHash::hash(key.path) + key.secure;
- }
+#ifdef __OBJC__
+ operator NSHTTPCookie *() const;
+#endif
- static bool equal(const Cookie& a, const Cookie& b)
- {
- return a.name == b.name && a.domain == b.domain && a.path == b.path && a.secure == b.secure;
- }
- };
+ String name;
+ String value;
+ String domain;
+ String path;
+ // Expiration date, expressed as milliseconds since the UNIX epoch.
+ double expires;
+ bool httpOnly;
+ bool secure;
+ bool session;
+};
+
+struct CookieHash {
+ static unsigned hash(const Cookie& key)
+ {
+ return StringHash::hash(key.name) + StringHash::hash(key.domain) + StringHash::hash(key.path) + key.secure;
+ }
+
+ static bool equal(const Cookie& a, const Cookie& b)
+ {
+ return a.name == b.name && a.domain == b.domain && a.path == b.path && a.secure == b.secure;
+ }
+};
+
+template<class Encoder>
+void Cookie::encode(Encoder& encoder) const
+{
+ encoder << name;
+ encoder << value;
+ encoder << domain;
+ encoder << path;
+ encoder << expires;
+ encoder << httpOnly;
+ encoder << secure;
+ encoder << session;
}
+template<class Decoder>
+bool Cookie::decode(Decoder& decoder, Cookie& cookie)
+{
+ if (!decoder.decode(cookie.name))
+ return false;
+ if (!decoder.decode(cookie.value))
+ return false;
+ if (!decoder.decode(cookie.domain))
+ return false;
+ if (!decoder.decode(cookie.path))
+ return false;
+ if (!decoder.decode(cookie.expires))
+ return false;
+ if (!decoder.decode(cookie.httpOnly))
+ return false;
+ if (!decoder.decode(cookie.secure))
+ return false;
+ if (!decoder.decode(cookie.session))
+ return false;
+
+ return true;
+}
+
+}
+
namespace WTF {
template<typename T> struct DefaultHash;
template<> struct DefaultHash<WebCore::Cookie> {
Modified: trunk/Source/WebCore/platform/CookiesStrategy.h (213758 => 213759)
--- trunk/Source/WebCore/platform/CookiesStrategy.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/CookiesStrategy.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -45,7 +45,6 @@
virtual String cookieRequestHeaderFieldValue(SessionID, const URL& firstParty, const URL&) = 0;
virtual bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&) = 0;
virtual void deleteCookie(const NetworkStorageSession&, const URL&, const String& cookieName) = 0;
- virtual void addCookie(const NetworkStorageSession&, const URL&, const Cookie&) = 0;
protected:
virtual ~CookiesStrategy() { }
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (213758 => 213759)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -41,6 +41,10 @@
typedef struct _SoupCookieJar SoupCookieJar;
#endif
+#ifdef __OBJC__
+#include <objc/objc.h>
+#endif
+
namespace WebCore {
class NetworkingContext;
@@ -47,6 +51,8 @@
class ResourceRequest;
class SoupNetworkSession;
+struct Cookie;
+
class NetworkStorageSession {
WTF_MAKE_NONCOPYABLE(NetworkStorageSession); WTF_MAKE_FAST_ALLOCATED;
public:
@@ -61,6 +67,10 @@
SessionID sessionID() const { return m_sessionID; }
CredentialStorage& credentialStorage() { return m_credentialStorage; }
+#ifdef __OBJC__
+ NSHTTPCookieStorage *nsCookieStorage() const;
+#endif
+
#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
NetworkStorageSession(SessionID, RetainPtr<CFURLStorageSessionRef>);
@@ -90,6 +100,8 @@
NetworkingContext* context() const;
#endif
+ WEBCORE_EXPORT void setCookies(const Vector<Cookie>&, const URL&, const URL& mainDocumentURL);
+
private:
static HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>& globalSessionMap();
SessionID m_sessionID;
Modified: trunk/Source/WebCore/platform/network/PlatformCookieJar.h (213758 => 213759)
--- trunk/Source/WebCore/platform/network/PlatformCookieJar.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/PlatformCookieJar.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -46,7 +46,6 @@
WEBCORE_EXPORT String cookieRequestHeaderFieldValue(const NetworkStorageSession&, const URL& firstParty, const URL&);
WEBCORE_EXPORT bool getRawCookies(const NetworkStorageSession&, const URL& firstParty, const URL&, Vector<Cookie>&);
WEBCORE_EXPORT void deleteCookie(const NetworkStorageSession&, const URL&, const String&);
-WEBCORE_EXPORT void addCookie(const NetworkStorageSession&, const URL&, const Cookie&);
WEBCORE_EXPORT void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames);
WEBCORE_EXPORT void deleteCookiesForHostnames(const NetworkStorageSession&, const Vector<String>& cookieHostNames);
WEBCORE_EXPORT void deleteAllCookies(const NetworkStorageSession&);
Modified: trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (213758 => 213759)
--- trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -218,12 +218,6 @@
}
}
-void addCookie(const NetworkStorageSession&, const URL&, const Cookie&)
-{
- // FIXME: implement this command. <https://webkit.org/b/156298>
- notImplemented();
-}
-
void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookies(session.cookieStorage().get()));
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (213758 => 213759)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -166,4 +166,11 @@
#endif // HAVE(CFNETWORK_STORAGE_PARTITIONING)
+#if !PLATFORM(COCOA)
+void NetworkStorageSession::setCookies(const Vector<Cookie>&, const URL&, const URL&)
+{
+ // FIXME: Implement this. <https://webkit.org/b/156298>
}
+#endif
+
+}
Copied: trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm (from rev 213758, trunk/Source/WebCore/loader/CookieJar.h) (0 => 213759)
--- trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm 2017-03-11 16:44:00 UTC (rev 213759)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "Cookie.h"
+
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+Cookie::operator NSHTTPCookie *() const
+{
+ // FIXME: existing APIs do not provide a way to set httpOnly without parsing headers from scratch.
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+
+ return [NSHTTPCookie cookieWithProperties:@{
+ NSHTTPCookieName: name,
+ NSHTTPCookieValue: value,
+ NSHTTPCookieDomain: domain,
+ NSHTTPCookiePath: path,
+ NSHTTPCookieDomain: domain,
+ NSHTTPCookieSecure: @(secure),
+ NSHTTPCookieDiscard: @(session),
+ NSHTTPCookieExpires: [NSDate dateWithTimeIntervalSince1970:expires / 1000.0],
+ }];
+
+ END_BLOCK_OBJC_EXCEPTIONS
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (from rev 213758, trunk/Source/WebCore/loader/CookieJar.h) (0 => 213759)
--- trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (rev 0)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2017-03-11 16:44:00 UTC (rev 213759)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#import "config.h"
+#import "NetworkStorageSession.h"
+
+#import "Cookie.h"
+#import "URL.h"
+#import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+
+void NetworkStorageSession::setCookies(const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL)
+{
+ RetainPtr<NSMutableArray> nsCookies = adoptNS([[NSMutableArray alloc] initWithCapacity:cookies.size()]);
+ for (auto cookie : cookies)
+ [nsCookies addObject:(NSHTTPCookie *)cookie];
+
+ BEGIN_BLOCK_OBJC_EXCEPTIONS;
+ [nsCookieStorage() setCookies:nsCookies.get() forURL:(NSURL *)url mainDocumentURL:(NSURL *)mainDocumentURL];
+ END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+NSHTTPCookieStorage *NetworkStorageSession::nsCookieStorage() const
+{
+ auto cfCookieStorage = cookieStorage();
+ if (!cfCookieStorage || [NSHTTPCookieStorage sharedHTTPCookieStorage]._cookieStorage == cfCookieStorage)
+ return [NSHTTPCookieStorage sharedHTTPCookieStorage];
+
+ return [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cfCookieStorage.get()] autorelease];
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp (213758 => 213759)
--- trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/curl/CookieJarCurl.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -332,12 +332,6 @@
// FIXME: Not yet implemented
}
-void addCookie(const NetworkStorageSession&, const URL&, const Cookie&)
-{
- // FIXME: implement this command. <https://webkit.org/b/156296>
- notImplemented();
-}
-
void getHostnamesWithCookies(const NetworkStorageSession&, HashSet<String>& hostnames)
{
// FIXME: Not yet implemented
Modified: trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm (213758 => 213759)
--- trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm 2017-03-11 16:44:00 UTC (rev 213759)
@@ -31,10 +31,6 @@
#import "WebCoreSystemInterface.h"
#import <wtf/BlockObjCExceptions.h>
-namespace WebCore {
-static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession&);
-}
-
#if !USE(CFURLCONNECTION)
#import "Cookie.h"
@@ -260,38 +256,6 @@
END_BLOCK_OBJC_EXCEPTIONS;
}
-void addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
-
- // FIXME: existing APIs do not provide a way to set httpOnly without parsing headers from scratch.
-
- NSURL *originURL = url;
- NSHTTPCookie *httpCookie = [NSHTTPCookie cookieWithProperties:@{
- NSHTTPCookieName: cookie.name,
- NSHTTPCookieValue: cookie.value,
- NSHTTPCookieDomain: cookie.domain,
- NSHTTPCookiePath: cookie.path,
- NSHTTPCookieOriginURL: originURL,
- NSHTTPCookieSecure: @(cookie.secure),
- NSHTTPCookieDiscard: @(cookie.session),
- NSHTTPCookieExpires: [NSDate dateWithTimeIntervalSince1970:cookie.expires / 1000.0],
- }];
-
-#if !USE(CFURLCONNECTION)
- if (!cookieStorage) {
- [WebCore::cookieStorage(session) setCookie:httpCookie];
- return;
- }
-#endif // !USE(CFURLCONNECTION)
-
- CFHTTPCookieStorageSetCookie(cookieStorage.get(), [httpCookie _CFHTTPCookie]);
-
- END_BLOCK_OBJC_EXCEPTIONS;
-}
-
void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -315,15 +279,6 @@
namespace WebCore {
-static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession& session)
-{
- auto cookieStorage = session.cookieStorage();
- if (!cookieStorage || [NSHTTPCookieStorage sharedHTTPCookieStorage]._cookieStorage == cookieStorage)
- return [NSHTTPCookieStorage sharedHTTPCookieStorage];
-
- return [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorage.get()] autorelease];
-}
-
void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& hostnames)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -348,7 +303,7 @@
wkDeleteHTTPCookie(cookieStorage.get(), cookie.get());
}
- [WebCore::cookieStorage(session) _saveCookies];
+ [session.nsCookieStorage() _saveCookies];
END_BLOCK_OBJC_EXCEPTIONS;
}
@@ -361,7 +316,7 @@
NSTimeInterval timeInterval = std::chrono::duration_cast<std::chrono::duration<double>>(timePoint.time_since_epoch()).count();
NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
- NSHTTPCookieStorage *storage = cookieStorage(session);
+ auto *storage = session.nsCookieStorage();
[storage removeCookiesSinceDate:date];
[storage _saveCookies];
Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (213758 => 213759)
--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -144,33 +144,6 @@
}
}
-static SoupDate* msToSoupDate(double ms)
-{
- int year = msToYear(ms);
- int dayOfYear = dayInYear(ms, year);
- bool leapYear = isLeapYear(year);
- return soup_date_new(year, monthFromDayInYear(dayOfYear, leapYear), dayInMonthFromDayInYear(dayOfYear, leapYear), msToHours(ms), msToMinutes(ms), static_cast<int>(ms / 1000) % 60);
-}
-
-static SoupCookie* toSoupCookie(const Cookie& cookie)
-{
- SoupCookie* soupCookie = soup_cookie_new(cookie.name.utf8().data(), cookie.value.utf8().data(),
- cookie.domain.utf8().data(), cookie.path.utf8().data(), -1);
- soup_cookie_set_http_only(soupCookie, cookie.httpOnly);
- soup_cookie_set_secure(soupCookie, cookie.secure);
- if (!cookie.session) {
- SoupDate* date = msToSoupDate(cookie.expires);
- soup_cookie_set_expires(soupCookie, date);
- soup_date_free(date);
- }
- return soupCookie;
-}
-
-void addCookie(const NetworkStorageSession& session, const URL&, const Cookie& cookie)
-{
- soup_cookie_jar_add_cookie(session.cookieStorage(), toSoupCookie(cookie));
-}
-
void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
GUniquePtr<GSList> cookies(soup_cookie_jar_all_cookies(session.cookieStorage()));
Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (213758 => 213759)
--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -30,9 +30,11 @@
#if USE(SOUP)
+#include "Cookie.h"
#include "ResourceHandle.h"
#include "SoupNetworkSession.h"
#include <libsoup/soup.h>
+#include <wtf/DateMath.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/glib/GUniquePtr.h>
@@ -274,6 +276,35 @@
#endif
}
+static SoupDate* msToSoupDate(double ms)
+{
+ int year = msToYear(ms);
+ int dayOfYear = dayInYear(ms, year);
+ bool leapYear = isLeapYear(year);
+ return soup_date_new(year, monthFromDayInYear(dayOfYear, leapYear), dayInMonthFromDayInYear(dayOfYear, leapYear), msToHours(ms), msToMinutes(ms), static_cast<int>(ms / 1000) % 60);
+}
+
+static SoupCookie* toSoupCookie(const Cookie& cookie)
+{
+ SoupCookie* soupCookie = soup_cookie_new(cookie.name.utf8().data(), cookie.value.utf8().data(),
+ cookie.domain.utf8().data(), cookie.path.utf8().data(), -1);
+ soup_cookie_set_http_only(soupCookie, cookie.httpOnly);
+ soup_cookie_set_secure(soupCookie, cookie.secure);
+ if (!cookie.session) {
+ SoupDate* date = msToSoupDate(cookie.expires);
+ soup_cookie_set_expires(soupCookie, date);
+ soup_date_free(date);
+ }
+ return soupCookie;
+}
+
+void NetworkStorageSession::setCookies(const Vector<Cookie>& cookies, const URL&, const URL&)
+{
+ for (auto cookie : cookies)
+ soup_cookie_jar_add_cookie(cookieStorage(), toSoupCookie(cookie));
+}
+
+
} // namespace WebCore
#endif // USE(SOUP)
Modified: trunk/Source/WebKit/mac/ChangeLog (213758 => 213759)
--- trunk/Source/WebKit/mac/ChangeLog 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-03-11 16:44:00 UTC (rev 213759)
@@ -1,3 +1,14 @@
+2017-03-11 Brady Eidson <[email protected]>
+
+ Cleanup "addCookie" and its sole user.
+ https://bugs.webkit.org/show_bug.cgi?id=169486
+
+ Reviewed by Brian Burg.
+
+ * WebCoreSupport/WebPlatformStrategies.h:
+ * WebCoreSupport/WebPlatformStrategies.mm:
+ (WebPlatformStrategies::addCookie): Deleted.
+
2017-03-10 Alex Christensen <[email protected]>
Fix watch and tv builds after r213294
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h (213758 => 213759)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -55,7 +55,6 @@
String cookieRequestHeaderFieldValue(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&) override;
bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override;
void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override;
- void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&) override;
// WebCore::PasteboardStrategy
#if PLATFORM(IOS)
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (213758 => 213759)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm 2017-03-11 16:44:00 UTC (rev 213759)
@@ -110,11 +110,6 @@
WebCore::deleteCookie(session, url, cookieName);
}
-void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
-{
- WebCore::addCookie(session, url, cookie);
-}
-
void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
{
PlatformPasteboard(pasteboardName).getTypes(types);
Modified: trunk/Source/WebKit2/ChangeLog (213758 => 213759)
--- trunk/Source/WebKit2/ChangeLog 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-11 16:44:00 UTC (rev 213759)
@@ -1,3 +1,38 @@
+2017-03-11 Brady Eidson <[email protected]>
+
+ Cleanup "addCookie" and its sole user.
+ https://bugs.webkit.org/show_bug.cgi?id=169486
+
+ Reviewed by Brian Burg.
+
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::addCookie): Deleted.
+ * NetworkProcess/NetworkConnectionToWebProcess.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<Cookie>::encode): Deleted.
+ (IPC::ArgumentCoder<Cookie>::decode): Deleted.
+ * Shared/WebCoreArgumentCoders.h:
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::addSingleCookie):
+
+ * UIProcess/WebCookieManagerProxy.cpp:
+ (WebKit::WebCookieManagerProxy::setCookies):
+ (WebKit::WebCookieManagerProxy::addCookie): Deleted.
+ * UIProcess/WebCookieManagerProxy.h:
+
+ * WebProcess/Cookies/WebCookieManager.cpp:
+ (WebKit::WebCookieManager::setCookies):
+ (WebKit::WebCookieManager::addCookie): Deleted.
+ * WebProcess/Cookies/WebCookieManager.h:
+ * WebProcess/Cookies/WebCookieManager.messages.in:
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+ (WebKit::WebPlatformStrategies::addCookie): Deleted.
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
2017-03-10 Alex Christensen <[email protected]>
Fix watch and tv builds after r213294
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (213758 => 213759)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -279,11 +279,6 @@
WebCore::deleteCookie(storageSession(sessionID), url, cookieName);
}
-void NetworkConnectionToWebProcess::addCookie(SessionID sessionID, const URL& url, const Cookie& cookie)
-{
- WebCore::addCookie(storageSession(sessionID), url, cookie);
-}
-
void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, const SandboxExtension::Handle& extensionHandle, const String& contentType)
{
RefPtr<SandboxExtension> extension = SandboxExtension::create(extensionHandle);
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (213758 => 213759)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -91,7 +91,6 @@
void cookieRequestHeaderFieldValue(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, String& result);
void getRawCookies(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&);
void deleteCookie(WebCore::SessionID, const WebCore::URL&, const String& cookieName);
- void addCookie(WebCore::SessionID, const WebCore::URL&, const WebCore::Cookie&);
void registerFileBlobURL(const WebCore::URL&, const String& path, const SandboxExtension::Handle&, const String& contentType);
void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>&&, const String& contentType);
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (213758 => 213759)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2017-03-11 16:44:00 UTC (rev 213759)
@@ -38,7 +38,6 @@
CookieRequestHeaderFieldValue(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url) -> (String result)
GetRawCookies(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url) -> (Vector<WebCore::Cookie> cookies)
DeleteCookie(WebCore::SessionID sessionID, WebCore::URL url, String cookieName)
- AddCookie(WebCore::SessionID sessionID, WebCore::URL url, struct WebCore::Cookie cookie)
RegisterFileBlobURL(WebCore::URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType)
RegisterBlobURL(WebCore::URL url, Vector<WebCore::BlobPart> blobParts, String contentType)
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (213758 => 213759)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -31,7 +31,6 @@
#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/BlobPart.h>
#include <WebCore/CertificateInfo.h>
-#include <WebCore/Cookie.h>
#include <WebCore/Credential.h>
#include <WebCore/Cursor.h>
#include <WebCore/DatabaseDetails.h>
@@ -1284,41 +1283,6 @@
return true;
}
-
-void ArgumentCoder<Cookie>::encode(Encoder& encoder, const Cookie& cookie)
-{
- encoder << cookie.name;
- encoder << cookie.value;
- encoder << cookie.domain;
- encoder << cookie.path;
- encoder << cookie.expires;
- encoder << cookie.httpOnly;
- encoder << cookie.secure;
- encoder << cookie.session;
-}
-
-bool ArgumentCoder<Cookie>::decode(Decoder& decoder, Cookie& cookie)
-{
- if (!decoder.decode(cookie.name))
- return false;
- if (!decoder.decode(cookie.value))
- return false;
- if (!decoder.decode(cookie.domain))
- return false;
- if (!decoder.decode(cookie.path))
- return false;
- if (!decoder.decode(cookie.expires))
- return false;
- if (!decoder.decode(cookie.httpOnly))
- return false;
- if (!decoder.decode(cookie.secure))
- return false;
- if (!decoder.decode(cookie.session))
- return false;
-
- return true;
-}
-
void ArgumentCoder<DatabaseDetails>::encode(Encoder& encoder, const DatabaseDetails& details)
{
encoder << details.name();
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (213758 => 213759)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -83,7 +83,6 @@
class UserScript;
class URL;
struct CompositionUnderline;
-struct Cookie;
struct DictationAlternative;
struct DictionaryPopupInfo;
struct EventTrackingRegions;
@@ -405,11 +404,6 @@
static bool decode(Decoder&, WebCore::CompositionUnderline&);
};
-template<> struct ArgumentCoder<WebCore::Cookie> {
- static void encode(Encoder&, const WebCore::Cookie&);
- static bool decode(Decoder&, WebCore::Cookie&);
-};
-
template<> struct ArgumentCoder<WebCore::DatabaseDetails> {
static void encode(Encoder&, const WebCore::DatabaseDetails&);
static bool decode(Decoder&, WebCore::DatabaseDetails&);
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (213758 => 213759)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -727,8 +727,11 @@
FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The parameter 'httpOnly' was not found.");
WebCookieManagerProxy* cookieManager = m_processPool->supplement<WebCookieManagerProxy>();
- cookieManager->addCookie(WebCore::SessionID::defaultSessionID(), cookie, activeURL.host());
+ // FIXME: Using activeURL here twice is basically saying "this is always in the context of the main document"
+ // which probably isn't accurate.
+ cookieManager->setCookies(WebCore::SessionID::defaultSessionID(), { cookie }, activeURL, activeURL);
+
callback->sendSuccess();
}
Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp (213758 => 213759)
--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -129,9 +129,9 @@
processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time));
}
-void WebCookieManagerProxy::addCookie(WebCore::SessionID sessionID, const WebCore::Cookie& cookie, const String& hostname)
+void WebCookieManagerProxy::setCookies(WebCore::SessionID sessionID, const Vector<WebCore::Cookie>& cookies, const WebCore::URL& url, const WebCore::URL& mainDocumentURL)
{
- processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::AddCookie(sessionID, cookie, hostname));
+ processPool()->sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookies(sessionID, cookies, url, mainDocumentURL));
}
void WebCookieManagerProxy::startObservingCookieChanges(WebCore::SessionID sessionID)
Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h (213758 => 213759)
--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -69,8 +69,9 @@
void deleteCookiesForHostname(WebCore::SessionID, const String& hostname);
void deleteAllCookies(WebCore::SessionID);
void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point);
- void addCookie(WebCore::SessionID, const WebCore::Cookie&, const String& hostname);
+ void setCookies(WebCore::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL);
+
void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
void getHTTPCookieAcceptPolicy(std::function<void (HTTPCookieAcceptPolicy, CallbackBase::Error)>);
void setCookieStoragePartitioningEnabled(bool);
Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp (213758 => 213759)
--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -30,6 +30,7 @@
#include "WebCookieManagerMessages.h"
#include "WebCookieManagerProxyMessages.h"
#include "WebCoreArgumentCoders.h"
+#include <WebCore/Cookie.h>
#include <WebCore/CookieStorage.h>
#include <WebCore/NetworkStorageSession.h>
#include <WebCore/PlatformCookieJar.h>
@@ -83,10 +84,10 @@
WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
}
-void WebCookieManager::addCookie(SessionID sessionID, const Cookie& cookie, const String& hostname)
+void WebCookieManager::setCookies(WebCore::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL)
{
if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
- WebCore::addCookie(*storageSession, URL(URL(), hostname), cookie);
+ storageSession->setCookies(cookies, url, mainDocumentURL);
}
void WebCookieManager::notifyCookiesDidChange(SessionID sessionID)
Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h (213758 => 213759)
--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
#if USE(SOUP)
#include "SoupCookiePersistentStorageType.h"
@@ -40,6 +41,7 @@
#endif
namespace WebCore {
+class URL;
struct Cookie;
}
@@ -69,8 +71,9 @@
void deleteCookiesForHostname(WebCore::SessionID, const String&);
void deleteAllCookies(WebCore::SessionID);
void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point);
- void addCookie(WebCore::SessionID, const WebCore::Cookie&, const String& hostname);
+ void setCookies(WebCore::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL);
+
void platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
void getHTTPCookieAcceptPolicy(uint64_t callbackID);
HTTPCookieAcceptPolicy platformGetHTTPCookieAcceptPolicy();
Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in (213758 => 213759)
--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in 2017-03-11 16:44:00 UTC (rev 213759)
@@ -28,8 +28,9 @@
void DeleteCookiesForHostname(WebCore::SessionID sessionID, String hostname)
void DeleteAllCookies(WebCore::SessionID sessionID)
void DeleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time)
- void AddCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, String hostname)
+ void SetCookies(WebCore::SessionID sessionID, Vector<WebCore::Cookie> cookies, WebCore::URL url, WebCore::URL mainDocumentURL);
+
void SetHTTPCookieAcceptPolicy(uint32_t policy)
void GetHTTPCookieAcceptPolicy(uint64_t callbackID)
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (213758 => 213759)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2017-03-11 16:44:00 UTC (rev 213759)
@@ -155,11 +155,6 @@
WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::DeleteCookie(session.sessionID(), url, cookieName), 0);
}
-void WebPlatformStrategies::addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
-{
- WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::AddCookie(session.sessionID(), url, cookie), 0);
-}
-
#if PLATFORM(COCOA)
// PasteboardStrategy
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (213758 => 213759)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2017-03-11 13:57:13 UTC (rev 213758)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h 2017-03-11 16:44:00 UTC (rev 213759)
@@ -56,7 +56,6 @@
String cookieRequestHeaderFieldValue(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&) override;
bool getRawCookies(const WebCore::NetworkStorageSession&, const WebCore::URL& firstParty, const WebCore::URL&, Vector<WebCore::Cookie>&) override;
void deleteCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const String&) override;
- void addCookie(const WebCore::NetworkStorageSession&, const WebCore::URL&, const WebCore::Cookie&) override;
// WebCore::PasteboardStrategy
#if PLATFORM(IOS)