Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index c755dc03e2f75c23cfe5d7160613152a8f52ea71..796761483ff45673358afe90463c8e8fd6bce0e0 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -491,6 +491,9 @@ std::string ChromeContentBrowserClient::GetStoragePartitionIdForChildProcess( |
std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( |
content::BrowserContext* browser_context, |
const GURL& site) { |
+ if (site.SchemeIs(chrome::kGuestScheme)) |
Nico
2012/10/31 01:26:05
"guest" means "a process embedded in another proce
|
+ return "guest-" + site.host(); |
+ |
const Extension* extension = NULL; |
Profile* profile = Profile::FromBrowserContext(browser_context); |
ExtensionService* extension_service = |
@@ -1604,10 +1607,16 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs( |
chrome::ViewType view_type = chrome::GetViewType(web_contents); |
ExtensionService* service = profile->GetExtensionService(); |
if (service) { |
- const Extension* extension = service->extensions()->GetByID( |
- rvh->GetSiteInstance()->GetSiteURL().host()); |
- extension_webkit_preferences::SetPreferences( |
- extension, view_type, web_prefs); |
+ const GURL& url = rvh->GetSiteInstance()->GetSiteURL(); |
+ // Ensure that we are only granting extension preferences to URLs with the |
+ // correct scheme. Without this check, guest:// schemes used by webview |
+ // tags as well as hosts that happen to match the id of an install extension |
+ // would get the wrong preferences. |
+ if (url.SchemeIs(chrome::kExtensionScheme)) { |
+ const Extension* extension = service->extensions()->GetByID(url.host()); |
+ extension_webkit_preferences::SetPreferences( |
+ extension, view_type, web_prefs); |
+ } |
} |
if (content::IsForceCompositingModeEnabled()) |