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 a4816ad06203d02d9e3da21a00efa598bef03ea6..625d7d77079f5ff356c7e57c1ce9ddc7846495cf 100644 |
--- a/third_party/WebKit/Source/core/page/FrameTree.cpp |
+++ b/third_party/WebKit/Source/core/page/FrameTree.cpp |
@@ -58,12 +58,21 @@ void FrameTree::setName(const AtomicString& name, const AtomicString& fallbackNa |
m_uniqueName = name; |
return; |
} |
- m_uniqueName = AtomicString(); // Remove our old frame name so it's not considered in uniqueChildName. |
- m_uniqueName = parent()->tree().uniqueChildName(name.isEmpty() ? fallbackName : name); |
+ |
+ // Remove our old frame name so it's not considered in calculateUniqueNameForChildFrame. |
+ m_uniqueName = AtomicString(); |
+ |
+ m_uniqueName = parent()->tree().calculateUniqueNameForChildFrame(true, name, fallbackName); |
} |
-void FrameTree::setNameForReplacementFrame(const AtomicString& name, const AtomicString& uniqueName) |
+void FrameTree::setReplicatedName(const AtomicString& name, const AtomicString& uniqueName) |
{ |
+ if (!parent()) { |
+ ASSERT(uniqueName == name); |
+ } else { |
+ ASSERT(!uniqueName.isEmpty()); |
+ } |
+ |
m_name = name; |
m_uniqueName = uniqueName; |
} |
@@ -123,8 +132,20 @@ bool FrameTree::uniqueNameExists(const AtomicString& name) const |
return false; |
} |
-AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const |
+AtomicString FrameTree::calculateUniqueNameForNewChildFrame( |
+ const AtomicString& name, |
+ const AtomicString& fallbackName) const |
+{ |
+ return calculateUniqueNameForChildFrame(false, name, fallbackName); |
+} |
+ |
+AtomicString FrameTree::calculateUniqueNameForChildFrame( |
+ bool existingChildFrame, |
+ const AtomicString& originalRequestedName, |
+ const AtomicString& fallbackName) const |
{ |
+ const AtomicString& requestedName = |
+ originalRequestedName.isEmpty() ? fallbackName : originalRequestedName; |
if (!requestedName.isEmpty() && !uniqueNameExists(requestedName) && requestedName != "_blank") |
return requestedName; |
@@ -160,7 +181,7 @@ AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const |
} |
name.appendLiteral("/<!--frame"); |
- name.appendNumber(childCount() - 1); |
+ name.appendNumber(childCount() - (existingChildFrame ? 1 : 0)); |
dcheng
2016/02/16 22:17:29
Is it possible to pull the FrameTree changes into
Łukasz Anforowicz
2016/02/16 23:39:53
I think it is not possible.
1. I've added propaga
|
name.appendLiteral("-->-->"); |
return name.toAtomicString(); |