Make storage partition ID requests go through SiteInstanceImpl
This change routes all requests for storage partition IDs through
SiteInstanceImpl so that it can ensure consistent values before and
after the SiteInfo is set. A check was also added to trigger a crash
if the SiteInfo is ever set to something that would cause the computed
partition ID to change after an ID has already been returned to a
previous caller. This change helps prevent this type of error from going
undetected.
Change-Id: I552c3da011fa9e0bf37a5101d330e5aff47f07b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2724812
Commit-Queue: Aaron Colwell <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#859129}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index afe910b..7cd8a4d7 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2497,8 +2497,8 @@
if (instance) {
// TODO(ajwong): When GetDefaultSessionStorageNamespace() goes away, remove
// this if statement so |instance| must not be null.
- partition_id = GetContentClient()->browser()->GetStoragePartitionIdForSite(
- browser_context_, instance->GetSiteURL());
+ partition_id =
+ static_cast<SiteInstanceImpl*>(instance)->GetStoragePartitionId();
}
// TODO(ajwong): Should this use the |partition_id| directly rather than