| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 m_currentItem->setVisualViewportScrollOffset(toScrollOffset( | 281 m_currentItem->setVisualViewportScrollOffset(toScrollOffset( |
| 282 m_frame->host()->visualViewport().visibleRect().location())); | 282 m_frame->host()->visualViewport().visibleRect().location())); |
| 283 | 283 |
| 284 if (m_frame->isMainFrame()) | 284 if (m_frame->isMainFrame()) |
| 285 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); | 285 m_currentItem->setPageScaleFactor(m_frame->page()->pageScaleFactor()); |
| 286 | 286 |
| 287 client()->didUpdateCurrentHistoryItem(); | 287 client()->didUpdateCurrentHistoryItem(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void FrameLoader::dispatchUnloadEvent() { | 290 void FrameLoader::dispatchUnloadEvent() { |
| 291 NavigationDisablerForUnload navigationDisabler; | 291 FrameNavigationDisabler navigationDisabler(*m_frame); |
| 292 | 292 |
| 293 // If the frame is unloading, the provisional loader should no longer be | 293 // If the frame is unloading, the provisional loader should no longer be |
| 294 // protected. It will be detached soon. | 294 // protected. It will be detached soon. |
| 295 m_protectProvisionalLoader = false; | 295 m_protectProvisionalLoader = false; |
| 296 saveScrollState(); | 296 saveScrollState(); |
| 297 | 297 |
| 298 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document())) | 298 if (m_frame->document() && !SVGImage::isInSVGImage(m_frame->document())) |
| 299 m_frame->document()->dispatchUnloadEvents(); | 299 m_frame->document()->dispatchUnloadEvents(); |
| 300 } | 300 } |
| 301 | 301 |
| (...skipping 784 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()) | 1096 if (isBackForwardLoadType(frameLoadType) && !m_frame->isNavigationAllowed()) |
| 1097 return; | 1097 return; |
| 1098 | 1098 |
| 1099 if (m_inStopAllLoaders) | 1099 if (m_inStopAllLoaders) |
| 1100 return; | 1100 return; |
| 1101 | 1101 |
| 1102 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { | 1102 if (m_frame->page()->suspended() && isBackForwardLoadType(frameLoadType)) { |
| 1103 m_deferredHistoryLoad = DeferredHistoryLoad::create( | 1103 m_deferredHistoryLoad = DeferredHistoryLoad::create( |
| 1104 passedRequest.resourceRequest(), historyItem, frameLoadType, | 1104 passedRequest.resourceRequest(), historyItem, frameLoadType, |
| 1105 historyLoadType); | 1105 historyLoadType); |
| 1106 return; | 1106 return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1117 DCHECK(historyItem); | 1117 DCHECK(historyItem); |
| 1118 m_provisionalItem = historyItem; | 1118 m_provisionalItem = historyItem; |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 // Form submissions appear to need their special-case of finding the target at | 1121 // Form submissions appear to need their special-case of finding the target at |
| 1122 // schedule rather than at fire. | 1122 // schedule rather than at fire. |
| 1123 Frame* targetFrame = request.form() | 1123 Frame* targetFrame = request.form() |
| 1124 ? nullptr | 1124 ? nullptr |
| 1125 : m_frame->findFrameForNavigation( | 1125 : m_frame->findFrameForNavigation( |
| 1126 AtomicString(request.frameName()), *m_frame); | 1126 AtomicString(request.frameName()), *m_frame); |
| 1127 |
| 1128 if (targetFrame && targetFrame->isLocalFrame() && |
| 1129 !toLocalFrame(targetFrame)->isNavigationAllowed()) { |
| 1130 return; |
| 1131 } |
| 1132 |
| 1127 NavigationPolicy policy = navigationPolicyForRequest(request); | 1133 NavigationPolicy policy = navigationPolicyForRequest(request); |
| 1128 if (targetFrame && targetFrame != m_frame && | 1134 if (targetFrame && targetFrame != m_frame && |
| 1129 shouldNavigateTargetFrame(policy)) { | 1135 shouldNavigateTargetFrame(policy)) { |
| 1130 bool wasInSamePage = targetFrame->page() == m_frame->page(); | 1136 bool wasInSamePage = targetFrame->page() == m_frame->page(); |
| 1131 | 1137 |
| 1132 request.setFrameName("_self"); | 1138 request.setFrameName("_self"); |
| 1133 targetFrame->navigate(request); | 1139 targetFrame->navigate(request); |
| 1134 Page* page = targetFrame->page(); | 1140 Page* page = targetFrame->page(); |
| 1135 if (!wasInSamePage && page) | 1141 if (!wasInSamePage && page) |
| 1136 page->chromeClient().focus(); | 1142 page->chromeClient().focus(); |
| 1137 return; | 1143 return; |
| 1138 } | 1144 } |
| 1139 | 1145 |
| 1140 setReferrerForFrameRequest(request); | 1146 setReferrerForFrameRequest(request); |
| 1141 | 1147 |
| 1142 if (!targetFrame && !request.frameName().isEmpty()) { | 1148 if (!targetFrame && !request.frameName().isEmpty()) { |
| 1143 if (policy == NavigationPolicyDownload) { | 1149 if (policy == NavigationPolicyDownload) { |
| 1144 client()->loadURLExternally(request.resourceRequest(), | 1150 client()->loadURLExternally(request.resourceRequest(), |
| 1145 NavigationPolicyDownload, String(), false); | 1151 NavigationPolicyDownload, String(), false); |
| 1146 } else { | 1152 } else { |
| 1147 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary); | 1153 request.resourceRequest().setFrameType(WebURLRequest::FrameTypeAuxiliary); |
| 1148 createWindowForRequest(request, *m_frame, policy); | 1154 createWindowForRequest(request, *m_frame, policy); |
| 1149 } | 1155 } |
| 1150 return; | 1156 return; |
| 1151 } | 1157 } |
| 1152 | 1158 |
| 1159 if (!m_frame->isNavigationAllowed()) |
| 1160 return; |
| 1161 |
| 1153 const KURL& url = request.resourceRequest().url(); | 1162 const KURL& url = request.resourceRequest().url(); |
| 1154 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) | 1163 FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard) |
| 1155 ? determineFrameLoadType(request) | 1164 ? determineFrameLoadType(request) |
| 1156 : frameLoadType; | 1165 : frameLoadType; |
| 1157 bool sameDocumentHistoryNavigation = | 1166 bool sameDocumentHistoryNavigation = |
| 1158 isBackForwardLoadType(newLoadType) && | 1167 isBackForwardLoadType(newLoadType) && |
| 1159 historyLoadType == HistorySameDocumentLoad; | 1168 historyLoadType == HistorySameDocumentLoad; |
| 1160 bool sameDocumentNavigation = | 1169 bool sameDocumentNavigation = |
| 1161 policy == NavigationPolicyCurrentTab && | 1170 policy == NavigationPolicyCurrentTab && |
| 1162 shouldPerformFragmentNavigation(request.form(), | 1171 shouldPerformFragmentNavigation(request.form(), |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 for (Frame* child = m_frame->tree().firstChild(); child; | 1560 for (Frame* child = m_frame->tree().firstChild(); child; |
| 1552 child = child->tree().traverseNext(m_frame)) { | 1561 child = child->tree().traverseNext(m_frame)) { |
| 1553 // FIXME: There is not yet any way to dispatch events to out-of-process | 1562 // FIXME: There is not yet any way to dispatch events to out-of-process |
| 1554 // frames. | 1563 // frames. |
| 1555 if (child->isLocalFrame()) | 1564 if (child->isLocalFrame()) |
| 1556 targetFrames.append(toLocalFrame(child)); | 1565 targetFrames.append(toLocalFrame(child)); |
| 1557 } | 1566 } |
| 1558 | 1567 |
| 1559 bool shouldClose = false; | 1568 bool shouldClose = false; |
| 1560 { | 1569 { |
| 1561 NavigationDisablerForUnload navigationDisabler; | 1570 NavigationDisablerForBeforeUnload navigationDisabler; |
| 1562 size_t i; | 1571 size_t i; |
| 1563 | 1572 |
| 1564 bool didAllowNavigation = false; | 1573 bool didAllowNavigation = false; |
| 1565 for (i = 0; i < targetFrames.size(); i++) { | 1574 for (i = 0; i < targetFrames.size(); i++) { |
| 1566 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) | 1575 if (!targetFrames[i]->tree().isDescendantOf(m_frame)) |
| 1567 continue; | 1576 continue; |
| 1568 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( | 1577 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent( |
| 1569 page->chromeClient(), isReload, didAllowNavigation)) | 1578 page->chromeClient(), isReload, didAllowNavigation)) |
| 1570 break; | 1579 break; |
| 1571 } | 1580 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1892 m_documentLoader ? m_documentLoader->url() : String()); | 1901 m_documentLoader ? m_documentLoader->url() : String()); |
| 1893 return tracedValue; | 1902 return tracedValue; |
| 1894 } | 1903 } |
| 1895 | 1904 |
| 1896 inline void FrameLoader::takeObjectSnapshot() const { | 1905 inline void FrameLoader::takeObjectSnapshot() const { |
| 1897 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1906 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
| 1898 toTracedValue()); | 1907 toTracedValue()); |
| 1899 } | 1908 } |
| 1900 | 1909 |
| 1901 } // namespace blink | 1910 } // namespace blink |
| OLD | NEW |