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

Unified Diff: content/browser/storage_partition_impl_map.cc

Issue 2458093003: Add DCHECKs to validate ProfileIOData's list of protocols.
Patch Set: Merge remote-tracking branch 'origin/master' into detect_unregistered_schemes Created 4 years, 1 month 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 | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl_map.cc
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc
index 0e85d8a6238f7fab568733139fc376d4fcbf04a0..1ab960991f634826904d5794ba38f669ddb10263 100644
--- a/content/browser/storage_partition_impl_map.cc
+++ b/content/browser/storage_partition_impl_map.cc
@@ -169,6 +169,14 @@ base::FilePath GetStoragePartitionDomainPath(
.Append(base::FilePath::FromUTF8Unsafe(partition_domain));
}
+#if DCHECK_IS_ON()
+bool IsBuiltInProtocol(const std::string& scheme) {
+ GURL scheme_as_gurl(scheme + url::kStandardSchemeSeparator);
+ DCHECK(scheme_as_gurl.is_valid()) << scheme;
+ return GetContentClient()->browser()->IsHandledURL(scheme_as_gurl);
+}
+#endif
+
// Helper function for doing a depth-first deletion of the data on disk.
// Examines paths directly in |current_dir| (no recursion) and tries to
// delete from disk anything that is in, or isn't a parent of something in
@@ -436,11 +444,19 @@ StoragePartitionImpl* StoragePartitionImplMap::Get(
browser_context_->IsOffTheRecord(),
blob_storage_context).release());
}
+
protocol_handlers[kChromeDevToolsScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
CreateDevToolsProtocolHandler(browser_context_->GetResourceContext(),
browser_context_->IsOffTheRecord()));
+#if DCHECK_IS_ON()
+ // The ContentBrowserClient's implementation of IsHandledURL must know about
+ // all protocols handled by the content layer.
+ for (const auto& handler : protocol_handlers)
+ DCHECK(IsBuiltInProtocol(handler.first)) << handler.first;
+#endif // DCHECK_IS_ON()
+
URLRequestInterceptorScopedVector request_interceptors;
request_interceptors.push_back(
ServiceWorkerRequestHandler::CreateInterceptor(
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698