Title: [228087] trunk/Source/WebKit
Revision
228087
Author
carlo...@webkit.org
Date
2018-02-05 00:46:44 -0800 (Mon, 05 Feb 2018)

Log Message

WebDriver: addCookie command should prepend a dot to domain if missing
https://bugs.webkit.org/show_bug.cgi?id=182328
<rdar://problem/37116398>

Reviewed by Michael Catanzaro.

RFC 2965: If an explicitly specified value does not start with a dot, the user agent supplies a leading dot.

Fixes: imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_domain_cookie

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::addSingleCookie):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (228086 => 228087)


--- trunk/Source/WebKit/ChangeLog	2018-02-05 08:04:30 UTC (rev 228086)
+++ trunk/Source/WebKit/ChangeLog	2018-02-05 08:46:44 UTC (rev 228087)
@@ -1,3 +1,18 @@
+2018-02-05  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: addCookie command should prepend a dot to domain if missing
+        https://bugs.webkit.org/show_bug.cgi?id=182328
+        <rdar://problem/37116398>
+
+        Reviewed by Michael Catanzaro.
+
+        RFC 2965: If an explicitly specified value does not start with a dot, the user agent supplies a leading dot.
+
+        Fixes: imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_domain_cookie
+
+        * UIProcess/Automation/WebAutomationSession.cpp:
+        (WebKit::WebAutomationSession::addSingleCookie):
+
 2018-02-03  Tim Horton  <timothy_hor...@apple.com>
 
         UI process sometimes crashes under -[WKContentView _lookupForWebView:]

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (228086 => 228087)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-05 08:04:30 UTC (rev 228086)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-05 08:46:44 UTC (rev 228087)
@@ -1207,7 +1207,12 @@
     // Inherit the domain/host from the main frame's URL if it is not explicitly set.
     if (domain.isEmpty())
         domain = activeURL.host();
-
+    else if (domain[0] != '.') {
+        // RFC 2965: If an explicitly specified value does not start with a dot, the user agent supplies a leading dot.
+        // Assume that any host that ends with a digit is trying to be an IP address.
+        if (!WebCore::URL::hostIsIPAddress(domain))
+            domain = makeString('.', domain);
+    }
     cookie.domain = domain;
 
     if (!cookieObject.getString(WTF::ASCIILiteral("path"), cookie.path))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to