Index: third_party/WebKit/Source/core/page/FrameTree.cpp |
diff --git a/third_party/WebKit/Source/core/page/FrameTree.cpp b/third_party/WebKit/Source/core/page/FrameTree.cpp |
index 827cbb629e79a1ef1051c50fd41c00950a8d6f15..4b6e9d17b45d0d3ea6719c58cd470ee2c0147b38 100644 |
--- a/third_party/WebKit/Source/core/page/FrameTree.cpp |
+++ b/third_party/WebKit/Source/core/page/FrameTree.cpp |
@@ -54,6 +54,20 @@ FrameTree::~FrameTree() |
void FrameTree::setName(const AtomicString& name) |
{ |
+ // Do not recalculate m_uniqueName if there is no real change of m_name. |
+ // This is not just a performance optimization - other code relies on the |
+ // assumption that unique name shouldn't change if the assigned name didn't |
+ // change (i.e. code in content::FrameTreeNode::SetFrameName). |
+ if (m_name == name) { |
+ // Assert that returning early below won't leave m_uniqueName in an |
+ // uninitialized state - it should only be null if m_name is also |
+ // null and only if it is for the main frame. |
+ // m_uniqueName.isNull() should imply m_name.isNull() && !parent(). |
+ // this FrameTree is for a main frame. |
+ DCHECK(!m_uniqueName.isNull() || (m_name.isNull() && !parent())); |
+ return; |
+ } |
+ |
m_name = name; |
// Remove our old frame name so it's not considered in calculateUniqueNameForChildFrame |