| Index: Source/web/WebFrameImpl.cpp
|
| diff --git a/Source/web/WebFrameImpl.cpp b/Source/web/WebFrameImpl.cpp
|
| index be589dae3eed0f3a89c53d7c6449aa18759db7c1..ae21e7b7c0833c10c2f79866e4467c198d27026b 100644
|
| --- a/Source/web/WebFrameImpl.cpp
|
| +++ b/Source/web/WebFrameImpl.cpp
|
| @@ -50,7 +50,7 @@
|
| // ref initially and it is removed when the FrameLoader is getting destroyed.
|
| //
|
| // WebFrames are created in two places, first in WebViewImpl when the root
|
| -// frame is created, and second in WebFrame::CreateChildFrame when sub-frames
|
| +// frame is created, and second in WebFrame::createChildFrame when sub-frames
|
| // are created. WebKit will hook up this object to the FrameLoader/Frame
|
| // and the refcount will be correct.
|
| //
|
| @@ -2080,6 +2080,11 @@ WebString WebFrameImpl::layerTreeAsText(bool showDebugInfo) const
|
|
|
| // WebFrameImpl public ---------------------------------------------------------
|
|
|
| +WebFrame* WebFrame::create(WebFrameClient* client)
|
| +{
|
| + return WebFrameImpl::create(client).leakRef();
|
| +}
|
| +
|
| PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client)
|
| {
|
| return adoptRef(new WebFrameImpl(client));
|
| @@ -2128,7 +2133,7 @@ void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page)
|
| RefPtr<Frame> mainFrame = Frame::create(page, 0, &m_frameLoaderClient);
|
| setWebCoreFrame(mainFrame.get());
|
|
|
| - // Add reference on behalf of FrameLoader. See comments in
|
| + // Add reference on behalf of FrameLoader. See comments in
|
| // WebFrameLoaderClient::frameLoaderDestroyed for more info.
|
| ref();
|
|
|
| @@ -2139,7 +2144,7 @@ void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page)
|
|
|
| PassRefPtr<Frame> WebFrameImpl::createChildFrame(const FrameLoadRequest& request, HTMLFrameOwnerElement* ownerElement)
|
| {
|
| - RefPtr<WebFrameImpl> webframe(adoptRef(new WebFrameImpl(m_client)));
|
| + RefPtr<WebFrameImpl> webframe(m_client ? adoptRef(static_cast<WebFrameImpl*>(m_client->didCreateFrame(request.frameName()))) : WebFrameImpl::create(0));
|
|
|
| // Add an extra ref on behalf of the Frame/FrameLoader, which references the
|
| // WebFrame via the FrameLoaderClient interface. See the comment at the top
|
| @@ -2163,8 +2168,11 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame(const FrameLoadRequest& request
|
| // return without loading URL.
|
| // (b:791612)
|
| childFrame->init(); // create an empty document
|
| - if (!childFrame->tree()->parent())
|
| + if (!childFrame->tree()->parent()) {
|
| + if (m_client)
|
| + m_client->frameDetached(webframe.get());
|
| return 0;
|
| + }
|
|
|
| HistoryItem* parentItem = frame()->loader()->history()->currentItem();
|
| HistoryItem* childItem = 0;
|
| @@ -2181,11 +2189,12 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame(const FrameLoadRequest& request
|
| // A synchronous navigation (about:blank) would have already processed
|
| // onload, so it is possible for the frame to have already been destroyed by
|
| // script in the page.
|
| - if (!childFrame->tree()->parent())
|
| + if (!childFrame->tree()->parent()) {
|
| + if (m_client)
|
| + m_client->frameDetached(webframe.get());
|
| return 0;
|
| + }
|
|
|
| - if (m_client)
|
| - m_client->didCreateFrame(this, webframe.get());
|
|
|
| return childFrame.release();
|
| }
|
|
|