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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 stopLoading(); | 222 stopLoading(); |
| 223 | 223 |
| 224 if (Page* page = m_frame->page()) | 224 if (Page* page = m_frame->page()) |
| 225 page->undoStack().didUnloadFrame(*m_frame); | 225 page->undoStack().didUnloadFrame(*m_frame); |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 | 228 |
| 229 void FrameLoader::didExplicitOpen() | 229 void FrameLoader::didExplicitOpen() |
| 230 { | 230 { |
| 231 // Calling document.open counts as committing the first real document load. | 231 // Calling document.open counts as committing the first real document load. |
| 232 if (!m_stateMachine.committedFirstRealDocumentLoad()) | 232 if (!m_stateMachine.committedFirstRealDocumentLoad()) { |
| 233 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); | 233 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); |
| 234 m_progressTracker->progressStarted(); | |
|
Nate Chapin
2014/09/15 23:39:35
Similar to a javascript url, an explicit open() in
| |
| 235 } | |
| 234 | 236 |
| 235 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results | 237 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results |
| 236 // from a subsequent window.document.open / window.document.write call. | 238 // from a subsequent window.document.open / window.document.write call. |
| 237 // Canceling redirection here works for all cases because document.open | 239 // Canceling redirection here works for all cases because document.open |
| 238 // implicitly precedes document.write. | 240 // implicitly precedes document.write. |
| 239 m_frame->navigationScheduler().cancel(); | 241 m_frame->navigationScheduler().cancel(); |
| 240 } | 242 } |
| 241 | 243 |
| 242 void FrameLoader::clear() | 244 void FrameLoader::clear() |
| 243 { | 245 { |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 929 bool FrameLoader::isLoadingMainFrame() const | 931 bool FrameLoader::isLoadingMainFrame() const |
| 930 { | 932 { |
| 931 return m_frame->isMainFrame(); | 933 return m_frame->isMainFrame(); |
| 932 } | 934 } |
| 933 | 935 |
| 934 FrameLoadType FrameLoader::loadType() const | 936 FrameLoadType FrameLoader::loadType() const |
| 935 { | 937 { |
| 936 return m_loadType; | 938 return m_loadType; |
| 937 } | 939 } |
| 938 | 940 |
| 941 #if defined(ENABLE_LOAD_COMPLETION_HACKS) | |
| 939 // This function is an incomprehensible mess and is only used in checkLoadComple teForThisFrame. | 942 // This function is an incomprehensible mess and is only used in checkLoadComple teForThisFrame. |
| 940 // If you're thinking of using it elsewhere, stop right now and reconsider your life. | 943 // If you're thinking of using it elsewhere, stop right now and reconsider your life. |
| 941 static bool isDocumentDoneLoading(Document* document) | 944 static bool isDocumentDoneLoading(Document* document) |
| 942 { | 945 { |
| 943 if (!document->loader()) | 946 if (!document->loader()) |
| 944 return true; | 947 return true; |
| 945 if (document->loader()->isLoadingMainResource()) | 948 if (document->loader()->isLoadingMainResource()) |
| 946 return false; | 949 return false; |
| 947 if (!document->loadEventFinished()) { | 950 if (!document->loadEventFinished()) |
| 948 if (document->loader()->isLoading() || document->isDelayingLoadEvent()) | 951 return false; |
| 949 return false; | |
| 950 } | |
| 951 if (document->fetcher()->requestCount()) | 952 if (document->fetcher()->requestCount()) |
| 952 return false; | 953 return false; |
| 953 if (document->processingLoadEvent()) | 954 if (document->processingLoadEvent()) |
| 954 return false; | 955 return false; |
| 955 if (document->hasActiveParser()) | |
| 956 return false; | |
| 957 return true; | 956 return true; |
| 958 } | 957 } |
| 958 #endif | |
| 959 | 959 |
| 960 bool FrameLoader::checkLoadCompleteForThisFrame() | 960 bool FrameLoader::checkLoadCompleteForThisFrame() |
| 961 { | 961 { |
| 962 ASSERT(client()->hasWebView()); | 962 ASSERT(client()->hasWebView()); |
| 963 RefPtr<LocalFrame> protect(m_frame); | 963 RefPtr<LocalFrame> protect(m_frame); |
| 964 | 964 |
| 965 bool allChildrenAreDoneLoading = true; | 965 bool allChildrenAreDoneLoading = true; |
| 966 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { | 966 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { |
| 967 if (child->isLocalFrame()) | 967 if (child->isLocalFrame()) |
| 968 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); | 968 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 984 return true; | 984 return true; |
| 985 } | 985 } |
| 986 | 986 |
| 987 if (!allChildrenAreDoneLoading) | 987 if (!allChildrenAreDoneLoading) |
| 988 return false; | 988 return false; |
| 989 | 989 |
| 990 if (m_state == FrameStateComplete) | 990 if (m_state == FrameStateComplete) |
| 991 return true; | 991 return true; |
| 992 if (m_provisionalDocumentLoader || !m_documentLoader) | 992 if (m_provisionalDocumentLoader || !m_documentLoader) |
| 993 return false; | 993 return false; |
| 994 | |
| 995 #if defined(ENABLE_LOAD_COMPLETION_HACKS) | |
| 994 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders) | 996 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders) |
| 995 return false; | 997 return false; |
| 998 #else | |
| 999 if (m_inStopAllLoaders) | |
| 1000 m_frame->document()->suppressLoadEvent(); | |
| 1001 if (!m_frame->document()->loadEventFinished()) | |
| 1002 return false; | |
| 1003 #endif | |
| 996 | 1004 |
| 997 m_state = FrameStateComplete; | 1005 m_state = FrameStateComplete; |
| 998 | 1006 |
| 999 // FIXME: Is this subsequent work important if we already navigated away? | 1007 // FIXME: Is this subsequent work important if we already navigated away? |
| 1000 // Maybe there are bugs because of that, or extra work we can skip because | 1008 // Maybe there are bugs because of that, or extra work we can skip because |
| 1001 // the new page is ready. | 1009 // the new page is ready. |
| 1002 | 1010 |
| 1003 // Retry restoring scroll offset since FrameStateComplete disables content | 1011 // Retry restoring scroll offset since FrameStateComplete disables content |
| 1004 // size clamping. | 1012 // size clamping. |
| 1005 restoreScrollPositionAndViewState(); | 1013 restoreScrollPositionAndViewState(); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1289 | 1297 |
| 1290 bool isTransitionNavigation = false; | 1298 bool isTransitionNavigation = false; |
| 1291 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) | 1299 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) |
| 1292 isTransitionNavigation = dispatchNavigationTransitionData(); | 1300 isTransitionNavigation = dispatchNavigationTransitionData(); |
| 1293 | 1301 |
| 1294 // stopAllLoaders can detach the LocalFrame, so protect it. | 1302 // stopAllLoaders can detach the LocalFrame, so protect it. |
| 1295 RefPtr<LocalFrame> protect(m_frame); | 1303 RefPtr<LocalFrame> protect(m_frame); |
| 1296 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { | 1304 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { |
| 1297 m_policyDocumentLoader->detachFromFrame(); | 1305 m_policyDocumentLoader->detachFromFrame(); |
| 1298 m_policyDocumentLoader = nullptr; | 1306 m_policyDocumentLoader = nullptr; |
| 1307 if (!m_stateMachine.committedFirstRealDocumentLoad()) | |
| 1308 m_state = FrameStateComplete; | |
|
Nate Chapin
2014/09/15 23:39:35
This isn't necessary in the real world at the mome
| |
| 1299 checkCompleted(); | 1309 checkCompleted(); |
| 1300 return; | 1310 return; |
| 1301 } | 1311 } |
| 1302 | 1312 |
| 1303 if (m_provisionalDocumentLoader) { | 1313 if (m_provisionalDocumentLoader) { |
| 1304 m_provisionalDocumentLoader->stopLoading(); | 1314 m_provisionalDocumentLoader->stopLoading(); |
| 1305 if (m_provisionalDocumentLoader) | 1315 if (m_provisionalDocumentLoader) |
| 1306 m_provisionalDocumentLoader->detachFromFrame(); | 1316 m_provisionalDocumentLoader->detachFromFrame(); |
| 1307 m_provisionalDocumentLoader = nullptr; | 1317 m_provisionalDocumentLoader = nullptr; |
| 1308 } | 1318 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1465 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1475 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
| 1466 Frame* parentFrame = m_frame->tree().parent(); | 1476 Frame* parentFrame = m_frame->tree().parent(); |
| 1467 if (parentFrame && parentFrame->isLocalFrame()) | 1477 if (parentFrame && parentFrame->isLocalFrame()) |
| 1468 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1478 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
| 1469 if (FrameOwner* frameOwner = m_frame->owner()) | 1479 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1470 flags |= frameOwner->sandboxFlags(); | 1480 flags |= frameOwner->sandboxFlags(); |
| 1471 return flags; | 1481 return flags; |
| 1472 } | 1482 } |
| 1473 | 1483 |
| 1474 } // namespace blink | 1484 } // namespace blink |
| OLD | NEW |