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

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

Issue 1177333002: Revert of Detach old frame on WebFrame::swap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/Page.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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 } 993 }
994 994
995 void FrameLoader::notifyIfInitialDocumentAccessed() 995 void FrameLoader::notifyIfInitialDocumentAccessed()
996 { 996 {
997 if (m_didAccessInitialDocumentTimer.isActive()) { 997 if (m_didAccessInitialDocumentTimer.isActive()) {
998 m_didAccessInitialDocumentTimer.stop(); 998 m_didAccessInitialDocumentTimer.stop();
999 didAccessInitialDocumentTimerFired(0); 999 didAccessInitialDocumentTimerFired(0);
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 bool FrameLoader::prepareForCommit() 1003 void FrameLoader::commitProvisionalLoad()
1004 { 1004 {
1005 ASSERT(client()->hasWebView());
1005 PluginScriptForbiddenScope forbidPluginDestructorScripting; 1006 PluginScriptForbiddenScope forbidPluginDestructorScripting;
1006 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; 1007 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
1008 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1009
1010 // Check if the destination page is allowed to access the previous page's ti ming information.
1011 if (m_frame->document()) {
1012 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url());
1013 pdl->timing().setHasSameOriginAsPreviousDocument(securityOrigin->canRequ est(m_frame->document()->url()));
1014 }
1007 1015
1008 if (m_documentLoader) { 1016 if (m_documentLoader) {
1009 client()->dispatchWillClose(); 1017 client()->dispatchWillClose();
1010 dispatchUnloadEvent(); 1018 dispatchUnloadEvent();
1011 } 1019 }
1012 m_frame->detachChildren(); 1020 m_frame->detachChildren();
1013 // The previous calls to dispatchUnloadEvent() and detachChildren() can 1021 // The previous calls to dispatchUnloadEvent() and detachChildren() can
1014 // execute arbitrary script via things like unload events. If the executed 1022 // execute arbitrary script via things like unload events. If the executed
1015 // script intiates a new load or causes the current frame to be detached, 1023 // script intiates a new load or causes the current frame to be detached,
1016 // we need to abandon the current load. 1024 // we need to abandon the current load.
1017 if (pdl != m_provisionalDocumentLoader) 1025 if (pdl != m_provisionalDocumentLoader)
1018 return false; 1026 return;
1019 if (m_documentLoader) { 1027 if (m_documentLoader) {
1020 FrameNavigationDisabler navigationDisabler(m_frame); 1028 FrameNavigationDisabler navigationDisabler(m_frame);
1021 m_documentLoader->detachFromFrame(); 1029 m_documentLoader->detachFromFrame();
1022 } 1030 }
1023 // detachFromFrame() will abort XHRs that haven't completed, which can 1031 // detachFromFrame() will abort XHRs that haven't completed, which can
1024 // trigger event listeners for 'abort'. These event listeners might detach 1032 // trigger event listeners for 'abort'. These event listeners might detach
1025 // the frame. 1033 // the frame.
1026 // TODO(dcheng): Investigate if this can be moved above the check that 1034 // TODO(dcheng): Investigate if this can be moved above the check that
1027 // m_provisionalDocumentLoader hasn't changed. 1035 // m_provisionalDocumentLoader hasn't changed.
1028 if (!m_frame->client()) 1036 if (!m_frame->client())
1029 return false; 1037 return;
1030 // No more events will be dispatched so detach the Document. 1038 // No more events will be dispatched so detach the Document.
1031 if (m_frame->document()) 1039 if (m_frame->document())
1032 m_frame->document()->detach(); 1040 m_frame->document()->detach();
1033 m_documentLoader = m_provisionalDocumentLoader.release(); 1041 m_documentLoader = m_provisionalDocumentLoader.release();
1034 1042
1035 return true;
1036 }
1037
1038 void FrameLoader::commitProvisionalLoad()
1039 {
1040 ASSERT(client()->hasWebView());
1041 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1042
1043 // Check if the destination page is allowed to access the previous page's ti ming information.
1044 if (m_frame->document()) {
1045 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi onalDocumentLoader->request().url());
1046 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument (securityOrigin->canRequest(m_frame->document()->url()));
1047 }
1048
1049 if (!prepareForCommit())
1050 return;
1051
1052 if (isLoadingMainFrame()) 1043 if (isLoadingMainFrame())
1053 m_frame->page()->chromeClient().needTouchEvents(false); 1044 m_frame->page()->chromeClient().needTouchEvents(false);
1054 1045
1055 client()->transitionToCommittedForNewPage(); 1046 client()->transitionToCommittedForNewPage();
1056 m_frame->navigationScheduler().cancel(); 1047 m_frame->navigationScheduler().cancel();
1057 m_frame->editor().clearLastEditCommand(); 1048 m_frame->editor().clearLastEditCommand();
1058 1049
1059 // If we are still in the process of initializing an empty document then 1050 // If we are still in the process of initializing an empty document then
1060 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText 1051 // its frame is not in a consistent state for rendering, so avoid setJSStatu sBarText
1061 // since it may cause clients to attempt to render the frame. 1052 // since it may cause clients to attempt to render the frame.
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 // FIXME: We need a way to propagate insecure requests policy flags to 1475 // FIXME: We need a way to propagate insecure requests policy flags to
1485 // out-of-process frames. For now, we'll always use default behavior. 1476 // out-of-process frames. For now, we'll always use default behavior.
1486 if (!parentFrame->isLocalFrame()) 1477 if (!parentFrame->isLocalFrame())
1487 return nullptr; 1478 return nullptr;
1488 1479
1489 ASSERT(toLocalFrame(parentFrame)->document()); 1480 ASSERT(toLocalFrame(parentFrame)->document());
1490 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1481 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1491 } 1482 }
1492 1483
1493 } // namespace blink 1484 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698