Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client) | 142 FrameLoader::FrameLoader(LocalFrame* frame, FrameLoaderClient* client) |
| 143 : m_frame(frame) | 143 : m_frame(frame) |
| 144 , m_client(client) | 144 , m_client(client) |
| 145 , m_mixedContentChecker(frame) | 145 , m_mixedContentChecker(frame) |
| 146 , m_progressTracker(FrameProgressTracker::create(m_frame)) | 146 , m_progressTracker(FrameProgressTracker::create(m_frame)) |
| 147 , m_state(FrameStateProvisional) | 147 , m_state(FrameStateProvisional) |
| 148 , m_loadType(FrameLoadTypeStandard) | 148 , m_loadType(FrameLoadTypeStandard) |
| 149 , m_fetchContext(FrameFetchContext::create(frame)) | 149 , m_fetchContext(FrameFetchContext::create(frame)) |
| 150 , m_inStopAllLoaders(false) | 150 , m_inStopAllLoaders(false) |
| 151 , m_isComplete(false) | 151 , m_isComplete(false) |
| 152 , m_currentLoaderNeedsStop(false) | |
| 152 , m_checkTimer(this, &FrameLoader::checkTimerFired) | 153 , m_checkTimer(this, &FrameLoader::checkTimerFired) |
| 153 , m_shouldCallCheckCompleted(false) | 154 , m_shouldCallCheckCompleted(false) |
| 154 , m_didAccessInitialDocument(false) | 155 , m_didAccessInitialDocument(false) |
| 155 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) | 156 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) |
| 156 , m_forcedSandboxFlags(SandboxNone) | 157 , m_forcedSandboxFlags(SandboxNone) |
| 157 { | 158 { |
| 158 } | 159 } |
| 159 | 160 |
| 160 FrameLoader::~FrameLoader() | 161 FrameLoader::~FrameLoader() |
| 161 { | 162 { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 608 if (m_frame->view()) | 609 if (m_frame->view()) |
| 609 m_frame->view()->maintainScrollPositionAtAnchor(0); | 610 m_frame->view()->maintainScrollPositionAtAnchor(0); |
| 610 } | 611 } |
| 611 | 612 |
| 612 void FrameLoader::started() | 613 void FrameLoader::started() |
| 613 { | 614 { |
| 614 for (LocalFrame* frame = m_frame; frame; frame = frame->tree().parent()) | 615 for (LocalFrame* frame = m_frame; frame; frame = frame->tree().parent()) |
| 615 frame->loader().m_isComplete = false; | 616 frame->loader().m_isComplete = false; |
| 616 } | 617 } |
| 617 | 618 |
| 619 void FrameLoader::onResponseReceived() | |
| 620 { | |
| 621 checkCurrentDocumentLoaderNeedsStop(); | |
| 622 } | |
| 623 | |
| 624 void FrameLoader::checkCurrentDocumentLoaderNeedsStop() | |
|
Nate Chapin
2014/03/10 16:12:44
If this function is only called once, let's merge
mkosiba (inactive)
2014/03/11 23:24:08
sure, I was keeping it separate because I was expe
| |
| 625 { | |
| 626 if (!m_currentLoaderNeedsStop) | |
| 627 return; | |
| 628 | |
| 629 for (RefPtr<LocalFrame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) | |
| 630 child->loader().stopAllLoaders(); | |
| 631 if (m_documentLoader) | |
| 632 m_documentLoader->stopLoading(); | |
| 633 | |
| 634 m_currentLoaderNeedsStop = false; | |
| 635 | |
| 636 if (m_state == FrameStateProvisional) | |
| 637 m_progressTracker->progressStarted(); | |
|
Nate Chapin
2014/03/10 16:12:44
It doesn't seem right to wait to send a progress t
mkosiba (inactive)
2014/03/11 23:24:08
this is the meat of the change. The problem is tha
Nate Chapin
2014/03/12 19:55:45
I talked with darin, and our thoughts were:
1. Le
| |
| 638 } | |
| 639 | |
| 618 void FrameLoader::setReferrerForFrameRequest(ResourceRequest& request, ShouldSen dReferrer shouldSendReferrer, Document* originDocument) | 640 void FrameLoader::setReferrerForFrameRequest(ResourceRequest& request, ShouldSen dReferrer shouldSendReferrer, Document* originDocument) |
| 619 { | 641 { |
| 620 if (shouldSendReferrer == NeverSendReferrer) { | 642 if (shouldSendReferrer == NeverSendReferrer) { |
| 621 request.clearHTTPReferrer(); | 643 request.clearHTTPReferrer(); |
| 622 return; | 644 return; |
| 623 } | 645 } |
| 624 | 646 |
| 625 // Always use the initiating document to generate the referrer. | 647 // Always use the initiating document to generate the referrer. |
| 626 // We need to generateReferrerHeader(), because we might not have enforced R eferrerPolicy or https->http | 648 // We need to generateReferrerHeader(), because we might not have enforced R eferrerPolicy or https->http |
| 627 // referrer suppression yet. | 649 // referrer suppression yet. |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 | 952 |
| 931 FrameLoadType FrameLoader::loadType() const | 953 FrameLoadType FrameLoader::loadType() const |
| 932 { | 954 { |
| 933 return m_loadType; | 955 return m_loadType; |
| 934 } | 956 } |
| 935 | 957 |
| 936 void FrameLoader::checkLoadCompleteForThisFrame() | 958 void FrameLoader::checkLoadCompleteForThisFrame() |
| 937 { | 959 { |
| 938 ASSERT(m_client->hasWebView()); | 960 ASSERT(m_client->hasWebView()); |
| 939 | 961 |
| 962 if (m_currentLoaderNeedsStop) | |
|
Nate Chapin
2014/03/10 16:12:44
Why is this needed?
mkosiba (inactive)
2014/03/11 23:24:08
because otherwise we'll call
m_progressTracker
| |
| 963 return; | |
| 964 | |
| 940 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { | 965 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { |
| 941 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); | 966 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); |
| 942 if (error.isNull()) | 967 if (error.isNull()) |
| 943 return; | 968 return; |
| 944 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; | 969 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; |
| 945 m_client->dispatchDidFailProvisionalLoad(error); | 970 m_client->dispatchDidFailProvisionalLoad(error); |
| 946 if (loader != m_provisionalDocumentLoader) | 971 if (loader != m_provisionalDocumentLoader) |
| 947 return; | 972 return; |
| 948 m_provisionalDocumentLoader->detachFromFrame(); | 973 m_provisionalDocumentLoader->detachFromFrame(); |
| 949 m_provisionalDocumentLoader = nullptr; | 974 m_provisionalDocumentLoader = nullptr; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1281 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); | 1306 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); |
| 1282 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect ); | 1307 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect ); |
| 1283 | 1308 |
| 1284 if (LocalFrame* parent = m_frame->tree().parent()) | 1309 if (LocalFrame* parent = m_frame->tree().parent()) |
| 1285 m_policyDocumentLoader->setOverrideEncoding(parent->loader().documentLoa der()->overrideEncoding()); | 1310 m_policyDocumentLoader->setOverrideEncoding(parent->loader().documentLoa der()->overrideEncoding()); |
| 1286 else if (!overrideEncoding.isEmpty()) | 1311 else if (!overrideEncoding.isEmpty()) |
| 1287 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); | 1312 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); |
| 1288 else if (m_documentLoader) | 1313 else if (m_documentLoader) |
| 1289 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); | 1314 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); |
| 1290 | 1315 |
| 1291 // stopAllLoaders can detach the LocalFrame, so protect it. | 1316 // Stopping the provisional loader can detach the Frame, so protect it. |
| 1292 RefPtr<LocalFrame> protect(m_frame); | 1317 RefPtr<LocalFrame> protect(m_frame); |
| 1293 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) || !shouldClose()) && m_policyDocumentLoader) { | 1318 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) || !shouldClose()) && m_policyDocumentLoader) { |
| 1294 m_policyDocumentLoader->detachFromFrame(); | 1319 m_policyDocumentLoader->detachFromFrame(); |
| 1295 m_policyDocumentLoader = nullptr; | 1320 m_policyDocumentLoader = nullptr; |
| 1296 return; | 1321 return; |
| 1297 } | 1322 } |
| 1298 | 1323 |
| 1299 // A new navigation is in progress, so don't clear the history's provisional item. | |
| 1300 stopAllLoaders(); | |
| 1301 | |
| 1302 // <rdar://problem/6250856> - In certain circumstances on pages with multipl e frames, stopAllLoaders() | |
| 1303 // might detach the current FrameLoader, in which case we should bail on thi s newly defunct load. | |
| 1304 if (!m_frame->page() || !m_policyDocumentLoader) | |
| 1305 return; | |
| 1306 | |
| 1307 if (isLoadingMainFrame()) | 1324 if (isLoadingMainFrame()) |
| 1308 m_frame->page()->inspectorController().resume(); | 1325 m_frame->page()->inspectorController().resume(); |
| 1309 m_frame->navigationScheduler().cancel(); | 1326 m_frame->navigationScheduler().cancel(); |
| 1310 | 1327 |
| 1328 if (m_provisionalDocumentLoader) | |
| 1329 m_provisionalDocumentLoader->stopLoading(); | |
| 1330 if (m_provisionalDocumentLoader) | |
|
Nate Chapin
2014/03/10 16:12:44
Merge these 2 ifs? Or can stopLoading() null out t
mkosiba (inactive)
2014/03/11 23:24:08
merge - sure. call stopLoading() - no, since that
| |
| 1331 m_provisionalDocumentLoader->detachFromFrame(); | |
| 1332 m_checkTimer.stop(); | |
| 1333 | |
| 1311 m_provisionalDocumentLoader = m_policyDocumentLoader.release(); | 1334 m_provisionalDocumentLoader = m_policyDocumentLoader.release(); |
| 1312 m_loadType = type; | 1335 m_loadType = type; |
| 1313 m_state = FrameStateProvisional; | 1336 m_state = FrameStateProvisional; |
| 1337 m_currentLoaderNeedsStop = true; | |
| 1314 | 1338 |
| 1315 if (formState) | 1339 if (formState) |
| 1316 m_client->dispatchWillSubmitForm(formState); | 1340 m_client->dispatchWillSubmitForm(formState); |
| 1317 | 1341 |
| 1318 m_progressTracker->progressStarted(); | |
| 1319 if (m_provisionalDocumentLoader->isClientRedirect()) | 1342 if (m_provisionalDocumentLoader->isClientRedirect()) |
| 1320 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); | 1343 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); |
| 1321 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url()); | 1344 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url()); |
| 1322 m_client->dispatchDidStartProvisionalLoad(); | 1345 m_client->dispatchDidStartProvisionalLoad(); |
| 1323 ASSERT(m_provisionalDocumentLoader); | 1346 ASSERT(m_provisionalDocumentLoader); |
| 1324 m_provisionalDocumentLoader->startLoadingMainResource(); | 1347 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 1325 } | 1348 } |
| 1326 | 1349 |
| 1327 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1350 void FrameLoader::applyUserAgent(ResourceRequest& request) |
| 1328 { | 1351 { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1435 { | 1458 { |
| 1436 SandboxFlags flags = m_forcedSandboxFlags; | 1459 SandboxFlags flags = m_forcedSandboxFlags; |
| 1437 if (LocalFrame* parentFrame = m_frame->tree().parent()) | 1460 if (LocalFrame* parentFrame = m_frame->tree().parent()) |
| 1438 flags |= parentFrame->document()->sandboxFlags(); | 1461 flags |= parentFrame->document()->sandboxFlags(); |
| 1439 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) | 1462 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) |
| 1440 flags |= ownerElement->sandboxFlags(); | 1463 flags |= ownerElement->sandboxFlags(); |
| 1441 return flags; | 1464 return flags; |
| 1442 } | 1465 } |
| 1443 | 1466 |
| 1444 } // namespace WebCore | 1467 } // namespace WebCore |
| OLD | NEW |