summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:21:42 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:21:42 +0000
commit82568f616883739539e40da3fa4458c6086585cc (patch)
tree96354582be5731145abf50d77150639e1915020e /chrome/browser
parent20133f0bcd5e73965f816d2b66fb8edbaf17a7f2 (diff)
downloadchromium_src-82568f616883739539e40da3fa4458c6086585cc.zip
chromium_src-82568f616883739539e40da3fa4458c6086585cc.tar.gz
chromium_src-82568f616883739539e40da3fa4458c6086585cc.tar.bz2
Fixes a crash seen on chrome frame reliability test runs. The crash occurs while servicing the GetCookies IPC from the renderer
and routing it over the automation channel to the host. It looks like the render view is in the process of being deleted and thus it does not exist in the render view map. Fixes bug http://code.google.com/p/chromium/issues/detail?id=50966 Bug=50966 Review URL: http://codereview.chromium.org/2878067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54593 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.cc33
-rw-r--r--chrome/browser/automation/automation_resource_message_filter.h7
2 files changed, 31 insertions, 9 deletions
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index 2777f75..1529751 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -345,6 +345,11 @@ void AutomationResourceMessageFilter::GetCookiesForUrl(
filtered_render_views_.Get().find(RendererId(
get_cookies_callback->render_process_id(),
get_cookies_callback->render_view_id())));
+ if (automation_details_iter == filtered_render_views_.Get().end()) {
+ OnGetCookiesHostResponseInternal(tab_handle, false, url, "", callback,
+ cookie_store);
+ return;
+ }
DCHECK(automation_details_iter->second.filter != NULL);
@@ -379,21 +384,31 @@ void AutomationResourceMessageFilter::OnGetCookiesHostResponse(
completion_callback_map_.Get().erase(index);
- // Set the cookie in the cookie store so that the callback can read it.
- cookie_store->SetCookieWithOptions(url, cookies, net::CookieOptions());
-
- Tuple1<int> params;
- params.a = success ? net::OK : net::ERR_ACCESS_DENIED;
- callback->RunWithParams(params);
-
- // The cookie for this URL is only valid until it is read by the callback.
- cookie_store->SetCookieWithOptions(url, "", net::CookieOptions());
+ OnGetCookiesHostResponseInternal(tab_handle, success, url, cookies,
+ callback, cookie_store.get());
} else {
NOTREACHED() << "Received invalid completion callback id:"
<< cookie_id;
}
}
+void AutomationResourceMessageFilter::OnGetCookiesHostResponseInternal(
+ int tab_handle, bool success, const GURL& url, const std::string& cookies,
+ net::CompletionCallback* callback, net::CookieStore* cookie_store) {
+ DCHECK(callback);
+ DCHECK(cookie_store);
+
+ // Set the cookie in the cookie store so that the callback can read it.
+ cookie_store->SetCookieWithOptions(url, cookies, net::CookieOptions());
+
+ Tuple1<int> params;
+ params.a = success ? net::OK : net::ERR_ACCESS_DENIED;
+ callback->RunWithParams(params);
+
+ // The cookie for this URL is only valid until it is read by the callback.
+ cookie_store->SetCookieWithOptions(url, "", net::CookieOptions());
+}
+
void AutomationResourceMessageFilter::SetCookiesForUrl(
int tab_handle, const GURL&url, const std::string& cookie_line,
net::CompletionCallback* callback) {
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h
index a2acba8..5ed2a81 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -132,6 +132,13 @@ class AutomationResourceMessageFilter
int renderer_pid, int renderer_id, int tab_handle,
AutomationResourceMessageFilter* filter);
+ // Helper function to execute the GetCookies completion callback with the
+ // response for the GetCookies request from the renderer.
+ static void OnGetCookiesHostResponseInternal(
+ int tab_handle, bool success, const GURL& url,
+ const std::string& cookies, net::CompletionCallback* callback,
+ net::CookieStore* cookie_store);
+
private:
void OnSetFilteredInet(bool enable);
void OnGetFilteredInetHitCount(int* hit_count);