Skip to content
Permalink
Browse files
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):

Canonical link: https://commits.webkit.org/198489@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228371 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
carlosgcampos committed Feb 12, 2018
1 parent f801477 commit 0d0c3b4d78ddd6640db2df94291f476fca05ad6f
Showing with 21 additions and 1 deletion.
  1. +15 −0 Source/WebKit/ChangeLog
  2. +6 −1 Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
@@ -1,3 +1,18 @@
2018-02-05 Carlos Garcia Campos <cgarcia@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.kimoto@sony.com>

[WinCairo] Add WKBaseWin.h
@@ -1207,7 +1207,12 @@ void WebAutomationSession::addSingleCookie(ErrorString& errorString, const Strin
// 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))

0 comments on commit 0d0c3b4

Please sign in to comment.