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

Side by Side Diff: third_party/WebKit/Source/web/WebFrame.cpp

Issue 1408073006: Gracefully handle a self-referential opener in frame swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove friend declaration. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "public/web/WebFrame.h" 6 #include "public/web/WebFrame.h"
7 7
8 #include "bindings/core/v8/WindowProxyManager.h" 8 #include "bindings/core/v8/WindowProxyManager.h"
9 #include "core/frame/FrameHost.h" 9 #include "core/frame/FrameHost.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (m_previousSibling) { 67 if (m_previousSibling) {
68 m_previousSibling->m_nextSibling = frame; 68 m_previousSibling->m_nextSibling = frame;
69 swap(m_previousSibling, frame->m_previousSibling); 69 swap(m_previousSibling, frame->m_previousSibling);
70 } 70 }
71 if (m_nextSibling) { 71 if (m_nextSibling) {
72 m_nextSibling->m_previousSibling = frame; 72 m_nextSibling->m_previousSibling = frame;
73 swap(m_nextSibling, frame->m_nextSibling); 73 swap(m_nextSibling, frame->m_nextSibling);
74 } 74 }
75 75
76 if (m_opener) { 76 if (m_opener) {
77 m_opener->m_openedFrameTracker->remove(this); 77 frame->setOpener(m_opener);
78 m_opener->m_openedFrameTracker->add(frame); 78 setOpener(nullptr);
79 swap(m_opener, frame->m_opener);
80 } 79 }
81 if (!m_openedFrameTracker->isEmpty()) { 80 m_openedFrameTracker->transferTo(frame);
82 m_openedFrameTracker->updateOpener(frame);
83 frame->m_openedFrameTracker.reset(m_openedFrameTracker.release());
84 }
85 81
86 FrameHost* host = oldFrame->host(); 82 FrameHost* host = oldFrame->host();
87 AtomicString name = oldFrame->tree().name(); 83 AtomicString name = oldFrame->tree().name();
88 FrameOwner* owner = oldFrame->owner(); 84 FrameOwner* owner = oldFrame->owner();
89 oldFrame->disconnectOwnerElement(); 85 oldFrame->disconnectOwnerElement();
90 86
91 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); 87 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
92 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals; 88 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>> globals;
93 oldFrame->windowProxyManager()->clearForNavigation(); 89 oldFrame->windowProxyManager()->clearForNavigation();
94 oldFrame->windowProxyManager()->releaseGlobals(globals); 90 oldFrame->windowProxyManager()->releaseGlobals(globals);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \ 355 void WebFrame::traceFrames(VisitorDispatcher visitor, WebFrame* frame) { tra ceFramesImpl(visitor, frame); } \
360 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); } 356 void WebFrame::clearWeakFrames(VisitorDispatcher visitor) { clearWeakFramesI mpl(visitor); }
361 357
362 DEFINE_VISITOR_METHOD(Visitor*) 358 DEFINE_VISITOR_METHOD(Visitor*)
363 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor) 359 DEFINE_VISITOR_METHOD(InlinedGlobalMarkingVisitor)
364 360
365 #undef DEFINE_VISITOR_METHOD 361 #undef DEFINE_VISITOR_METHOD
366 #endif 362 #endif
367 363
368 } // namespace blink 364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698