Title: [228371] trunk/Source/WebKit
Revision
228371
Author
carlo...@webkit.org
Date
2018-02-11 23:33:46 -0800 (Sun, 11 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 (228370 => 228371)


--- trunk/Source/WebKit/ChangeLog	2018-02-12 07:32:16 UTC (rev 228370)
+++ trunk/Source/WebKit/ChangeLog	2018-02-12 07:33:46 UTC (rev 228371)
@@ -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-11  Yousuke Kimoto  <yousuke.kim...@sony.com>
 
         [WinCairo] Add WKBaseWin.h

Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (228370 => 228371)


--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-12 07:32:16 UTC (rev 228370)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp	2018-02-12 07:33:46 UTC (rev 228371)
@@ -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