Fix wrong policy container inheritance from history
This fixes a wrong behaviour introduced when implementing storing and
reloading the policy container in history
(https://crrev.com/c/2485058). For some reason, we were wrongly
copying the policies of the last FrameNavigationEntry when navigating
a remote frame which is not a main frame. This change fixes that and
adds a regression test.
Bug: 1130587
Change-Id: I9918496573e2e44ef7a943ceb661f77ccbf5818d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2698114
Commit-Queue: Antonio Sartori <[email protected]>
Reviewed-by: Arthur Sonzogni <[email protected]>
Cr-Commit-Position: refs/heads/master@{#855227}
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc
index a15e1d3..b1c3510 100644
--- a/content/browser/renderer_host/navigation_controller_impl.cc
+++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2369,23 +2369,13 @@
// CreateNavigationEntry() may have changed the transition type.
page_transition = entry->GetTransitionType();
}
- std::unique_ptr<PolicyContainerPolicies> policies;
- if (GetLastCommittedEntry()) {
- FrameNavigationEntry* previous_frame_entry =
- GetLastCommittedEntry()->GetFrameEntry(node);
- if (previous_frame_entry &&
- previous_frame_entry->policy_container_policies()) {
- policies = std::make_unique<PolicyContainerPolicies>(
- *previous_frame_entry->policy_container_policies());
- }
- }
entry->AddOrUpdateFrameEntry(
node, -1, -1, nullptr,
static_cast<SiteInstanceImpl*>(source_site_instance), url,
base::nullopt /* commit_origin */, referrer, initiator_origin,
std::vector<GURL>(), blink::PageState(), method, -1,
blob_url_loader_factory, nullptr /* web_bundle_navigation_info */,
- std::move(policies));
+ nullptr /* policy_container_policies */);
} else {
// Main frame case.
entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry(