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

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

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: Inject document_idle scripts before window.onload Created 3 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) 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // Only send didStopLoading() if there are no navigations in progress at all, 709 // Only send didStopLoading() if there are no navigations in progress at all,
710 // whether committed, provisional, or pending. 710 // whether committed, provisional, or pending.
711 return frame->loader().documentLoader()->sentDidFinishLoad() && 711 return frame->loader().documentLoader()->sentDidFinishLoad() &&
712 !frame->loader().hasProvisionalNavigation(); 712 !frame->loader().hasProvisionalNavigation();
713 } 713 }
714 714
715 void FrameLoader::checkCompleted() { 715 void FrameLoader::checkCompleted() {
716 if (!shouldComplete(m_frame->document())) 716 if (!shouldComplete(m_frame->document()))
717 return; 717 return;
718 718
719 if (client()) {
720 client()->runScriptsAtDocumentIdle();
721
722 // Check again, because runScriptsAtDocumentIdle() may have delayed the load
723 // event.
724 if (!shouldComplete(m_frame->document()))
Devlin 2017/02/21 18:56:26 m_frame may be deleted at this point.
Kunihiko Sakamoto 2017/02/23 09:49:01 Check added.
725 return;
726 }
727
719 // OK, completed. 728 // OK, completed.
720 m_frame->document()->setReadyState(Document::Complete); 729 m_frame->document()->setReadyState(Document::Complete);
721 if (m_frame->document()->loadEventStillNeeded()) 730 if (m_frame->document()->loadEventStillNeeded())
722 m_frame->document()->implicitClose(); 731 m_frame->document()->implicitClose();
723 732
724 m_frame->navigationScheduler().startTimer(); 733 m_frame->navigationScheduler().startTimer();
725 734
726 if (m_frame->view()) 735 if (m_frame->view())
727 m_frame->view()->handleLoadCompleted(); 736 m_frame->view()->handleLoadCompleted();
728 737
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 frameLoadRequest.clientRedirect()); 2019 frameLoadRequest.clientRedirect());
2011 2020
2012 loader->setLoadType(loadType); 2021 loader->setLoadType(loadType);
2013 loader->setNavigationType(navigationType); 2022 loader->setNavigationType(navigationType);
2014 loader->setReplacesCurrentHistoryItem(loadType == 2023 loader->setReplacesCurrentHistoryItem(loadType ==
2015 FrameLoadTypeReplaceCurrentItem); 2024 FrameLoadTypeReplaceCurrentItem);
2016 return loader; 2025 return loader;
2017 } 2026 }
2018 2027
2019 } // namespace blink 2028 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698