diff options
author | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-08 03:38:29 +0000 |
---|---|---|
committer | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-08 03:38:29 +0000 |
commit | 3ffe71e020ea8e3597c2835f1ba0ebb8fb85ab9e (patch) | |
tree | fe9ac76dc74f86b0b9fbe803488ac1a9276e26f5 /chrome/browser/automation/url_request_automation_job.cc | |
parent | d5a49e5ad3e6eb962cc026c9fd5c945f89ea9b0c (diff) | |
download | chromium_src-3ffe71e020ea8e3597c2835f1ba0ebb8fb85ab9e.zip chromium_src-3ffe71e020ea8e3597c2835f1ba0ebb8fb85ab9e.tar.gz chromium_src-3ffe71e020ea8e3597c2835f1ba0ebb8fb85ab9e.tar.bz2 |
Reason:
Linux Builder (ChromiumOS) failed.
http://chrome-buildbot.corp.google.com:8010/builders/Linux%20Builder%20(ChromiumOS)/builds/2050/steps/compile/logs/stdio
Please add changes to external_cookie_handler_unittest.cc no to break compilation
and reland?
----
Revert 35769 - Deleting cookies by setting the expires attribute on them with an empty value would not work in ChromeFrame
with the host network stack enabled. When we receive a response in the host browser (IE) we send over the
response headers which include the SetCookie header and a list of cookies retreived via the InternetGetCookie
API. We call this API to retrieve the persistent cookies and send them over to Chrome.
However this API returns session cookies as well as persistent cookies. There is no documented way to return
only persistent cookies from IE. As a result we would end up setting duplicate cookies in Chrome, which caused
this issu.e. To workaround this issue when we receive the response in the url request automation job which
handles ChromeFrame network requests, we strip out duplicate cookies sent via InternetGetCookie.
When a script deletes a cookie we now handle it correctly in IE and set the data to an empty string. However
this does not delete the cookie. When such cookies show up in Chrome, we strip them out as well.
Fixes bug http://code.google.com/p/chromium/issues/detail?id=30786
The changes to chrome_frame_npapi.cc/.h are to move the NPAPI functions to the chrome_frame namespace as they
conflict with similar functions in NACL.
Added the DeleteCookie function to the CookieStore interface, which I think missed out by oversight.
Bug=30786
Test=Covered by ChromeFrame unit tests. I also added a unit test to test the newly added
URLRequestAutomationJob::IsCookiePresentInCookieHeader function
Review URL: http://codereview.chromium.org/518054
TBR=ananta@chromium.org
Review URL: http://codereview.chromium.org/517070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35771 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 | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc index 576743e..5433ca7 100644 --- a/chrome/browser/automation/url_request_automation_job.cc +++ b/chrome/browser/automation/url_request_automation_job.cc @@ -12,7 +12,6 @@ #include "chrome/browser/renderer_host/resource_dispatcher_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "chrome/test/automation/automation_messages.h" -#include "net/base/cookie_monster.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/http/http_util.h" @@ -257,7 +256,6 @@ void URLRequestAutomationJob::OnRequestStarted(int tab, int id, redirect_url_.c_str()); URLRequestContext* ctx = request_->context(); - std::vector<std::string> response_cookies; if (!response.headers.empty()) { headers_ = new net::HttpResponseHeaders( @@ -266,6 +264,7 @@ void URLRequestAutomationJob::OnRequestStarted(int tab, int id, // Parse and set HTTP cookies. const std::string name = "Set-Cookie"; std::string value; + std::vector<std::string> response_cookies; void* iter = NULL; while (headers_->EnumerateHeader(&iter, name, &value)) { @@ -292,20 +291,10 @@ void URLRequestAutomationJob::OnRequestStarted(int tab, int id, StringTokenizer cookie_parser(response.persistent_cookies, ";"); while (cookie_parser.GetNext()) { - 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); - // Ignore duplicate cookies, i.e. cookies passed in from the host - // browser which also exist in the response header. - if (!IsCookiePresentInCookieHeader(cookie_string, - response_cookies)) { - net::CookieOptions options; - ctx->cookie_store()->SetCookieWithOptions(url_for_cookies, - cookie_string, - options); - } - } + net::CookieOptions options; + ctx->cookie_store()->SetCookieWithOptions(url_for_cookies, + cookie_parser.token(), + options); } } @@ -447,19 +436,3 @@ void URLRequestAutomationJob::DisconnectFromMessageFilter() { message_filter_ = NULL; } } - -bool URLRequestAutomationJob::IsCookiePresentInCookieHeader( - const std::string& cookie_line, - const std::vector<std::string>& header_cookies) { - net::CookieMonster::ParsedCookie parsed_current_cookie(cookie_line); - for (size_t index = 0; index < header_cookies.size(); index++) { - net::CookieMonster::ParsedCookie parsed_header_cookie( - header_cookies[index]); - - if (parsed_header_cookie.Name() == parsed_current_cookie.Name()) - return true; - } - - return false; -} - |