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

Side by Side Diff: Source/core/frame/LocalFrame.cpp

Issue 923363002: Gracefully handle nested frame detaches. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // A lot of the following steps can result in the current frame being 263 // A lot of the following steps can result in the current frame being
264 // detached, so protect a reference to it. 264 // detached, so protect a reference to it.
265 RefPtrWillBeRawPtr<LocalFrame> protect(this); 265 RefPtrWillBeRawPtr<LocalFrame> protect(this);
266 m_loader.stopAllLoaders(); 266 m_loader.stopAllLoaders();
267 m_loader.dispatchUnloadEvent(); 267 m_loader.dispatchUnloadEvent();
268 detachChildren(); 268 detachChildren();
269 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() 269 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren()
270 // will trigger the unload event handlers of any child frames, and those eve nt 270 // will trigger the unload event handlers of any child frames, and those eve nt
271 // handlers might start a new subresource load in this frame. 271 // handlers might start a new subresource load in this frame.
272 m_loader.stopAllLoaders(); 272 m_loader.stopAllLoaders();
273 m_loader.detach();
273 if (!client()) 274 if (!client())
274 return; 275 return;
275 276
276 m_loader.detach();
277 // Notify ScriptController that the frame is closing, since its cleanup ends up calling 277 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
278 // back to FrameLoaderClient via WindowProxy. 278 // back to FrameLoaderClient via WindowProxy.
279 script().clearForClose(); 279 script().clearForClose();
280 ScriptForbiddenScope forbidScript; 280 ScriptForbiddenScope forbidScript;
281 setView(nullptr); 281 setView(nullptr);
282 willDetachFrameHost(); 282 willDetachFrameHost();
283 InspectorInstrumentation::frameDetachedFromParent(this); 283 InspectorInstrumentation::frameDetachedFromParent(this);
284 Frame::detach(); 284 Frame::detach();
285 // Clear the FrameLoader right here rather than during 285 // Clear the FrameLoader right here rather than during
286 // finalization. Too late to access various heap objects at that 286 // finalization. Too late to access various heap objects at that
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // We detach the FrameView's custom scroll bars as early as 836 // We detach the FrameView's custom scroll bars as early as
837 // possible to prevent m_doc->detach() from messing with the view 837 // possible to prevent m_doc->detach() from messing with the view
838 // such that its scroll bars won't be torn down. 838 // such that its scroll bars won't be torn down.
839 // 839 //
840 // FIXME: We should revisit this. 840 // FIXME: We should revisit this.
841 if (m_view) 841 if (m_view)
842 m_view->prepareForDetach(); 842 m_view->prepareForDetach();
843 } 843 }
844 844
845 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/frames/resources/detach-frame-nested-subframe.html ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698