Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
index cc03905c73cafe5decc8f1e2831f6f69c4a8cb25..4d067ea8fb58f6de94086aa021a284bf19947b02 100644 |
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp |
@@ -1763,10 +1763,14 @@ void WebLocalFrameImpl::setCoreFrame(PassRefPtrWillBeRawPtr<LocalFrame> frame) |
} |
} |
-void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName) |
+void WebLocalFrameImpl::initializeCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName, const AtomicString& uniqueName) |
{ |
setCoreFrame(LocalFrame::create(m_frameLoaderClientImpl.get(), host, owner)); |
- frame()->tree().setName(name, fallbackName); |
+ if (uniqueName.isEmpty()) { |
+ frame()->tree().setName(name, fallbackName); |
+ } else { |
+ frame()->tree().setNameForReplacementFrame(name, uniqueName); |
+ } |
// We must call init() after m_frame is assigned because it is referenced |
// during init(). Note that this may dispatch JS events; the frame may be |
// detached after init() returns. |
@@ -1782,7 +1786,9 @@ PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra |
? WebTreeScopeType::Document |
: WebTreeScopeType::Shadow; |
WebFrameOwnerProperties ownerProperties(ownerElement->scrollingMode(), ownerElement->marginWidth(), ownerElement->marginHeight()); |
- RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_client->createChildFrame(this, scope, name, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags()), ownerProperties)); |
+ AtomicString fallbackName = ownerElement->getAttribute(ownerElement->subResourceAttributeName()); |
+ AtomicString uniqueName = frame()->tree().calculateUniqueNameForNewChildFrame(name, fallbackName); |
+ RefPtrWillBeRawPtr<WebLocalFrameImpl> webframeChild = toWebLocalFrameImpl(m_client->createChildFrame(this, scope, name, uniqueName, static_cast<WebSandboxFlags>(ownerElement->sandboxFlags()), ownerProperties)); |
if (!webframeChild) |
return nullptr; |
@@ -1790,7 +1796,7 @@ PassRefPtrWillBeRawPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const Fra |
// solution. subResourceAttributeName returns just one attribute name. The |
// element might not have the attribute, and there might be other attributes |
// which can identify the element. |
- webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, ownerElement->getAttribute(ownerElement->subResourceAttributeName())); |
+ webframeChild->initializeCoreFrame(frame()->host(), ownerElement, name, fallbackName, uniqueName); |
// Initializing the core frame may cause the new child to be detached, since |
// it may dispatch a load event in the parent. |
if (!webframeChild->parent()) |