Changeset 230367 in webkit
- Timestamp:
- Apr 6, 2018 9:08:50 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r230365 r230367 1 2018-04-06 Brian Burg <bburg@apple.com> 2 3 REGRESSION(r228371): WebAutomationSession::deleteAllCookies doesn't delete some cookies 4 https://bugs.webkit.org/show_bug.cgi?id=184334 5 <rdar://problem/39212863> 6 7 Reviewed by Timothy Hatcher. 8 9 When WebDriver adds a cookie for 'localhost', it actually uses the domain '.localhost' per RFC. 10 When deleting cookies, we first fetch all cookies matching the document's hostname, and 11 then delete them one by one. However, this code path does not add the dot prefix. This causes 12 no cookies to match the requested domain, and thus none of them are deleted. 13 14 * UIProcess/Automation/WebAutomationSession.cpp: 15 (WebKit::domainByAddingDotPrefixIfNeeded): Extract this helper method. 16 (WebKit::WebAutomationSession::addSingleCookie): Use helper method. 17 (WebKit::WebAutomationSession::deleteAllCookies): Add a dot prefix when 18 requesting to delete all cookies for a hostname. 19 1 20 2018-04-06 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r230027 r230367 1208 1208 } 1209 1209 1210 static String domainByAddingDotPrefixIfNeeded(String domain) 1211 { 1212 if (domain[0] != '.') { 1213 // RFC 2965: If an explicitly specified value does not start with a dot, the user agent supplies a leading dot. 1214 // Assume that any host that ends with a digit is trying to be an IP address. 1215 if (!WebCore::URL::hostIsIPAddress(domain)) 1216 return makeString('.', domain); 1217 } 1218 1219 return domain; 1220 } 1221 1210 1222 void WebAutomationSession::addSingleCookie(const String& browsingContextHandle, const JSON::Object& cookieObject, Ref<AddSingleCookieCallback>&& callback) 1211 1223 { … … 1232 1244 if (domain.isEmpty()) 1233 1245 domain = activeURL.host(); 1234 else if (domain[0] != '.') { 1235 // RFC 2965: If an explicitly specified value does not start with a dot, the user agent supplies a leading dot. 1236 // Assume that any host that ends with a digit is trying to be an IP address. 1237 if (!WebCore::URL::hostIsIPAddress(domain)) 1238 domain = makeString('.', domain); 1239 } 1240 cookie.domain = domain; 1246 1247 cookie.domain = domainByAddingDotPrefixIfNeeded(domain); 1241 1248 1242 1249 if (!cookieObject.getString(WTF::ASCIILiteral("path"), cookie.path)) … … 1280 1287 1281 1288 WebCookieManagerProxy* cookieManager = m_processPool->supplement<WebCookieManagerProxy>(); 1282 cookieManager->deleteCookiesForHostname(page->websiteDataStore().sessionID(), activeURL.host());1289 cookieManager->deleteCookiesForHostname(page->websiteDataStore().sessionID(), domainByAddingDotPrefixIfNeeded(activeURL.host())); 1283 1290 } 1284 1291
Note: See TracChangeset
for help on using the changeset viewer.