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 4dcf54140956a2165fbd03bba4f3a24a52f38584..dbfd66639cfae8f104893d299ba90e84815c4934 100644 |
--- a/content/browser/frame_host/frame_tree.cc |
+++ b/content/browser/frame_host/frame_tree.cc |
@@ -15,6 +15,7 @@ |
#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_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 +193,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->ClearMatchingFrameEntries(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); |