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

Unified Diff: Source/web/WebFrame.cpp

Issue 544443002: Detach all subframes before swapping a frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Put a real document in subframe. Created 6 years, 3 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 | « no previous file | Source/web/tests/WebFrameTest.cpp » ('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 b6832d30b735811ea7c4940a581f6364b0182073..ec68cbbddb21025e059e7f4cc9ef50e38fd06c05 100644
--- a/Source/web/WebFrame.cpp
+++ b/Source/web/WebFrame.cpp
@@ -29,8 +29,11 @@ void WebFrame::swap(WebFrame* frame)
{
using std::swap;
- // All child frames must have been detached first.
- ASSERT(!m_firstChild && !m_lastChild);
+ Frame* oldFrame = toCoreFrame(this);
+
+ // All child frames must be detached first.
+ oldFrame->detachChildren();
kenrb 2014/09/04 19:04:50 I haven't spent time thinking about the right sequ
dcheng 2014/09/04 19:18:11 Ken makes some good points. This reminds me of why
nasko 2014/09/04 23:46:28 I've implemented an idea based on our discussion.
+
// The frame being swapped in should not have a Frame associated
// with it yet.
ASSERT(!toCoreFrame(frame));
@@ -66,7 +69,6 @@ void WebFrame::swap(WebFrame* frame)
// the type of the passed in WebFrame.
// FIXME: This is a bit clunky; this results in pointless decrements and
// increments of connected subframes.
- Frame* oldFrame = toCoreFrame(this);
FrameOwner* owner = oldFrame->owner();
oldFrame->disconnectOwnerElement();
if (frame->isWebLocalFrame()) {
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698