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

Unified Diff: content/browser/frame_host/frame_tree.cc

Issue 2191543003: Remove existing FrameNavigationEntry when new named frame is added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra pointer in test. Created 4 years, 5 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 | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index 300075f79e4e3835c6f63d65447355b5809c4c34..511454f4d1069275dedc0d193778593d0d395985 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -15,6 +15,8 @@
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "content/browser/frame_host/frame_tree_node.h"
+#include "content/browser/frame_host/navigation_controller_impl.h"
+#include "content/browser/frame_host/navigation_entry_impl.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/render_frame_host_factory.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
@@ -192,6 +194,15 @@ bool FrameTree::AddFrame(FrameTreeNode* parent,
frame_unique_name, frame_owner_properties)),
process_id, new_routing_id);
+ // The last committed NavigationEntry may have a FrameNavigationEntry with the
+ // same |frame_unique_name|, since we don't remove FrameNavigationEntries if
+ // their frames are deleted. If there is a stale one, remove it to avoid
+ // conflicts on future updates.
+ NavigationEntryImpl* last_committed_entry = static_cast<NavigationEntryImpl*>(
+ parent->navigator()->GetController()->GetLastCommittedEntry());
+ if (last_committed_entry)
+ last_committed_entry->ClearStaleFrameEntriesForNewFrame(added_node);
+
// Set sandbox flags and make them effective immediately, since initial
// sandbox flags should apply to the initial empty document in the frame.
added_node->SetPendingSandboxFlags(sandbox_flags);
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698