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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2436623004: [Fetch, Loader] Expect on-heap objects will never get destroyed with a reference (Closed)
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // always contains the result of evaluating a javascript: url. This is the 347 // always contains the result of evaluating a javascript: url. This is the
348 // <iframe src="javascript:'html'"> case. 348 // <iframe src="javascript:'html'"> case.
349 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL( 349 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(
350 const String& source, 350 const String& source,
351 Document* ownerDocument) { 351 Document* ownerDocument) {
352 if (!m_frame->document()->loader() || 352 if (!m_frame->document()->loader() ||
353 m_frame->document()->pageDismissalEventBeingDispatched() != 353 m_frame->document()->pageDismissalEventBeingDispatched() !=
354 Document::NoDismissal) 354 Document::NoDismissal)
355 return; 355 return;
356 356
357 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the
358 // DocumentLoader to get deref'ed and possible destroyed, so protect it with a
359 // RefPtr.
360 DocumentLoader* documentLoader(m_frame->document()->loader()); 357 DocumentLoader* documentLoader(m_frame->document()->loader());
361 358
362 UseCounter::count(*m_frame->document(), 359 UseCounter::count(*m_frame->document(),
363 UseCounter::ReplaceDocumentViaJavaScriptURL); 360 UseCounter::ReplaceDocumentViaJavaScriptURL);
364 361
365 // Prepare a DocumentInit before clearing the frame, because it may need to 362 // Prepare a DocumentInit before clearing the frame, because it may need to
366 // inherit an aliased security context. 363 // inherit an aliased security context.
367 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame); 364 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame);
368 init.withNewRegistrationContext(); 365 init.withNewRegistrationContext();
369 366
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 } 603 }
607 604
608 if (client()) { 605 if (client()) {
609 client()->runScriptsAtDocumentReady( 606 client()->runScriptsAtDocumentReady(
610 m_documentLoader ? m_documentLoader->isCommittedButEmpty() : true); 607 m_documentLoader ? m_documentLoader->isCommittedButEmpty() : true);
611 } 608 }
612 609
613 checkCompleted(); 610 checkCompleted();
614 611
615 if (!m_frame->view()) 612 if (!m_frame->view())
616 return; // We are being destroyed by something checkCompleted called. 613 return;
hiroshige 2016/10/21 05:45:14 If this |if| block remains, then should we leave s
yhirano 2016/10/26 11:09:34 I'm not 100% sure but it looks FrameLoaderClient::
617 614
618 // Check if the scrollbars are really needed for the content. If not, remove 615 // Check if the scrollbars are really needed for the content. If not, remove
619 // them, relayout, and repaint. 616 // them, relayout, and repaint.
620 m_frame->view()->restoreScrollbar(); 617 m_frame->view()->restoreScrollbar();
621 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); 618 processFragment(m_frame->document()->url(), NavigationToDifferentDocument);
622 } 619 }
623 620
624 static bool allDescendantsAreComplete(Frame* frame) { 621 static bool allDescendantsAreComplete(Frame* frame) {
625 for (Frame* child = frame->tree().firstChild(); child; 622 for (Frame* child = frame->tree().firstChild(); child;
626 child = child->tree().traverseNext(frame)) { 623 child = child->tree().traverseNext(frame)) {
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 m_documentLoader ? m_documentLoader->url() : String()); 1913 m_documentLoader ? m_documentLoader->url() : String());
1917 return tracedValue; 1914 return tracedValue;
1918 } 1915 }
1919 1916
1920 inline void FrameLoader::takeObjectSnapshot() const { 1917 inline void FrameLoader::takeObjectSnapshot() const {
1921 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1918 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1922 toTracedValue()); 1919 toTracedValue());
1923 } 1920 }
1924 1921
1925 } // namespace blink 1922 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698