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

Unified Diff: Source/web/WebFrame.cpp

Issue 1177333002: Revert of Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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/RemoteFrameClientImpl.cpp ('k') | Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebFrame.cpp
diff --git a/Source/web/WebFrame.cpp b/Source/web/WebFrame.cpp
index 8bea271892dbd369fdb1b4bc8e2cf73815ff9ce1..b7504104a33a316fa96046dccffa5a74da7d4b35 100644
--- a/Source/web/WebFrame.cpp
+++ b/Source/web/WebFrame.cpp
@@ -39,26 +39,16 @@
{
using std::swap;
RefPtrWillBeRawPtr<Frame> oldFrame = toCoreFrame(this);
-#if !ENABLE(OILPAN)
- RefPtrWillBeRawPtr<WebLocalFrameImpl> protectWebLocalFrame = isWebLocalFrame() ? toWebLocalFrameImpl(this) : nullptr;
- RefPtrWillBeRawPtr<WebRemoteFrameImpl> protectWebRemoteFrame = isWebRemoteFrame() ? toWebRemoteFrameImpl(this) : nullptr;
-#endif
-
- // If the frame has been detached during detaching by any JS code, we should
- // cancel the swap.
+
+ // All child frames must be detached first.
+ oldFrame->detachChildren();
+
+ // If the frame has been detached during detaching its children, return
+ // immediately.
// FIXME: There is no unit test for this condition, so one needs to be
// written.
- if (!oldFrame->prepareForCommit())
+ if (!oldFrame->host())
return false;
-
- FrameOwner* owner = oldFrame->owner();
- FrameHost* host = oldFrame->host();
-
- // Frame::detach will call clearForClose(), we need to call
- // clearForNavigate() before detaching.
- oldFrame->prepareSwapFrom(oldFrame.get());
-
- oldFrame->detach(FrameDetachType::Swap);
if (m_parent) {
if (m_parent->m_firstChild == this)
@@ -96,6 +86,8 @@
// the type of the passed in WebFrame.
// FIXME: This is a bit clunky; this results in pointless decrements and
// increments of connected subframes.
+ FrameOwner* owner = oldFrame->owner();
+ oldFrame->disconnectOwnerElement();
if (frame->isWebLocalFrame()) {
LocalFrame& localFrame = *toWebLocalFrameImpl(frame)->frame();
ASSERT(owner == localFrame.owner());
@@ -111,7 +103,7 @@
localFrame.page()->setMainFrame(&localFrame);
}
} else {
- toWebRemoteFrameImpl(frame)->initializeCoreFrame(host, owner, oldFrame->tree().name());
+ toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name());
}
toCoreFrame(frame)->finishSwapFrom(oldFrame.get());
@@ -120,7 +112,7 @@
void WebFrame::detach()
{
- toCoreFrame(this)->detach(FrameDetachType::Remove);
+ toCoreFrame(this)->detach();
}
WebSecurityOrigin WebFrame::securityOrigin() const
« no previous file with comments | « Source/web/RemoteFrameClientImpl.cpp ('k') | Source/web/tests/FrameTestHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698