| 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 } | 1080 } |
| 1081 return policy; | 1081 return policy; |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 void FrameLoader::load(const FrameLoadRequest& passedRequest, | 1084 void FrameLoader::load(const FrameLoadRequest& passedRequest, |
| 1085 FrameLoadType frameLoadType, | 1085 FrameLoadType frameLoadType, |
| 1086 HistoryItem* historyItem, | 1086 HistoryItem* historyItem, |
| 1087 HistoryLoadType historyLoadType) { | 1087 HistoryLoadType historyLoadType) { |
| 1088 DCHECK(m_frame->document()); | 1088 DCHECK(m_frame->document()); |
| 1089 | 1089 |
| 1090 if (!m_frame->isNavigationAllowed()) | 1090 if (isBackForwardLoadType(frameLoadType) && !m_frame->isNavigationAllowed()) |
| 1091 return; | 1091 return; |
| 1092 | 1092 |
| 1093 if (m_inStopAllLoaders) | 1093 if (m_inStopAllLoaders) |
| 1094 return; | 1094 return; |
| 1095 | 1095 |
| 1096 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { | 1096 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { |
| 1097 m_deferredHistoryLoad = DeferredHistoryLoad::create( | 1097 m_deferredHistoryLoad = DeferredHistoryLoad::create( |
| 1098 passedRequest.resourceRequest(), historyItem, frameLoadType, | 1098 passedRequest.resourceRequest(), historyItem, frameLoadType, |
| 1099 historyLoadType); | 1099 historyLoadType); |
| 1100 return; | 1100 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1111 DCHECK(historyItem); | 1111 DCHECK(historyItem); |
| 1112 m_provisionalItem = historyItem; | 1112 m_provisionalItem = historyItem; |
| 1113 } | 1113 } |
| 1114 | 1114 |
| 1115 // Form submissions appear to need their special-case of finding the target at | 1115 // Form submissions appear to need their special-case of finding the target at |
| 1116 // schedule rather than at fire. | 1116 // schedule rather than at fire. |
| 1117 Frame* targetFrame = request.form() | 1117 Frame* targetFrame = request.form() |
| 1118 ? nullptr | 1118 ? nullptr |
| 1119 : m_frame->findFrameForNavigation( | 1119 : m_frame->findFrameForNavigation( |
| 1120 AtomicString(request.frameName()), *m_frame); | 1120 AtomicString(request.frameName()), *m_frame); |
| 1121 |
| 1121 NavigationPolicy policy = navigationPolicyForRequest(request); | 1122 NavigationPolicy policy = navigationPolicyForRequest(request); |
| 1122 if (targetFrame && targetFrame != m_frame && | 1123 if (targetFrame && targetFrame != m_frame && |
| 1123 shouldNavigateTargetFrame(policy)) { | 1124 shouldNavigateTargetFrame(policy)) { |
| 1125 if (targetFrame->isLocalFrame() && |
| 1126 !toLocalFrame(targetFrame)->isNavigationAllowed()) { |
| 1127 return; |
| 1128 } |
| 1129 |
| 1124 bool wasInSamePage = targetFrame->page() == m_frame->page(); | 1130 bool wasInSamePage = targetFrame->page() == m_frame->page(); |
| 1125 | 1131 |
| 1126 request.setFrameName("_self"); | 1132 request.setFrameName("_self"); |
| 1127 targetFrame->navigate(request); | 1133 targetFrame->navigate(request); |
| 1128 Page* page = targetFrame->page(); | 1134 Page* page = targetFrame->page(); |
| 1129 if (!wasInSamePage && page) | 1135 if (!wasInSamePage && page) |
| 1130 page->chromeClient().focus(); | 1136 page->chromeClient().focus(); |
| 1131 return; | 1137 return; |
| 1132 } | 1138 } |
| 1133 | 1139 |
| 1134 setReferrerForFrameRequest(request); | 1140 setReferrerForFrameRequest(request); |
| 1135 | 1141 |
| 1136 if (!targetFrame && !request.frameName().isEmpty()) { | 1142 if (!targetFrame && !request.frameName().isEmpty()) { |
| 1137 if (policy == NavigationPolicyDownload) { | 1143 if (policy == NavigationPolicyDownload) { |
| 1138 client()->loadURLExternally(request.resourceRequest(), | 1144 client()->loadURLExternally(request.resourceRequest(), |
| 1139 NavigationPolicyDownload, String(), false); | 1145 NavigationPolicyDownload, String(), false); |
| 1140 } else { | 1146 } else { |
| 1141 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary); | 1147 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary); |
| 1142 createWindowForRequest(request, *m_frame, policy); | 1148 createWindowForRequest(request, *m_frame, policy); |
| 1143 } | 1149 } |
| 1144 return; | 1150 return; |
| 1145 } | 1151 } |
| 1146 | 1152 |
| 1153 if (!m_frame->isNavigationAllowed()) |
| 1154 return; |
| 1155 |
| 1147 const KURL& url = request.resourceRequest().url(); | 1156 const KURL& url = request.resourceRequest().url(); |
| 1148 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) | 1157 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) |
| 1149 ? determineFrameLoadType(request) | 1158 ? determineFrameLoadType(request) |
| 1150 : frameLoadType; | 1159 : frameLoadType; |
| 1151 bool sameDocumentHistoryNavigation = | 1160 bool sameDocumentHistoryNavigation = |
| 1152 isBackForwardLoadType(newLoadType) && | 1161 isBackForwardLoadType(newLoadType) && |
| 1153 historyLoadType == HistorySameDocumentLoad; | 1162 historyLoadType == HistorySameDocumentLoad; |
| 1154 bool sameDocumentNavigation = | 1163 bool sameDocumentNavigation = |
| 1155 policy == NavigationPolicyCurrentTab && | 1164 policy == NavigationPolicyCurrentTab && |
| 1156 shouldPerformFragmentNavigation(request.form(), | 1165 shouldPerformFragmentNavigation(request.form(), |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 for (Frame* child = m_frame->tree().firstChild(); child; | 1555 for (Frame* child = m_frame->tree().firstChild(); child; |
| 1547 child = child->tree().traverseNext(m_frame)) { | 1556 child = child->tree().traverseNext(m_frame)) { |
| 1548 // 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 |
| 1549 // frames. | 1558 // frames. |
| 1550 if (child->isLocalFrame()) | 1559 if (child->isLocalFrame()) |
| 1551 targetFrames.append(toLocalFrame(child)); | 1560 targetFrames.append(toLocalFrame(child)); |
| 1552 } | 1561 } |
| 1553 | 1562 |
| 1554 bool shouldClose = false; | 1563 bool shouldClose = false; |
| 1555 { | 1564 { |
| 1556 NavigationDisablerForUnload navigationDisabler; | 1565 NavigationDisablerForBeforeUnload navigationDisabler; |
| 1557 size_t i; | 1566 size_t i; |
| 1558 | 1567 |
| 1559 bool didAllowNavigation = false; | 1568 bool didAllowNavigation = false; |
| 1560 for (i = 0; i < targetFrames.size(); i++) { | 1569 for (i = 0; i < targetFrames.size(); i++) { |
| 1561 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1570 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
| 1562 continue; | 1571 continue; |
| 1563 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( | 1572 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( |
| 1564 page->chromeClient(), isReload, didAllowNavigation)) | 1573 page->chromeClient(), isReload, didAllowNavigation)) |
| 1565 break; | 1574 break; |
| 1566 } | 1575 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 m_documentLoader ? m_documentLoader->url() : String()); | 1960 m_documentLoader ? m_documentLoader->url() : String()); |
| 1952 return tracedValue; | 1961 return tracedValue; |
| 1953 } | 1962 } |
| 1954 | 1963 |
| 1955 inline void FrameLoader::takeObjectSnapshot() const { | 1964 inline void FrameLoader::takeObjectSnapshot() const { |
| 1956 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1965 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1957 toTracedValue()); | 1966 toTracedValue()); |
| 1958 } | 1967 } |
| 1959 | 1968 |
| 1960 } // namespace blink | 1969 } // namespace blink |
| OLD | NEW |