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

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

Issue 2393133005: Call LocalDOMWindow::clearDocument when a frame gets detached
Patch Set: temp Created 4 years 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 | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('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 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
9 * rights reserved. 9 * rights reserved.
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 // DCHECK(!m_isDetaching) here. 391 // DCHECK(!m_isDetaching) here.
392 m_isDetaching = true; 392 m_isDetaching = true;
393 393
394 PluginScriptForbiddenScope forbidPluginDestructorScripting; 394 PluginScriptForbiddenScope forbidPluginDestructorScripting;
395 m_loader.stopAllLoaders(); 395 m_loader.stopAllLoaders();
396 // Don't allow any new child frames to load in this frame: attaching a new 396 // Don't allow any new child frames to load in this frame: attaching a new
397 // child frame during or after detaching children results in an attached 397 // child frame during or after detaching children results in an attached
398 // frame on a detached DOM tree, which is bad. 398 // frame on a detached DOM tree, which is bad.
399 SubframeLoadingDisabler disabler(*document()); 399 SubframeLoadingDisabler disabler(*document());
400 m_loader.dispatchUnloadEvent(); 400 m_loader.dispatchUnloadEvent();
401 if (!client())
402 return;
401 detachChildren(); 403 detachChildren();
402 404
403 // All done if detaching the subframes brought about a detach of this frame 405 // All done if detaching the subframes brought about a detach of this frame
404 // also. 406 // also.
405 if (!client()) 407 if (!client())
406 return; 408 return;
407 409
408 // stopAllLoaders() needs to be called after detachChildren(), because 410 // stopAllLoaders() needs to be called after detachChildren(), because
409 // detachChildren() will trigger the unload event handlers of any child 411 // detachChildren() will trigger the unload event handlers of any child
410 // frames, and those event handlers might start a new subresource load in this 412 // frames, and those event handlers might start a new subresource load in this
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 return m_script->getWindowProxyManager(); 480 return m_script->getWindowProxyManager();
479 } 481 }
480 482
481 bool LocalFrame::shouldClose() { 483 bool LocalFrame::shouldClose() {
482 // TODO(dcheng): This should be fixed to dispatch beforeunload events to 484 // TODO(dcheng): This should be fixed to dispatch beforeunload events to
483 // both local and remote frames. 485 // both local and remote frames.
484 return m_loader.shouldClose(); 486 return m_loader.shouldClose();
485 } 487 }
486 488
487 void LocalFrame::detachChildren() { 489 void LocalFrame::detachChildren() {
488 DCHECK(m_loader.stateMachine()->creatingInitialEmptyDocument() || document()); 490 CHECK(m_loader.stateMachine()->creatingInitialEmptyDocument() || document());
489 491
490 if (Document* document = this->document()) 492 if (Document* document = this->document())
491 ChildFrameDisconnector(*document).disconnect(); 493 ChildFrameDisconnector(*document).disconnect();
492 } 494 }
493 495
494 void LocalFrame::documentAttached() { 496 void LocalFrame::documentAttached() {
495 DCHECK(document()); 497 DCHECK(document());
496 selection().documentAttached(document()); 498 selection().documentAttached(document());
497 inputMethodController().documentAttached(document()); 499 inputMethodController().documentAttached(document());
498 } 500 }
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 928 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
927 m_frame->client()->frameBlameContext()->Enter(); 929 m_frame->client()->frameBlameContext()->Enter();
928 } 930 }
929 931
930 ScopedFrameBlamer::~ScopedFrameBlamer() { 932 ScopedFrameBlamer::~ScopedFrameBlamer() {
931 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 933 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
932 m_frame->client()->frameBlameContext()->Leave(); 934 m_frame->client()->frameBlameContext()->Leave();
933 } 935 }
934 936
935 } // namespace blink 937 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698