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

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

Issue 181493007: Don't stop the documentLoader on navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test expectation Created 6 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
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 if (document->hasActiveParser()) 932 if (document->hasActiveParser())
933 return false; 933 return false;
934 return true; 934 return true;
935 } 935 }
936 936
937 bool FrameLoader::checkLoadCompleteForThisFrame() 937 bool FrameLoader::checkLoadCompleteForThisFrame()
938 { 938 {
939 ASSERT(client()->hasWebView()); 939 ASSERT(client()->hasWebView());
940 RefPtr<LocalFrame> protect(m_frame); 940 RefPtr<LocalFrame> protect(m_frame);
941 941
942 bool allChildrenAreDoneLoading = true;
943 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling())
944 allChildrenAreDoneLoading &= child->loader().checkLoadCompleteForThisFra me();
945
942 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 946 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
943 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); 947 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror();
944 if (error.isNull()) 948 if (error.isNull())
945 return false; 949 return false;
946 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; 950 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader;
947 client()->dispatchDidFailProvisionalLoad(error); 951 client()->dispatchDidFailProvisionalLoad(error);
948 if (loader != m_provisionalDocumentLoader) 952 if (loader != m_provisionalDocumentLoader)
949 return false; 953 return false;
950 m_provisionalDocumentLoader->detachFromFrame(); 954 m_provisionalDocumentLoader->detachFromFrame();
951 m_provisionalDocumentLoader = nullptr; 955 m_provisionalDocumentLoader = nullptr;
952 m_progressTracker->progressCompleted(); 956 m_progressTracker->progressCompleted();
953 m_state = FrameStateComplete; 957 m_state = FrameStateComplete;
954 return true; 958 return true;
955 } 959 }
956 960
957 bool allChildrenAreDoneLoading = true;
958 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling())
959 allChildrenAreDoneLoading &= child->loader().checkLoadCompleteForThisFra me();
960 if (!allChildrenAreDoneLoading) 961 if (!allChildrenAreDoneLoading)
961 return false; 962 return false;
962 963
963 if (m_state == FrameStateComplete) 964 if (m_state == FrameStateComplete)
964 return true; 965 return true;
965 if (m_provisionalDocumentLoader || !m_documentLoader) 966 if (m_provisionalDocumentLoader || !m_documentLoader)
966 return false; 967 return false;
967 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders) 968 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders)
968 return false; 969 return false;
969 970
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); 1285 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding());
1285 1286
1286 // stopAllLoaders can detach the LocalFrame, so protect it. 1287 // stopAllLoaders can detach the LocalFrame, so protect it.
1287 RefPtr<LocalFrame> protect(m_frame); 1288 RefPtr<LocalFrame> protect(m_frame);
1288 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) || !shouldClose()) && m_policyDocumentLoader) { 1289 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) || !shouldClose()) && m_policyDocumentLoader) {
1289 m_policyDocumentLoader->detachFromFrame(); 1290 m_policyDocumentLoader->detachFromFrame();
1290 m_policyDocumentLoader = nullptr; 1291 m_policyDocumentLoader = nullptr;
1291 return; 1292 return;
1292 } 1293 }
1293 1294
1294 // A new navigation is in progress, so don't clear the history's provisional item. 1295 if (m_provisionalDocumentLoader) {
1295 stopAllLoaders(); 1296 m_provisionalDocumentLoader->stopLoading();
1297 if (m_provisionalDocumentLoader)
1298 m_provisionalDocumentLoader->detachFromFrame();
1299 m_provisionalDocumentLoader = nullptr;
1300 }
1301 m_checkTimer.stop();
1296 1302
1297 // <rdar://problem/6250856> - In certain circumstances on pages with multipl e frames, stopAllLoaders() 1303 // <rdar://problem/6250856> - In certain circumstances on pages with multipl e frames, stopAllLoaders()
1298 // might detach the current FrameLoader, in which case we should bail on thi s newly defunct load. 1304 // might detach the current FrameLoader, in which case we should bail on thi s newly defunct load.
1299 if (!m_frame->page() || !m_policyDocumentLoader) 1305 if (!m_frame->page() || !m_policyDocumentLoader)
1300 return; 1306 return;
1301 1307
1302 if (isLoadingMainFrame()) 1308 if (isLoadingMainFrame())
1303 m_frame->page()->inspectorController().resume(); 1309 m_frame->page()->inspectorController().resume();
1304 m_frame->navigationScheduler().cancel(); 1310 m_frame->navigationScheduler().cancel();
1305 1311
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 { 1445 {
1440 SandboxFlags flags = m_forcedSandboxFlags; 1446 SandboxFlags flags = m_forcedSandboxFlags;
1441 if (LocalFrame* parentFrame = m_frame->tree().parent()) 1447 if (LocalFrame* parentFrame = m_frame->tree().parent())
1442 flags |= parentFrame->document()->sandboxFlags(); 1448 flags |= parentFrame->document()->sandboxFlags();
1443 if (FrameOwner* frameOwner = m_frame->ownerElement()) 1449 if (FrameOwner* frameOwner = m_frame->ownerElement())
1444 flags |= frameOwner->sandboxFlags(); 1450 flags |= frameOwner->sandboxFlags();
1445 return flags; 1451 return flags;
1446 } 1452 }
1447 1453
1448 } // namespace WebCore 1454 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698