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

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: 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
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..9e054eb70ab0376f86d59d63f10b725e54488803 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"
Charlie Reis 2016/07/27 22:48:27 I suppose we should include NavigationController a
nasko 2016/07/29 15:52:19 Acknowledged.
#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"
@@ -184,6 +185,14 @@ bool FrameTree::AddFrame(FrameTreeNode* parent,
if (parent->current_frame_host()->GetProcess()->GetID() != process_id)
return false;
+ // If the last committed NavigationEntry has FrameNavigationEntry with the
+ // same |frame_unique_name|, it has to be removed to avoid conflicts with
+ // future updates.
Charlie Reis 2016/07/27 22:48:27 Let's clarify a bit how this is an expected case:
nasko 2016/07/29 15:52:19 Done.
+ NavigationEntryImpl* last_committed_entry = static_cast<NavigationEntryImpl*>(
+ root_->navigator()->GetController()->GetLastCommittedEntry());
Charlie Reis 2016/07/27 22:48:27 This should be parent->navigator() to be consisten
nasko 2016/07/29 15:52:19 Done.
+ if (last_committed_entry)
+ last_committed_entry->ClearNamedFrameEntries(frame_unique_name);
+
// AddChild is what creates the RenderFrameHost.
FrameTreeNode* added_node = parent->AddChild(
base::WrapUnique(new FrameTreeNode(

Powered by Google App Engine
This is Rietveld 408576698