diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 19:55:14 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 19:55:14 +0000 |
commit | f0a13734e2dc6caa9b22fa71d1ed57ae1075b710 (patch) | |
tree | 90030f3297176d92a8e86a1ef74122005dbab256 /chrome/plugin/chrome_plugin_host.cc | |
parent | 6176549d936f3383e8b55234dac72d5137bf6e5e (diff) | |
download | chromium_src-f0a13734e2dc6caa9b22fa71d1ed57ae1075b710.zip chromium_src-f0a13734e2dc6caa9b22fa71d1ed57ae1075b710.tar.gz chromium_src-f0a13734e2dc6caa9b22fa71d1ed57ae1075b710.tar.bz2 |
Fix a potential race with cookie requests between renderer and gears.
BUG=1487502
Review URL: http://codereview.chromium.org/10960
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/chrome_plugin_host.cc')
-rw-r--r-- | chrome/plugin/chrome_plugin_host.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc index 9512c43..677404f 100644 --- a/chrome/plugin/chrome_plugin_host.cc +++ b/chrome/plugin/chrome_plugin_host.cc @@ -257,8 +257,24 @@ CPError STDCALL CPB_GetCookies(CPID id, CPBrowsingContext context, const char* url, char** cookies) { CHECK(ChromePluginLib::IsPluginThread()); std::string cookies_str; - PluginThread::GetPluginThread()->Send( - new PluginProcessHostMsg_GetCookies(context, GURL(url), &cookies_str)); + + WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(context); + // There are two contexts in which we can be asked for cookies: + // 1. From a script context. webplugin will be non-NULL. + // 2. From a global browser context (think: Gears UpdateTask). webplugin will + // be NULL and context will (loosely) represent a browser Profile. + // In case 1, we *must* route through the renderer process, otherwise we race + // with renderer script that may have set cookies. In case 2, we are running + // out-of-band with script, so we don't need to stay in sync with any + // particular renderer. + // See http://b/issue?id=1487502. + if (webplugin) { + cookies_str = webplugin->GetCookies(GURL(url), GURL(url)); + } else { + PluginThread::GetPluginThread()->Send( + new PluginProcessHostMsg_GetCookies(context, GURL(url), &cookies_str)); + } + *cookies = CPB_StringDup(CPB_Alloc, cookies_str); return CPERR_SUCCESS; } |