| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 stopLoading(); | 236 stopLoading(); |
| 237 | 237 |
| 238 if (Page* page = m_frame->page()) | 238 if (Page* page = m_frame->page()) |
| 239 page->undoStack().didUnloadFrame(*m_frame); | 239 page->undoStack().didUnloadFrame(*m_frame); |
| 240 return true; | 240 return true; |
| 241 } | 241 } |
| 242 | 242 |
| 243 void FrameLoader::didExplicitOpen() | 243 void FrameLoader::didExplicitOpen() |
| 244 { | 244 { |
| 245 // Calling document.open counts as committing the first real document load. | 245 // Calling document.open counts as committing the first real document load. |
| 246 if (!m_stateMachine.committedFirstRealDocumentLoad()) | 246 if (!m_stateMachine.committedFirstRealDocumentLoad()) { |
| 247 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); | 247 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad
); |
| 248 m_progressTracker->progressStarted(); |
| 249 } |
| 248 | 250 |
| 249 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing
away results | 251 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing
away results |
| 250 // from a subsequent window.document.open / window.document.write call. | 252 // from a subsequent window.document.open / window.document.write call. |
| 251 // Canceling redirection here works for all cases because document.open | 253 // Canceling redirection here works for all cases because document.open |
| 252 // implicitly precedes document.write. | 254 // implicitly precedes document.write. |
| 253 m_frame->navigationScheduler().cancel(); | 255 m_frame->navigationScheduler().cancel(); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void FrameLoader::clear() | 258 void FrameLoader::clear() |
| 257 { | 259 { |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 bool FrameLoader::isLoadingMainFrame() const | 953 bool FrameLoader::isLoadingMainFrame() const |
| 952 { | 954 { |
| 953 return m_frame->isMainFrame(); | 955 return m_frame->isMainFrame(); |
| 954 } | 956 } |
| 955 | 957 |
| 956 FrameLoadType FrameLoader::loadType() const | 958 FrameLoadType FrameLoader::loadType() const |
| 957 { | 959 { |
| 958 return m_loadType; | 960 return m_loadType; |
| 959 } | 961 } |
| 960 | 962 |
| 963 #if defined(ENABLE_LOAD_COMPLETION_HACKS) |
| 961 // This function is an incomprehensible mess and is only used in checkLoadComple
teForThisFrame. | 964 // This function is an incomprehensible mess and is only used in checkLoadComple
teForThisFrame. |
| 962 // If you're thinking of using it elsewhere, stop right now and reconsider your
life. | 965 // If you're thinking of using it elsewhere, stop right now and reconsider your
life. |
| 963 static bool isDocumentDoneLoading(Document* document) | 966 static bool isDocumentDoneLoading(Document* document) |
| 964 { | 967 { |
| 965 if (!document->loader()) | 968 if (!document->loader()) |
| 966 return true; | 969 return true; |
| 967 if (document->loader()->isLoadingMainResource()) | 970 if (document->loader()->isLoadingMainResource()) |
| 968 return false; | 971 return false; |
| 969 if (!document->loadEventFinished()) { | 972 if (!document->loadEventFinished()) |
| 970 if (document->loader()->isLoading() || document->isDelayingLoadEvent()) | 973 return false; |
| 971 return false; | |
| 972 } | |
| 973 if (document->fetcher()->requestCount()) | 974 if (document->fetcher()->requestCount()) |
| 974 return false; | 975 return false; |
| 975 if (document->processingLoadEvent()) | 976 if (document->processingLoadEvent()) |
| 976 return false; | 977 return false; |
| 977 if (document->hasActiveParser()) | 978 if (document->hasActiveParser()) |
| 978 return false; | 979 return false; |
| 979 return true; | 980 return true; |
| 980 } | 981 } |
| 982 #endif |
| 981 | 983 |
| 982 bool FrameLoader::checkLoadCompleteForThisFrame() | 984 bool FrameLoader::checkLoadCompleteForThisFrame() |
| 983 { | 985 { |
| 984 ASSERT(client()->hasWebView()); | 986 ASSERT(client()->hasWebView()); |
| 985 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 987 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 986 | 988 |
| 987 bool allChildrenAreDoneLoading = true; | 989 bool allChildrenAreDoneLoading = true; |
| 988 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child;
child = child->tree().nextSibling()) { | 990 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child;
child = child->tree().nextSibling()) { |
| 989 if (child->isLocalFrame()) | 991 if (child->isLocalFrame()) |
| 990 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che
ckLoadCompleteForThisFrame(); | 992 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che
ckLoadCompleteForThisFrame(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1006 return true; | 1008 return true; |
| 1007 } | 1009 } |
| 1008 | 1010 |
| 1009 if (!allChildrenAreDoneLoading) | 1011 if (!allChildrenAreDoneLoading) |
| 1010 return false; | 1012 return false; |
| 1011 | 1013 |
| 1012 if (m_state == FrameStateComplete) | 1014 if (m_state == FrameStateComplete) |
| 1013 return true; | 1015 return true; |
| 1014 if (m_provisionalDocumentLoader || !m_documentLoader) | 1016 if (m_provisionalDocumentLoader || !m_documentLoader) |
| 1015 return false; | 1017 return false; |
| 1018 |
| 1019 #if defined(ENABLE_LOAD_COMPLETION_HACKS) |
| 1016 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders) | 1020 if (!isDocumentDoneLoading(m_frame->document()) && !m_inStopAllLoaders) |
| 1017 return false; | 1021 return false; |
| 1022 #else |
| 1023 if (m_inStopAllLoaders) |
| 1024 m_frame->document()->suppressLoadEvent(); |
| 1025 if (!m_frame->document()->loadEventFinished()) |
| 1026 return false; |
| 1027 #endif |
| 1018 | 1028 |
| 1019 m_state = FrameStateComplete; | 1029 m_state = FrameStateComplete; |
| 1020 | 1030 |
| 1021 // FIXME: Is this subsequent work important if we already navigated away? | 1031 // FIXME: Is this subsequent work important if we already navigated away? |
| 1022 // Maybe there are bugs because of that, or extra work we can skip because | 1032 // Maybe there are bugs because of that, or extra work we can skip because |
| 1023 // the new page is ready. | 1033 // the new page is ready. |
| 1024 | 1034 |
| 1025 // Retry restoring scroll offset since FrameStateComplete disables content | 1035 // Retry restoring scroll offset since FrameStateComplete disables content |
| 1026 // size clamping. | 1036 // size clamping. |
| 1027 restoreScrollPositionAndViewState(); | 1037 restoreScrollPositionAndViewState(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 | 1276 |
| 1267 bool isTransitionNavigation = false; | 1277 bool isTransitionNavigation = false; |
| 1268 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL
oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS
ame) | 1278 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL
oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS
ame) |
| 1269 isTransitionNavigation = dispatchNavigationTransitionData(); | 1279 isTransitionNavigation = dispatchNavigationTransitionData(); |
| 1270 | 1280 |
| 1271 // stopAllLoaders can detach the LocalFrame, so protect it. | 1281 // stopAllLoaders can detach the LocalFrame, so protect it. |
| 1272 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1282 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 1273 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho
uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose(
)) && m_policyDocumentLoader) { | 1283 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho
uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose(
)) && m_policyDocumentLoader) { |
| 1274 m_policyDocumentLoader->detachFromFrame(); | 1284 m_policyDocumentLoader->detachFromFrame(); |
| 1275 m_policyDocumentLoader = nullptr; | 1285 m_policyDocumentLoader = nullptr; |
| 1286 if (!m_stateMachine.committedFirstRealDocumentLoad()) |
| 1287 m_state = FrameStateComplete; |
| 1276 checkCompleted(); | 1288 checkCompleted(); |
| 1277 return; | 1289 return; |
| 1278 } | 1290 } |
| 1279 | 1291 |
| 1280 if (m_provisionalDocumentLoader) { | 1292 if (m_provisionalDocumentLoader) { |
| 1281 m_provisionalDocumentLoader->stopLoading(); | 1293 m_provisionalDocumentLoader->stopLoading(); |
| 1282 if (m_provisionalDocumentLoader) | 1294 if (m_provisionalDocumentLoader) |
| 1283 m_provisionalDocumentLoader->detachFromFrame(); | 1295 m_provisionalDocumentLoader->detachFromFrame(); |
| 1284 m_provisionalDocumentLoader = nullptr; | 1296 m_provisionalDocumentLoader = nullptr; |
| 1285 } | 1297 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1454 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
| 1443 Frame* parentFrame = m_frame->tree().parent(); | 1455 Frame* parentFrame = m_frame->tree().parent(); |
| 1444 if (parentFrame && parentFrame->isLocalFrame()) | 1456 if (parentFrame && parentFrame->isLocalFrame()) |
| 1445 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1457 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
| 1446 if (FrameOwner* frameOwner = m_frame->owner()) | 1458 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1447 flags |= frameOwner->sandboxFlags(); | 1459 flags |= frameOwner->sandboxFlags(); |
| 1448 return flags; | 1460 return flags; |
| 1449 } | 1461 } |
| 1450 | 1462 |
| 1451 } // namespace blink | 1463 } // namespace blink |
| OLD | NEW |