Title: [230286] trunk/Source/WebCore
Revision
230286
Author
bb...@apple.com
Date
2018-04-04 17:22:09 -0700 (Wed, 04 Apr 2018)

Log Message

[Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails
https://bugs.webkit.org/show_bug.cgi?id=184314
<rdar://problem/39186578>

Reviewed by Timothy Hatcher.

Covered by several tests in add_cookie.py per the bug title.

* platform/network/cocoa/CookieCocoa.mm:
(WebCore::Cookie::operator NSHTTPCookie * const):
By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted
precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that
the truncated value and actual value are the same.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230285 => 230286)


--- trunk/Source/WebCore/ChangeLog	2018-04-04 23:33:06 UTC (rev 230285)
+++ trunk/Source/WebCore/ChangeLog	2018-04-05 00:22:09 UTC (rev 230286)
@@ -1,3 +1,19 @@
+2018-04-04  Brian Burg  <bb...@apple.com>
+
+        [Cocoa] WebDriver: test imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_non_session_cookie fails
+        https://bugs.webkit.org/show_bug.cgi?id=184314
+        <rdar://problem/39186578>
+
+        Reviewed by Timothy Hatcher.
+
+        Covered by several tests in add_cookie.py per the bug title.
+
+        * platform/network/cocoa/CookieCocoa.mm:
+        (WebCore::Cookie::operator NSHTTPCookie * const):
+        By converting an integral UNIX timestamp to |maxAge| fractional seconds into the future, we introduce unwanted
+        precision that is truncated when switching back to a UNIX timestamp later. Always round up maxAge so that
+        the truncated value and actual value are the same.
+
 2018-04-04  Alex Christensen  <achristen...@webkit.org>
 
         Move PingHandle to WebKitLegacy

Modified: trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm (230285 => 230286)


--- trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm	2018-04-04 23:33:06 UTC (rev 230285)
+++ trunk/Source/WebCore/platform/network/cocoa/CookieCocoa.mm	2018-04-05 00:22:09 UTC (rev 230286)
@@ -105,7 +105,7 @@
         [properties setObject:(NSString *)value forKey:NSHTTPCookieValue];
 
     NSDate *expirationDate = [NSDate dateWithTimeIntervalSince1970:expires / 1000.0];
-    auto maxAge = [expirationDate timeIntervalSinceNow];
+    auto maxAge = ceil([expirationDate timeIntervalSinceNow]);
     if (maxAge > 0)
         [properties setObject:[NSString stringWithFormat:@"%f", maxAge] forKey:NSHTTPCookieMaximumAge];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to