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

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

Issue 1290053003: Handle LocalFrame being nestedly detached by subframe. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: experiment: add another nested detach check Created 5 years, 4 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
« no previous file with comments | « LayoutTests/fast/frames/detach-frame-from-child-detach-no-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 void LocalFrame::detach(FrameDetachType type) 275 void LocalFrame::detach(FrameDetachType type)
276 { 276 {
277 PluginScriptForbiddenScope forbidPluginDestructorScripting; 277 PluginScriptForbiddenScope forbidPluginDestructorScripting;
278 // A lot of the following steps can result in the current frame being 278 // A lot of the following steps can result in the current frame being
279 // detached, so protect a reference to it. 279 // detached, so protect a reference to it.
280 RefPtrWillBeRawPtr<LocalFrame> protect(this); 280 RefPtrWillBeRawPtr<LocalFrame> protect(this);
281 m_loader.stopAllLoaders(); 281 m_loader.stopAllLoaders();
282 m_loader.dispatchUnloadEvent(); 282 m_loader.dispatchUnloadEvent();
283 detachChildren(); 283 detachChildren();
284
285 // All done if detaching the subframes brought about a detach of this frame also.
286 if (!client())
287 return;
288
284 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren() 289 // stopAllLoaders() needs to be called after detachChildren(), because detac hChildren()
285 // will trigger the unload event handlers of any child frames, and those eve nt 290 // will trigger the unload event handlers of any child frames, and those eve nt
286 // handlers might start a new subresource load in this frame. 291 // handlers might start a new subresource load in this frame.
287 m_loader.stopAllLoaders(); 292 m_loader.stopAllLoaders();
288 m_loader.detach(); 293 m_loader.detach();
289 document()->detach(); 294 document()->detach();
290 m_loader.clear(); 295 m_loader.clear();
291 if (!client()) 296 if (!client())
dcheng 2015/08/18 21:26:09 Out of curiosity, do we still need this check with
sof 2015/08/19 11:44:35 We do still need that one, added in that spot by i
292 return; 297 return;
293 298
294 client()->willBeDetached(); 299 client()->willBeDetached();
295 // Notify ScriptController that the frame is closing, since its cleanup ends up calling 300 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
296 // back to FrameLoaderClient via WindowProxy. 301 // back to FrameLoaderClient via WindowProxy.
297 script().clearForClose(); 302 script().clearForClose();
298 ScriptForbiddenScope forbidScript; 303 ScriptForbiddenScope forbidScript;
299 setView(nullptr); 304 setView(nullptr);
300 willDetachFrameHost(); 305 willDetachFrameHost();
301 InspectorInstrumentation::frameDetachedFromParent(this); 306 InspectorInstrumentation::frameDetachedFromParent(this);
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 { 849 {
845 if (isLocalRoot()) 850 if (isLocalRoot())
846 m_instrumentingAgents = InstrumentingAgents::create(); 851 m_instrumentingAgents = InstrumentingAgents::create();
847 else 852 else
848 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 853 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
849 } 854 }
850 855
851 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); 856 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame);
852 857
853 } // namespace blink 858 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/frames/detach-frame-from-child-detach-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698