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

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: Rebase to fix conflict 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 300075f79e4e3835c6f63d65447355b5809c4c34..171f2a41547e7664f6fa914ec6a88af464101791 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->ClearMatchingFrameEntries(added_node);
Charlie Reis 2016/07/29 17:21:35 Maybe the name can be clearer about the fact that
nasko 2016/08/01 20:42:16 Done.
+
// 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);

Powered by Google App Engine
This is Rietveld 408576698