Title: [200159] trunk/Source/WebCore
- Revision
- 200159
- Author
- mcatanz...@igalia.com
- Date
- 2016-04-27 16:32:13 -0700 (Wed, 27 Apr 2016)
Log Message
[SOUP] Implement PlatformCookieJar::addCookie
https://bugs.webkit.org/show_bug.cgi?id=156295
Reviewed by Carlos Garcia Campos.
* platform/network/soup/CookieJarSoup.cpp:
(WebCore::msToSoupDate):
(WebCore::toSoupCookie):
(WebCore::addCookie):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (200158 => 200159)
--- trunk/Source/WebCore/ChangeLog 2016-04-27 23:31:39 UTC (rev 200158)
+++ trunk/Source/WebCore/ChangeLog 2016-04-27 23:32:13 UTC (rev 200159)
@@ -1,3 +1,15 @@
+2016-04-27 Michael Catanzaro <mcatanz...@igalia.com>
+
+ [SOUP] Implement PlatformCookieJar::addCookie
+ https://bugs.webkit.org/show_bug.cgi?id=156295
+
+ Reviewed by Carlos Garcia Campos.
+
+ * platform/network/soup/CookieJarSoup.cpp:
+ (WebCore::msToSoupDate):
+ (WebCore::toSoupCookie):
+ (WebCore::addCookie):
+
2016-04-27 Chris Dumez <cdu...@apple.com>
Let the bindings generator use WTF::Optional for optional parameters using [Clamp]
Modified: trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp (200158 => 200159)
--- trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2016-04-27 23:31:39 UTC (rev 200158)
+++ trunk/Source/WebCore/platform/network/soup/CookieJarSoup.cpp 2016-04-27 23:32:13 UTC (rev 200159)
@@ -28,9 +28,9 @@
#include "GUniquePtrSoup.h"
#include "URL.h"
#include "NetworkingContext.h"
-#include "NotImplemented.h"
#include "PlatformCookieJar.h"
#include "SoupNetworkSession.h"
+#include <wtf/DateMath.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/CString.h>
@@ -192,12 +192,33 @@
}
}
-void addCookie(const NetworkStorageSession&, const URL&, const Cookie&)
+static SoupDate* msToSoupDate(double ms)
{
- // FIXME: implement this command. <https://webkit.org/b/156295>
- notImplemented();
+ 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(cookieJarForSession(session), toSoupCookie(cookie));
+}
+
void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
{
SoupCookieJar* cookieJar = cookieJarForSession(session);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes