Skip to content

Commit e4c1bf9

Browse files
committed
Web Automation: cookies returned by automation should have expiry time in seconds
https://bugs.webkit.org/show_bug.cgi?id=182293 Reviewed by Brian Burg. When creating a WebCore::Cookie from a WebDriver object we convert the given expiry time to milliseconds, but when creating a WebDriver object from a WebCore::Cookie we are keeping the milliseconds. We should convert to seconds for consistency, so that the WebDriver always handles seconds. Fixes: imported/w3c/webdriver/tests/cookies/get_named_cookie.py::test_get_named_cookie * UIProcess/Automation/WebAutomationSession.cpp: (WebKit::buildObjectForCookie): Convert expiry to seconds. Canonical link: https://commits.webkit.org/198130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227891 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a9cbe5f commit e4c1bf9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Source/WebKit/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2018-01-31 Carlos Garcia Campos <cgarcia@igalia.com>
2+
3+
Web Automation: cookies returned by automation should have expiry time in seconds
4+
https://bugs.webkit.org/show_bug.cgi?id=182293
5+
6+
Reviewed by Brian Burg.
7+
8+
When creating a WebCore::Cookie from a WebDriver object we convert the given expiry time to milliseconds, but
9+
when creating a WebDriver object from a WebCore::Cookie we are keeping the milliseconds. We should convert to
10+
seconds for consistency, so that the WebDriver always handles seconds.
11+
12+
Fixes: imported/w3c/webdriver/tests/cookies/get_named_cookie.py::test_get_named_cookie
13+
14+
* UIProcess/Automation/WebAutomationSession.cpp:
15+
(WebKit::buildObjectForCookie): Convert expiry to seconds.
16+
117
2018-01-31 Ryosuke Niwa <rniwa@webkit.org>
218

319
Unreviewed iOS build fix.

Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ static Ref<Inspector::Protocol::Automation::Cookie> buildObjectForCookie(const W
11221122
.setValue(cookie.value)
11231123
.setDomain(cookie.domain)
11241124
.setPath(cookie.path)
1125-
.setExpires(cookie.expires)
1125+
.setExpires(cookie.expires ? cookie.expires / 1000 : 0)
11261126
.setSize((cookie.name.length() + cookie.value.length()))
11271127
.setHttpOnly(cookie.httpOnly)
11281128
.setSecure(cookie.secure)

0 commit comments

Comments
 (0)