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

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

Issue 1969723004: Add a counter and a deprecation message when navigating in an unload handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 4 years, 7 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 reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 float ratio = static_cast<float>(nodeCount) / totalNodeCount; 1080 float ratio = static_cast<float>(nodeCount) / totalNodeCount;
1081 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); 1081 ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio);
1082 } 1082 }
1083 1083
1084 // Don't allow any new child frames to load in this frame: attaching a new 1084 // Don't allow any new child frames to load in this frame: attaching a new
1085 // child frame during or after detaching children results in an attached 1085 // child frame during or after detaching children results in an attached
1086 // frame on a detached DOM tree, which is bad. 1086 // frame on a detached DOM tree, which is bad.
1087 SubframeLoadingDisabler disabler(m_frame->document()); 1087 SubframeLoadingDisabler disabler(m_frame->document());
1088 if (m_documentLoader) { 1088 if (m_documentLoader) {
1089 client()->dispatchWillClose(); 1089 client()->dispatchWillClose();
1090
1091 NavigationCounterForUnload counter;
Nate Chapin 2016/05/13 21:56:10 Is there any reason not to put this in dispatchUnl
lfg 2016/05/14 01:23:28 The only reason is because I didn't want to fire t
Nate Chapin 2016/05/16 21:00:31 Right, only same-document navigations can run and
lfg 2016/05/16 23:46:54 Ah, good point. Yes, we should count those cases a
1090 dispatchUnloadEvent(); 1092 dispatchUnloadEvent();
1091 } 1093 }
1092 m_frame->detachChildren(); 1094 m_frame->detachChildren();
1093 // The previous calls to dispatchUnloadEvent() and detachChildren() can 1095 // The previous calls to dispatchUnloadEvent() and detachChildren() can
1094 // execute arbitrary script via things like unload events. If the executed 1096 // execute arbitrary script via things like unload events. If the executed
1095 // script intiates a new load or causes the current frame to be detached, 1097 // script intiates a new load or causes the current frame to be detached,
1096 // we need to abandon the current load. 1098 // we need to abandon the current load.
1097 if (pdl != m_provisionalDocumentLoader) 1099 if (pdl != m_provisionalDocumentLoader)
1098 return false; 1100 return false;
1099 // detachFromFrame() will abort XHRs that haven't completed, which can 1101 // detachFromFrame() will abort XHRs that haven't completed, which can
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String()); 1566 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa der->url() : String());
1565 return tracedValue.release(); 1567 return tracedValue.release();
1566 } 1568 }
1567 1569
1568 inline void FrameLoader::takeObjectSnapshot() const 1570 inline void FrameLoader::takeObjectSnapshot() const
1569 { 1571 {
1570 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value()); 1572 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced Value());
1571 } 1573 }
1572 1574
1573 } // namespace blink 1575 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698