Bug 1456996 - [wdclient] Add http-only support for setting a cookie. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 25 Apr 2018 23:34:25 +0200
changeset 788291 41839b8d53603d034bf8f2dbb57c53381ca870f9
parent 788290 77432b32c9413af703b7d2b7ae2cc1caf11e2ca4
child 788292 08cbb5a14cd414e4c408908f39bc6cde93a97d65
push id107943
push userbmo:hskupin@gmail.com
push dateThu, 26 Apr 2018 06:08:24 +0000
bugs1456996
milestone61.0a1
Bug 1456996 - [wdclient] Add http-only support for setting a cookie. MozReview-Commit-ID: ZkiNOXK9Wg
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -557,27 +557,33 @@ class Session(object):
     def cookies(self, name=None):
         if name is None:
             url = "cookie"
         else:
             url = "cookie/%s" % name
         return self.send_session_command("GET", url, {})
 
     @command
-    def set_cookie(self, name, value, path=None, domain=None, secure=None, expiry=None):
-        body = {"name": name,
-                "value": value}
+    def set_cookie(self, name, value, path=None, domain=None,
+            secure=None, expiry=None, http_only=None):
+        body = {
+            "name": name,
+            "value": value,
+        }
+
+        if domain is not None:
+            body["domain"] = domain
+        if expiry is not None:
+            body["expiry"] = expiry
+        if http_only is not None:
+            body["httpOnly"] = http_only
         if path is not None:
             body["path"] = path
-        if domain is not None:
-            body["domain"] = domain
         if secure is not None:
             body["secure"] = secure
-        if expiry is not None:
-            body["expiry"] = expiry
         self.send_session_command("POST", "cookie", {"cookie": body})
 
     def delete_cookie(self, name=None):
         if name is None:
             url = "cookie"
         else:
             url = "cookie/%s" % name
         self.send_session_command("DELETE", url, {})