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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 346403002: Initialize WebCore::Frame when swapping frames. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests, less leaks Created 6 years, 6 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
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 31ade06d839a1800cdfe97b5499330af91b81a3c..a4b57fb682a6b74705c89a2da22def41ba029ee5 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -1551,13 +1551,16 @@ void WebLocalFrameImpl::setWebCoreFrame(PassRefPtr<WebCore::LocalFrame> frame)
}
}
-void WebLocalFrameImpl::initializeAsMainFrame(WebCore::Page* page)
+PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeWebCoreFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName)
{
- setWebCoreFrame(LocalFrame::create(&m_frameLoaderClientImpl, &page->frameHost(), 0));
-
+ RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host, owner);
+ setWebCoreFrame(frame);
+ frame->tree().setName(name, fallbackName);
// We must call init() after m_frame is assigned because it is referenced
- // during init().
- m_frame->init();
+ // during init(). Note that this may dispatch JS events; the frame may be
+ // detached after init() returns.
+ frame->init();
+ return frame;
}
PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadRequest& request, HTMLFrameOwnerElement* ownerElement)
@@ -1571,7 +1574,7 @@ PassRefPtr<LocalFrame> WebLocalFrameImpl::createChildFrame(const FrameLoadReques
// 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.
- RefPtr<LocalFrame> child = webframeChild->initializeAsChildFrame(frame()->host(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement->subResourceAttributeName()));
+ RefPtr<LocalFrame> child = webframeChild->initializeWebCoreFrame(frame()->host(), ownerElement, request.frameName(), ownerElement->getAttribute(ownerElement->subResourceAttributeName()));
// Initializing the WebCore frame may cause the new child to be detached, since it may dispatch a load event in the parent.
if (!child->tree().parent())
return nullptr;
@@ -1854,14 +1857,4 @@ void WebLocalFrameImpl::invalidateAll() const
invalidateScrollbar();
}
-PassRefPtr<LocalFrame> WebLocalFrameImpl::initializeAsChildFrame(FrameHost* host, FrameOwner* owner, const AtomicString& name, const AtomicString& fallbackName)
-{
- RefPtr<LocalFrame> frame = LocalFrame::create(&m_frameLoaderClientImpl, host, owner);
- setWebCoreFrame(frame);
- frame->tree().setName(name, fallbackName);
- // May dispatch JS events; frame may be detached after this.
- frame->init();
- return frame;
-}
-
} // namespace blink
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698