diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 02:01:50 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-22 02:01:50 +0000 |
commit | 0a5210ff6726192d2d6058b1df1c993d8b592b69 (patch) | |
tree | 130003c1a44957cb1ab2cfe012e4d7d4f10ddc2c /chrome/browser/automation/url_request_automation_job.cc | |
parent | 675a578e829ebcc891b62b6343b04077075b1863 (diff) | |
download | chromium_src-0a5210ff6726192d2d6058b1df1c993d8b592b69.zip chromium_src-0a5210ff6726192d2d6058b1df1c993d8b592b69.tar.gz chromium_src-0a5210ff6726192d2d6058b1df1c993d8b592b69.tar.bz2 |
Fix for FullTabModeIE_ChromeFrameDeleteCookieTest and issues with deleting persistent cookies as reported in bug 30786.
TEST=Run FullTabModeIE_ChromeFrameDeleteCookieTest.
BUG=32546,30786
Review URL: http://codereview.chromium.org/551101
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/url_request_automation_job.cc')
-rw-r--r-- | chrome/browser/automation/url_request_automation_job.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 5e35ab8..f0ec8eb 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -320,7 +320,12 @@ void URLRequestAutomationJob::OnRequestStarted(int tab, int id, std::string cookie_string = cookie_parser.token(); // Only allow cookies with valid name value pairs. if (cookie_string.find('=') != std::string::npos) { - TrimWhitespace(cookie_string, TRIM_ALL, &cookie_string); + // Workaround for not having path information with the persistent + // cookies. When the path information is missing we assume path=/. + // If we don't do this the path of the cookie will be assumed to be + // the directory of url_for_cookies. + SetCookiePathToRootIfNotPresent(&cookie_string); + // Ignore duplicate cookies, i.e. cookies passed in from the host // browser which also exist in the response header. net::CookieMonster::ParsedCookie parsed_cookie(cookie_string); @@ -481,9 +486,28 @@ void URLRequestAutomationJob::DisconnectFromMessageFilter() { } } +// static bool URLRequestAutomationJob::IsCookiePresentInCookieHeader( const std::string& cookie_name, const std::vector<std::string>& header_cookies) { net::CookieMonster::ParsedCookie parsed_cookie(cookie_name); return IsParsedCookiePresentInCookieHeader(parsed_cookie, header_cookies); } + +// static +void URLRequestAutomationJob::SetCookiePathToRootIfNotPresent( + std::string* cookie_string) { + DCHECK(cookie_string); + TrimWhitespace(*cookie_string, TRIM_ALL, cookie_string); + + // First check if path is already specified. + net::CookieMonster::ParsedCookie parsed(*cookie_string); + if (parsed.IsValid() && !parsed.HasPath()) { + DCHECK(cookie_string->length() > 0); + + // The path is not specified, add it at the end. + if ((*cookie_string)[cookie_string->length() - 1] != ';') + *cookie_string += ';'; + cookie_string->append(" path=/"); + } +} |