Skip to content

Commit 0181ae5

Browse files
committed
Enabling tests for httpOnly cookies
1 parent aaf8168 commit 0181ae5

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ public Set<Cookie> getCookies() {
791791
String path = (String) rawCookie.get("path");
792792
String domain = (String) rawCookie.get("domain");
793793
boolean secure = rawCookie.containsKey("secure") && (Boolean) rawCookie.get("secure");
794+
boolean httpOnly = rawCookie.containsKey("httpOnly") && (Boolean) rawCookie.get("httpOnly");
794795

795796
Number expiryNum = (Number) rawCookie.get("expiry");
796797
Date expiry = expiryNum == null ? null : new Date(
@@ -800,6 +801,7 @@ public Set<Cookie> getCookies() {
800801
.path(path)
801802
.domain(domain)
802803
.isSecure(secure)
804+
.isHttpOnly(httpOnly)
803805
.expiresOn(expiry)
804806
.build());
805807
}

java/client/test/org/openqa/selenium/CookieImplementationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ public void canHandleHttpOnlyCookie() {
436436
assertNotNull(retrieved);
437437
}
438438

439-
@Ignore(ALL)
439+
@Ignore(SAFARI)
440440
@Test
441441
public void testRetainsHttpOnlyFlag() {
442442
Cookie addedCookie =

java/client/test/org/openqa/selenium/environment/webserver/CookieServlet.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
6161
if (secure != null) {
6262
newCookie.setSecure(Boolean.parseBoolean(secure));
6363
}
64-
// TODO: Requires servlet-api 3.0+
65-
//if (httpOnly != null) {
66-
// newCookie.setHttpOnly(Boolean.parseBoolean(httpOnly));
67-
//}
64+
if (httpOnly != null) {
65+
newCookie.setHttpOnly(Boolean.parseBoolean(httpOnly));
66+
}
6867
response.addCookie(newCookie);
6968

7069
response.getOutputStream().println(

0 commit comments

Comments
 (0)