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

Unified Diff: third_party/WebKit/Source/web/OpenedFrameTracker.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, 2 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 | « third_party/WebKit/Source/web/OpenedFrameTracker.h ('k') | third_party/WebKit/Source/web/WebFrame.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/OpenedFrameTracker.cpp
diff --git a/third_party/WebKit/Source/web/OpenedFrameTracker.cpp b/third_party/WebKit/Source/web/OpenedFrameTracker.cpp
index bd0181391b5d3058672a7cb313c2cc45e90f8d1b..f64572675156cb5da46949e580aa2374fa885055 100644
--- a/third_party/WebKit/Source/web/OpenedFrameTracker.cpp
+++ b/third_party/WebKit/Source/web/OpenedFrameTracker.cpp
@@ -18,7 +18,7 @@ OpenedFrameTracker::~OpenedFrameTracker()
{
#if !ENABLE(OILPAN)
// Oilpan takes care of clearing weak m_opener fields during GC.
- updateOpener(0);
+ transferTo(nullptr);
#endif
}
@@ -37,11 +37,11 @@ void OpenedFrameTracker::remove(WebFrame* frame)
m_openedFrames.remove(frame);
}
-void OpenedFrameTracker::updateOpener(WebFrame* frame)
+void OpenedFrameTracker::transferTo(WebFrame* opener)
{
- HashSet<WebFrame*>::iterator end = m_openedFrames.end();
- for (HashSet<WebFrame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
- (*it)->m_opener = frame;
+ HashSet<WebFrame*> frames(m_openedFrames);
alexmos 2015/10/27 19:09:51 nit: is it worth adding a comment about why the co
dcheng 2015/10/27 19:11:16 Yeah, probably worth commenting. I'll add it and C
+ for (WebFrame* frame : frames)
+ frame->setOpener(opener);
}
template <typename VisitorDispatcher>
« no previous file with comments | « third_party/WebKit/Source/web/OpenedFrameTracker.h ('k') | third_party/WebKit/Source/web/WebFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698