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

Unified Diff: chrome/browser/net/chrome_extensions_network_delegate.cc

Issue 2552453002: Stop initializing url::Origin in extensions OnBeforeURLRequest when not needed (Closed)
Patch Set: Created 4 years 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/net/chrome_extensions_network_delegate.cc
diff --git a/chrome/browser/net/chrome_extensions_network_delegate.cc b/chrome/browser/net/chrome_extensions_network_delegate.cc
index 86161ddd9ee9c5b4466d1aa6b27ea11736962ac7..b7fcb658624bd3c1ae79946a29c79a6b5132e923 100644
--- a/chrome/browser/net/chrome_extensions_network_delegate.cc
+++ b/chrome/browser/net/chrome_extensions_network_delegate.cc
@@ -173,7 +173,7 @@ int ChromeExtensionsNetworkDelegateImpl::OnBeforeURLRequest(
GURL* new_url) {
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request);
- GURL url(request->url());
+ const GURL& url(request->url());
Randy Smith (Not in Mondays) 2016/12/02 22:03:55 nit, suggestion: This is just syntactic sugar that
Charlie Harrison 2016/12/02 22:12:58 Eh I prefer not, 4 uses of request->url() gets kin
// Block top-level navigations to blob: or filesystem: URLs with extension
// origin from non-extension processes. See https://crbug.com/645028.
@@ -188,11 +188,11 @@ int ChromeExtensionsNetworkDelegateImpl::OnBeforeURLRequest(
bool is_nested_url = url.SchemeIsFileSystem() || url.SchemeIsBlob();
bool is_navigation =
info && content::IsResourceTypeFrame(info->GetResourceType());
- url::Origin origin(url);
if (is_nested_url && is_navigation && info->IsMainFrame() &&
- origin.scheme() == extensions::kExtensionScheme &&
+ url.SchemeIs(extensions::kExtensionScheme) &&
!extension_info_map_->process_map().Contains(info->GetChildID()) &&
!content::IsBrowserSideNavigationEnabled()) {
+ url::Origin origin(url);
// Relax this restriction for apps that use <webview>. See
// https://crbug.com/652077.
const extensions::Extension* extension =
« 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