Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc

Issue 2909753002: Tightening checks in ChromeContentBrowserClientExtensionsPart::CanCommitURL
Patch Set: Rebasing... Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
index 2c2d2fdb87e87dd07c5e90337cba8498d1f5e6a3..247f935a16248f3796a21a4a500e9fb61212c3e5 100644
--- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
+++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
@@ -373,11 +373,9 @@ bool ChromeContentBrowserClientExtensionsPart::CanCommitURL(
content::RenderProcessHost* process_host, const GURL& url) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- // We need to let most extension URLs commit in any process, since this can
- // be allowed due to web_accessible_resources. Most hosted app URLs may also
- // load in any process (e.g., in an iframe). However, the Chrome Web Store
- // cannot be loaded in iframes and should never be requested outside its
- // process.
+ // Hosted app URLs may load in any process (e.g., in an iframe). However, the
+ // Chrome Web Store, and other extensions should never be requested outside
+ // their process.
ExtensionRegistry* registry =
ExtensionRegistry::Get(process_host->GetBrowserContext());
if (!registry)
@@ -385,13 +383,16 @@ bool ChromeContentBrowserClientExtensionsPart::CanCommitURL(
const Extension* new_extension =
registry->enabled_extensions().GetExtensionOrAppByURL(url);
- if (new_extension && new_extension->is_hosted_app() &&
- new_extension->id() == kWebStoreAppId &&
- !ProcessMap::Get(process_host->GetBrowserContext())
- ->Contains(new_extension->id(), process_host->GetID())) {
- return false;
- }
- return true;
+ if (!new_extension)
+ return true;
+
+ if (new_extension->id() == kWebStoreAppId)
+ DCHECK(new_extension->is_hosted_app());
+ if (new_extension->is_hosted_app() && new_extension->id() != kWebStoreAppId)
+ return true;
+
+ return ProcessMap::Get(process_host->GetBrowserContext())
+ ->Contains(new_extension->id(), process_host->GetID());
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698