| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
| 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 initialRequest.setFrameType(m_frame->isMainFrame() | 218 initialRequest.setFrameType(m_frame->isMainFrame() |
| 219 ? WebURLRequest::FrameTypeTopLevel | 219 ? WebURLRequest::FrameTypeTopLevel |
| 220 : WebURLRequest::FrameTypeNested); | 220 : WebURLRequest::FrameTypeNested); |
| 221 m_provisionalDocumentLoader = | 221 m_provisionalDocumentLoader = |
| 222 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(), | 222 client()->createDocumentLoader(m_frame, initialRequest, SubstituteData(), |
| 223 ClientRedirectPolicy::NotClientRedirect); | 223 ClientRedirectPolicy::NotClientRedirect); |
| 224 m_provisionalDocumentLoader->startLoadingMainResource(); | 224 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 225 m_frame->document()->cancelParsing(); | 225 m_frame->document()->cancelParsing(); |
| 226 m_stateMachine.advanceTo( | 226 m_stateMachine.advanceTo( |
| 227 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); | 227 FrameLoaderStateMachine::DisplayingInitialEmptyDocument); |
| 228 // Suppress finish notifications for inital empty documents, since they don't |
| 229 // generate start notifications. |
| 230 if (m_documentLoader) |
| 231 m_documentLoader->setSentDidFinishLoad(); |
| 228 // Self-suspend if created in an already suspended Page. Note that both | 232 // Self-suspend if created in an already suspended Page. Note that both |
| 229 // startLoadingMainResource() and cancelParsing() may have already detached | 233 // startLoadingMainResource() and cancelParsing() may have already detached |
| 230 // the frame, since they both fire JS events. | 234 // the frame, since they both fire JS events. |
| 231 if (m_frame->page() && m_frame->page()->suspended()) | 235 if (m_frame->page() && m_frame->page()->suspended()) |
| 232 setDefersLoading(true); | 236 setDefersLoading(true); |
| 233 takeObjectSnapshot(); | 237 takeObjectSnapshot(); |
| 234 } | 238 } |
| 235 | 239 |
| 236 FrameLoaderClient* FrameLoader::client() const { | 240 FrameLoaderClient* FrameLoader::client() const { |
| 237 return static_cast<FrameLoaderClient*>(m_frame->client()); | 241 return static_cast<FrameLoaderClient*>(m_frame->client()); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 if (!document->haveImportsLoaded()) | 669 if (!document->haveImportsLoaded()) |
| 666 return false; | 670 return false; |
| 667 if (document->fetcher()->requestCount()) | 671 if (document->fetcher()->requestCount()) |
| 668 return false; | 672 return false; |
| 669 if (document->isDelayingLoadEvent()) | 673 if (document->isDelayingLoadEvent()) |
| 670 return false; | 674 return false; |
| 671 return allDescendantsAreComplete(document->frame()); | 675 return allDescendantsAreComplete(document->frame()); |
| 672 } | 676 } |
| 673 | 677 |
| 674 static bool shouldSendFinishNotification(LocalFrame* frame) { | 678 static bool shouldSendFinishNotification(LocalFrame* frame) { |
| 675 // Don't send stop notifications for inital empty documents, since they don't | |
| 676 // generate start notifications. | |
| 677 if (!frame->loader().stateMachine()->committedFirstRealDocumentLoad()) | |
| 678 return false; | |
| 679 | |
| 680 // Don't send didFinishLoad more than once per DocumentLoader. | 679 // Don't send didFinishLoad more than once per DocumentLoader. |
| 681 if (frame->loader().documentLoader()->sentDidFinishLoad()) | 680 if (frame->loader().documentLoader()->sentDidFinishLoad()) |
| 682 return false; | 681 return false; |
| 683 | 682 |
| 684 // We might have declined to run the load event due to an imminent | 683 // We might have declined to run the load event due to an imminent |
| 685 // content-initiated navigation. | 684 // content-initiated navigation. |
| 686 if (!frame->document()->loadEventFinished()) | 685 if (!frame->document()->loadEventFinished()) |
| 687 return false; | 686 return false; |
| 688 | 687 |
| 689 // An event might have restarted a child frame. | 688 // An event might have restarted a child frame. |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 void FrameLoader::loadFailed(DocumentLoader* loader, | 1460 void FrameLoader::loadFailed(DocumentLoader* loader, |
| 1462 const ResourceError& error) { | 1461 const ResourceError& error) { |
| 1463 if (!error.isCancellation() && m_frame->owner()) { | 1462 if (!error.isCancellation() && m_frame->owner()) { |
| 1464 // FIXME: For now, fallback content doesn't work cross process. | 1463 // FIXME: For now, fallback content doesn't work cross process. |
| 1465 if (m_frame->owner()->isLocal()) | 1464 if (m_frame->owner()->isLocal()) |
| 1466 m_frame->deprecatedLocalOwner()->renderFallbackContent(); | 1465 m_frame->deprecatedLocalOwner()->renderFallbackContent(); |
| 1467 } | 1466 } |
| 1468 | 1467 |
| 1469 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); | 1468 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); |
| 1470 if (loader == m_provisionalDocumentLoader) { | 1469 if (loader == m_provisionalDocumentLoader) { |
| 1470 m_provisionalDocumentLoader->setSentDidFinishLoad(); |
| 1471 client()->dispatchDidFailProvisionalLoad(error, historyCommitType); | 1471 client()->dispatchDidFailProvisionalLoad(error, historyCommitType); |
| 1472 if (loader != m_provisionalDocumentLoader) | 1472 if (loader != m_provisionalDocumentLoader) |
| 1473 return; | 1473 return; |
| 1474 detachDocumentLoader(m_provisionalDocumentLoader); | 1474 detachDocumentLoader(m_provisionalDocumentLoader); |
| 1475 m_progressTracker->progressCompleted(); | |
| 1476 } else { | 1475 } else { |
| 1477 DCHECK_EQ(loader, m_documentLoader); | 1476 DCHECK_EQ(loader, m_documentLoader); |
| 1478 if (m_frame->document()->parser()) | 1477 if (m_frame->document()->parser()) |
| 1479 m_frame->document()->parser()->stopParsing(); | 1478 m_frame->document()->parser()->stopParsing(); |
| 1480 m_documentLoader->setSentDidFinishLoad(); | 1479 if (!m_documentLoader->sentDidFinishLoad()) { |
| 1481 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { | 1480 m_documentLoader->setSentDidFinishLoad(); |
| 1482 client()->dispatchDidFailLoad(error, historyCommitType); | 1481 client()->dispatchDidFailLoad(error, historyCommitType); |
| 1483 m_progressTracker->progressCompleted(); | |
| 1484 } | 1482 } |
| 1485 } | 1483 } |
| 1486 checkCompleted(); | 1484 checkCompleted(); |
| 1487 } | 1485 } |
| 1488 | 1486 |
| 1489 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, | 1487 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, |
| 1490 const String& httpMethod, | 1488 const String& httpMethod, |
| 1491 FrameLoadType loadType, | 1489 FrameLoadType loadType, |
| 1492 const KURL& url) { | 1490 const KURL& url) { |
| 1493 // We don't do this if we are submitting a form with method other than "GET", | 1491 // We don't do this if we are submitting a form with method other than "GET", |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 m_documentLoader ? m_documentLoader->url() : String()); | 1890 m_documentLoader ? m_documentLoader->url() : String()); |
| 1893 return tracedValue; | 1891 return tracedValue; |
| 1894 } | 1892 } |
| 1895 | 1893 |
| 1896 inline void FrameLoader::takeObjectSnapshot() const { | 1894 inline void FrameLoader::takeObjectSnapshot() const { |
| 1897 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1895 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1898 toTracedValue()); | 1896 toTracedValue()); |
| 1899 } | 1897 } |
| 1900 | 1898 |
| 1901 } // namespace blink | 1899 } // namespace blink |
| OLD | NEW |