diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:27:02 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:27:02 +0000 |
commit | f79b6495a07ca8c54ef9ccc2113304bf754b5fe2 (patch) | |
tree | 6f4604be026704e06ab059691e7b75e5af7cdf0e | |
parent | dded3e20a923ac15142e49e62286f195f05e5a07 (diff) | |
download | chromium_src-f79b6495a07ca8c54ef9ccc2113304bf754b5fe2.zip chromium_src-f79b6495a07ca8c54ef9ccc2113304bf754b5fe2.tar.gz chromium_src-f79b6495a07ca8c54ef9ccc2113304bf754b5fe2.tar.bz2 |
Fix crash when extensions try to set cookies. It is valid for
the cookie policy to be NULL, in which case we should default
to allowing cookies to be set.
R=eroman
BUG=34649
TEST=Try to install extension AniWeather from official gallery site
Review URL: http://codereview.chromium.org/578007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38178 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 2861718..253038a 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -583,11 +583,13 @@ void ResourceMessageFilter::OnSetCookie(const GURL& url, SetCookieCompletion* callback = new SetCookieCompletion(url, cookie, context); - DCHECK(context->cookie_policy()); - int policy = context->cookie_policy()->CanSetCookie( - url, first_party_for_cookies, cookie, callback); - if (policy == net::ERR_IO_PENDING) - return; + int policy = net::OK; + if (context->cookie_policy()) { + policy = context->cookie_policy()->CanSetCookie( + url, first_party_for_cookies, cookie, callback); + if (policy == net::ERR_IO_PENDING) + return; + } callback->Run(policy); } @@ -599,11 +601,13 @@ void ResourceMessageFilter::OnGetCookies(const GURL& url, GetCookiesCompletion* callback = new GetCookiesCompletion(url, reply_msg, this, context); - DCHECK(context->cookie_policy()); - int policy = context->cookie_policy()->CanGetCookies( - url, first_party_for_cookies, callback); - if (policy == net::ERR_IO_PENDING) - return; + int policy = net::OK; + if (context->cookie_policy()) { + policy = context->cookie_policy()->CanGetCookies( + url, first_party_for_cookies, callback); + if (policy == net::ERR_IO_PENDING) + return; + } callback->Run(policy); } @@ -619,11 +623,13 @@ void ResourceMessageFilter::OnGetRawCookies( // We check policy here to avoid sending back cookies that would not normally // be applied to outbound requests for the given URL. Since this cookie info // is visible in the developer tools, it is helpful to make it match reality. - DCHECK(context->cookie_policy()); - int policy = context->cookie_policy()->CanGetCookies( - url, first_party_for_cookies, callback); - if (policy == net::ERR_IO_PENDING) - return; + int policy = net::OK; + if (context->cookie_policy()) { + policy = context->cookie_policy()->CanGetCookies( + url, first_party_for_cookies, callback); + if (policy == net::ERR_IO_PENDING) + return; + } callback->Run(policy); } |