summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:43:53 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 20:43:53 +0000
commit83c7113a3eeb46aac0d338f8c6260d00331c3766 (patch)
treedada28270deb9d22382885a3556c22b030f03c26
parentf4c3e9784ea461a8b2d9428079dbbe8d2bf100da (diff)
downloadchromium_src-83c7113a3eeb46aac0d338f8c6260d00331c3766.zip
chromium_src-83c7113a3eeb46aac0d338f8c6260d00331c3766.tar.gz
chromium_src-83c7113a3eeb46aac0d338f8c6260d00331c3766.tar.bz2
Merge 54593 - 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 TBR=ananta@chromium.org Review URL: http://codereview.chromium.org/3038043 git-svn-id: svn://svn.chromium.org/chrome/branches/472/src@54599 0039d316-1c4b-4281-b951-d872f2087c98
-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 59a3bd4..f2725b0 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -346,6 +346,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);
@@ -380,21 +385,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 67a2323..eb74601 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -131,6 +131,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);