OLD | NEW |
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 void LocalFrame::detach(FrameDetachType type) | 316 void LocalFrame::detach(FrameDetachType type) |
317 { | 317 { |
318 PluginScriptForbiddenScope forbidPluginDestructorScripting; | 318 PluginScriptForbiddenScope forbidPluginDestructorScripting; |
319 // A lot of the following steps can result in the current frame being | 319 // A lot of the following steps can result in the current frame being |
320 // detached, so protect a reference to it. | 320 // detached, so protect a reference to it. |
321 RefPtrWillBeRawPtr<LocalFrame> protect(this); | 321 RefPtrWillBeRawPtr<LocalFrame> protect(this); |
322 m_loader.stopAllLoaders(); | 322 m_loader.stopAllLoaders(); |
| 323 // Don't allow any new child frames to load in this frame: attaching a new |
| 324 // child frame during or after detaching children results in an attached |
| 325 // frame on a detached DOM tree, which is bad. |
| 326 SubframeLoadingDisabler disabler(*document()); |
323 m_loader.dispatchUnloadEvent(); | 327 m_loader.dispatchUnloadEvent(); |
324 detachChildren(); | 328 detachChildren(); |
325 m_frameScheduler.clear(); | 329 m_frameScheduler.clear(); |
326 | 330 |
327 // All done if detaching the subframes brought about a detach of this frame
also. | 331 // All done if detaching the subframes brought about a detach of this frame
also. |
328 if (!client()) | 332 if (!client()) |
329 return; | 333 return; |
330 | 334 |
331 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() | 335 // stopAllLoaders() needs to be called after detachChildren(), because detac
hChildren() |
332 // will trigger the unload event handlers of any child frames, and those eve
nt | 336 // will trigger the unload event handlers of any child frames, and those eve
nt |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 { | 910 { |
907 m_frame->disableNavigation(); | 911 m_frame->disableNavigation(); |
908 } | 912 } |
909 | 913 |
910 FrameNavigationDisabler::~FrameNavigationDisabler() | 914 FrameNavigationDisabler::~FrameNavigationDisabler() |
911 { | 915 { |
912 m_frame->enableNavigation(); | 916 m_frame->enableNavigation(); |
913 } | 917 } |
914 | 918 |
915 } // namespace blink | 919 } // namespace blink |
OLD | NEW |