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

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

Issue 1058403002: Revert of Refactor frame navigation/detach state cleanup to be more sane. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/testing/DummyPageHolder.cpp » ('j') | 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) 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void FrameLoader::clear() 235 void FrameLoader::clear()
236 { 236 {
237 // clear() is called during (Local)Frame detachment or when 237 // clear() is called during (Local)Frame detachment or when
238 // reusing a FrameLoader by putting a new Document within it 238 // reusing a FrameLoader by putting a new Document within it
239 // (DocumentLoader::ensureWriter().) 239 // (DocumentLoader::ensureWriter().)
240 if (m_stateMachine.creatingInitialEmptyDocument()) 240 if (m_stateMachine.creatingInitialEmptyDocument())
241 return; 241 return;
242 242
243 m_frame->editor().clear(); 243 m_frame->editor().clear();
244 m_frame->document()->cancelParsing(); 244 m_frame->document()->cancelParsing();
245 m_frame->document()->prepareForDestruction();
245 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document()); 246 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document());
246 m_frame->selection().prepareForDestruction(); 247 m_frame->selection().prepareForDestruction();
247 m_frame->eventHandler().clear(); 248 m_frame->eventHandler().clear();
248 if (m_frame->view()) 249 if (m_frame->view())
249 m_frame->view()->clear(); 250 m_frame->view()->clear();
250 251
251 m_frame->script().enableEval(); 252 m_frame->script().enableEval();
252 253
253 m_frame->navigationScheduler().cancel(); 254 m_frame->navigationScheduler().cancel();
254 255
(...skipping 16 matching lines...) Expand all
271 RefPtr<DocumentLoader> documentLoader(m_frame->document()->loader()); 272 RefPtr<DocumentLoader> documentLoader(m_frame->document()->loader());
272 273
273 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); 274 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL);
274 275
275 // Prepare a DocumentInit before clearing the frame, because it may need to 276 // Prepare a DocumentInit before clearing the frame, because it may need to
276 // inherit an aliased security context. 277 // inherit an aliased security context.
277 DocumentInit init(m_frame->document()->url(), m_frame); 278 DocumentInit init(m_frame->document()->url(), m_frame);
278 init.withNewRegistrationContext(); 279 init.withNewRegistrationContext();
279 280
280 stopAllLoaders(); 281 stopAllLoaders();
281 m_frame->detachChildren();
282 m_frame->document()->prepareForDestruction();
283 clear(); 282 clear();
284 283
285 // detachChildren() potentially detaches the frame from the document. The 284 // clear() potentially detaches the frame from the document. The
286 // loading cannot continue in that case. 285 // loading cannot continue in that case.
287 if (!m_frame->page()) 286 if (!m_frame->page())
288 return; 287 return;
289 288
290 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own erDocument); 289 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own erDocument);
291 } 290 }
292 291
293 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, bool isPushOrReplaceState, PassRefPtr<SerializedScriptValue> stateObject) 292 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, bool isPushOrReplaceState, PassRefPtr<SerializedScriptValue> stateObject)
294 { 293 {
295 if (m_provisionalItem) 294 if (m_provisionalItem)
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 } 957 }
959 958
960 // The call to dispatchUnloadEvent() can execute arbitrary JavaScript. 959 // The call to dispatchUnloadEvent() can execute arbitrary JavaScript.
961 // If the script initiates a new load, we need to abandon the current load, 960 // If the script initiates a new load, we need to abandon the current load,
962 // or the two will stomp each other. 961 // or the two will stomp each other.
963 // detachChildren will similarly trigger child frame unload event handlers. 962 // detachChildren will similarly trigger child frame unload event handlers.
964 if (m_documentLoader) { 963 if (m_documentLoader) {
965 client()->dispatchWillClose(); 964 client()->dispatchWillClose();
966 dispatchUnloadEvent(); 965 dispatchUnloadEvent();
967 } 966 }
967 m_frame->detachChildren();
968 if (pdl != m_provisionalDocumentLoader) 968 if (pdl != m_provisionalDocumentLoader)
969 return; 969 return;
970 if (m_documentLoader) 970 if (m_documentLoader)
971 m_documentLoader->detachFromFrame(); 971 m_documentLoader->detachFromFrame();
972 m_documentLoader = m_provisionalDocumentLoader.release(); 972 m_documentLoader = m_provisionalDocumentLoader.release();
973 if (m_frame->document()) {
974 // Note that calling detachChildren() shouldn't be needed if there's no
975 // Document, since no child frames should be attached. The assert below
976 // enforces this invariant.
977 m_frame->detachChildren();
978 m_frame->document()->prepareForDestruction();
979 }
980 ASSERT(m_frame->tree().childCount() == 0);
981 973
982 if (isLoadingMainFrame()) 974 if (isLoadingMainFrame())
983 m_frame->page()->chrome().client().needTouchEvents(false); 975 m_frame->page()->chrome().client().needTouchEvents(false);
984 976
985 client()->transitionToCommittedForNewPage(); 977 client()->transitionToCommittedForNewPage();
986 m_frame->navigationScheduler().cancel(); 978 m_frame->navigationScheduler().cancel();
987 m_frame->editor().clearLastEditCommand(); 979 m_frame->editor().clearLastEditCommand();
988 980
989 // If we are still in the process of initializing an empty document then 981 // If we are still in the process of initializing an empty document then
990 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText 982 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 // FIXME: We need a way to propagate insecure requests policy flags to 1427 // FIXME: We need a way to propagate insecure requests policy flags to
1436 // out-of-process frames. For now, we'll always use default behavior. 1428 // out-of-process frames. For now, we'll always use default behavior.
1437 if (!parentFrame->isLocalFrame()) 1429 if (!parentFrame->isLocalFrame())
1438 return nullptr; 1430 return nullptr;
1439 1431
1440 ASSERT(toLocalFrame(parentFrame)->document()); 1432 ASSERT(toLocalFrame(parentFrame)->document());
1441 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1433 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1442 } 1434 }
1443 1435
1444 } // namespace blink 1436 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.cpp ('k') | Source/core/testing/DummyPageHolder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698