| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 m_currentItem->setVisualViewportScrollOffset(toScrollOffset( | 280 m_currentItem->setVisualViewportScrollOffset(toScrollOffset( |
| 281 m_frame->host()->visualViewport().visibleRect().location())); | 281 m_frame->host()->visualViewport().visibleRect().location())); |
| 282 | 282 |
| 283 if (m_frame->isMainFrame()) | 283 if (m_frame->isMainFrame()) |
| 284 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); | 284 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); |
| 285 | 285 |
| 286 client()->didUpdateCurrentHistoryItem(); | 286 client()->didUpdateCurrentHistoryItem(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void FrameLoader::dispatchUnloadEvent() { | 289 void FrameLoader::dispatchUnloadEvent() { |
| 290 NavigationDisablerForUnload navigationDisabler; | 290 FrameNavigationDisabler navigationDisabler(*m_frame); |
| 291 | 291 |
| 292 // If the frame is unloading, the provisional loader should no longer be | 292 // If the frame is unloading, the provisional loader should no longer be |
| 293 // protected. It will be detached soon. | 293 // protected. It will be detached soon. |
| 294 m_protectProvisionalLoader = false; | 294 m_protectProvisionalLoader = false; |
| 295 saveScrollState(); | 295 saveScrollState(); |
| 296 | 296 |
| 297 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document())) | 297 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document())) |
| 298 m_frame->document()->dispatchUnloadEvents(); | 298 m_frame->document()->dispatchUnloadEvents(); |
| 299 } | 299 } |
| 300 | 300 |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 } | 1086 } |
| 1087 return policy; | 1087 return policy; |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 void FrameLoader::load(const FrameLoadRequest& passedRequest, | 1090 void FrameLoader::load(const FrameLoadRequest& passedRequest, |
| 1091 FrameLoadType frameLoadType, | 1091 FrameLoadType frameLoadType, |
| 1092 HistoryItem* historyItem, | 1092 HistoryItem* historyItem, |
| 1093 HistoryLoadType historyLoadType) { | 1093 HistoryLoadType historyLoadType) { |
| 1094 DCHECK(m_frame->document()); | 1094 DCHECK(m_frame->document()); |
| 1095 | 1095 |
| 1096 if (!m_frame->isNavigationAllowed()) | |
| 1097 return; | |
| 1098 | |
| 1099 if (m_inStopAllLoaders) | 1096 if (m_inStopAllLoaders) |
| 1100 return; | 1097 return; |
| 1101 | 1098 |
| 1102 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { | 1099 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { |
| 1103 m_deferredHistoryLoad = DeferredHistoryLoad::create( | 1100 m_deferredHistoryLoad = DeferredHistoryLoad::create( |
| 1104 passedRequest.resourceRequest(), historyItem, frameLoadType, | 1101 passedRequest.resourceRequest(), historyItem, frameLoadType, |
| 1105 historyLoadType); | 1102 historyLoadType); |
| 1106 return; | 1103 return; |
| 1107 } | 1104 } |
| 1108 | 1105 |
| 1109 FrameLoadRequest request(passedRequest); | 1106 FrameLoadRequest request(passedRequest); |
| 1110 request.resourceRequest().setHasUserGesture( | 1107 request.resourceRequest().setHasUserGesture( |
| 1111 UserGestureIndicator::processingUserGesture()); | 1108 UserGestureIndicator::processingUserGesture()); |
| 1112 | 1109 |
| 1113 if (!prepareRequestForThisFrame(request)) | 1110 if (!prepareRequestForThisFrame(request)) |
| 1114 return; | 1111 return; |
| 1115 | 1112 |
| 1116 if (isBackForwardLoadType(frameLoadType)) { | 1113 if (isBackForwardLoadType(frameLoadType)) { |
| 1117 DCHECK(historyItem); | 1114 DCHECK(historyItem); |
| 1118 m_provisionalItem = historyItem; | 1115 m_provisionalItem = historyItem; |
| 1119 } | 1116 } |
| 1120 | 1117 |
| 1121 // Form submissions appear to need their special-case of finding the target at | 1118 // Form submissions appear to need their special-case of finding the target at |
| 1122 // schedule rather than at fire. | 1119 // schedule rather than at fire. |
| 1123 Frame* targetFrame = request.form() | 1120 Frame* targetFrame = request.form() |
| 1124 ? nullptr | 1121 ? nullptr |
| 1125 : m_frame->findFrameForNavigation( | 1122 : m_frame->findFrameForNavigation( |
| 1126 AtomicString(request.frameName()), *m_frame); | 1123 AtomicString(request.frameName()), *m_frame); |
| 1124 |
| 1125 if (targetFrame && targetFrame->isLocalFrame() && |
| 1126 !toLocalFrame(targetFrame)->isNavigationAllowed()) { |
| 1127 return; |
| 1128 } |
| 1129 |
| 1127 NavigationPolicy policy = navigationPolicyForRequest(request); | 1130 NavigationPolicy policy = navigationPolicyForRequest(request); |
| 1128 if (targetFrame && targetFrame != m_frame && | 1131 if (targetFrame && targetFrame != m_frame && |
| 1129 shouldNavigateTargetFrame(policy)) { | 1132 shouldNavigateTargetFrame(policy)) { |
| 1130 bool wasInSamePage = targetFrame->page() == m_frame->page(); | 1133 bool wasInSamePage = targetFrame->page() == m_frame->page(); |
| 1131 | 1134 |
| 1132 request.setFrameName("_self"); | 1135 request.setFrameName("_self"); |
| 1133 targetFrame->navigate(request); | 1136 targetFrame->navigate(request); |
| 1134 Page* page = targetFrame->page(); | 1137 Page* page = targetFrame->page(); |
| 1135 if (!wasInSamePage && page) | 1138 if (!wasInSamePage && page) |
| 1136 page->chromeClient().focus(); | 1139 page->chromeClient().focus(); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 for (Frame* child = m_frame->tree().firstChild(); child; | 1555 for (Frame* child = m_frame->tree().firstChild(); child; |
| 1553 child = child->tree().traverseNext(m_frame)) { | 1556 child = child->tree().traverseNext(m_frame)) { |
| 1554 // FIXME: There is not yet any way to dispatch events to out-of-process | 1557 // FIXME: There is not yet any way to dispatch events to out-of-process |
| 1555 // frames. | 1558 // frames. |
| 1556 if (child->isLocalFrame()) | 1559 if (child->isLocalFrame()) |
| 1557 targetFrames.append(toLocalFrame(child)); | 1560 targetFrames.append(toLocalFrame(child)); |
| 1558 } | 1561 } |
| 1559 | 1562 |
| 1560 bool shouldClose = false; | 1563 bool shouldClose = false; |
| 1561 { | 1564 { |
| 1562 NavigationDisablerForUnload navigationDisabler; | 1565 NavigationDisablerForBeforeUnload navigationDisabler; |
| 1563 size_t i; | 1566 size_t i; |
| 1564 | 1567 |
| 1565 bool didAllowNavigation = false; | 1568 bool didAllowNavigation = false; |
| 1566 for (i = 0; i < targetFrames.size(); i++) { | 1569 for (i = 0; i < targetFrames.size(); i++) { |
| 1567 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1570 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
| 1568 continue; | 1571 continue; |
| 1569 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( | 1572 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( |
| 1570 page->chromeClient(), isReload, didAllowNavigation)) | 1573 page->chromeClient(), isReload, didAllowNavigation)) |
| 1571 break; | 1574 break; |
| 1572 } | 1575 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 m_documentLoader ? m_documentLoader->url() : String()); | 1960 m_documentLoader ? m_documentLoader->url() : String()); |
| 1958 return tracedValue; | 1961 return tracedValue; |
| 1959 } | 1962 } |
| 1960 | 1963 |
| 1961 inline void FrameLoader::takeObjectSnapshot() const { | 1964 inline void FrameLoader::takeObjectSnapshot() const { |
| 1962 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1965 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1963 toTracedValue()); | 1966 toTracedValue()); |
| 1964 } | 1967 } |
| 1965 | 1968 |
| 1966 } // namespace blink | 1969 } // namespace blink |
| OLD | NEW |