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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) | 657 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) |
658 return FrameLoadTypeInitialInChildFrame; | 658 return FrameLoadTypeInitialInChildFrame; |
659 if (!m_frame->tree().parent() && !client()->backForwardLength()) | 659 if (!m_frame->tree().parent() && !client()->backForwardLength()) |
660 return FrameLoadTypeStandard; | 660 return FrameLoadTypeStandard; |
661 if (m_provisionalDocumentLoader && request.substituteData().failingURL() ==
m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward) | 661 if (m_provisionalDocumentLoader && request.substituteData().failingURL() ==
m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward) |
662 return FrameLoadTypeBackForward; | 662 return FrameLoadTypeBackForward; |
663 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) | 663 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) |
664 return FrameLoadTypeReload; | 664 return FrameLoadTypeReload; |
665 if (request.resourceRequest().cachePolicy() == ReloadBypassingCache) | 665 if (request.resourceRequest().cachePolicy() == ReloadBypassingCache) |
666 return FrameLoadTypeReloadFromOrigin; | 666 return FrameLoadTypeReloadFromOrigin; |
667 // From the HTML5 spec for location.assign(): | 667 if (request.lockBackForwardList()) |
668 // "If the browsing context's session history contains only one Document, | |
669 // and that was the about:blank Document created when the browsing context | |
670 // was created, then the navigation must be done with replacement enabled.
" | |
671 if (request.lockBackForwardList() | |
672 || (!m_stateMachine.committedMultipleRealLoads() | |
673 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) | |
674 return FrameLoadTypeRedirectWithLockedBackForwardList; | 668 return FrameLoadTypeRedirectWithLockedBackForwardList; |
675 if (!request.originDocument() && request.resourceRequest().url() == m_docume
ntLoader->urlForHistory()) | 669 if (!request.originDocument() && request.resourceRequest().url() == m_docume
ntLoader->urlForHistory()) |
676 return FrameLoadTypeSame; | 670 return FrameLoadTypeSame; |
677 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) | 671 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) |
678 return FrameLoadTypeReload; | 672 return FrameLoadTypeReload; |
679 return FrameLoadTypeStandard; | 673 return FrameLoadTypeStandard; |
680 } | 674 } |
681 | 675 |
682 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) | 676 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) |
683 { | 677 { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 { | 1204 { |
1211 ASSERT(client()->hasWebView()); | 1205 ASSERT(client()->hasWebView()); |
1212 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1206 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
1213 return; | 1207 return; |
1214 | 1208 |
1215 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); | 1209 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); |
1216 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); | 1210 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); |
1217 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); | 1211 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); |
1218 ResourceRequest& request = frameLoadRequest.resourceRequest(); | 1212 ResourceRequest& request = frameLoadRequest.resourceRequest(); |
1219 | 1213 |
| 1214 // The current load should replace the history item if it is the first real |
| 1215 // load of the frame. |
| 1216 bool replacesCurrentHistoryItem = false; |
| 1217 if (type == FrameLoadTypeRedirectWithLockedBackForwardList |
| 1218 || !m_stateMachine.committedFirstRealDocumentLoad()) { |
| 1219 replacesCurrentHistoryItem = true; |
| 1220 } |
| 1221 |
1220 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr
ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() :
defaultSubstituteDataForURL(request.url())); | 1222 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr
ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() :
defaultSubstituteDataForURL(request.url())); |
1221 m_policyDocumentLoader->setNavigationType(navigationType); | 1223 m_policyDocumentLoader->setNavigationType(navigationType); |
1222 m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeR
edirectWithLockedBackForwardList); | 1224 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory
Item); |
1223 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect(
) == ClientRedirect); | 1225 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect(
) == ClientRedirect); |
1224 | 1226 |
1225 // stopAllLoaders can detach the LocalFrame, so protect it. | 1227 // stopAllLoaders can detach the LocalFrame, so protect it. |
1226 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1228 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1227 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra
meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) ||
!shouldClose()) && m_policyDocumentLoader) { | 1229 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra
meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) ||
!shouldClose()) && m_policyDocumentLoader) { |
1228 m_policyDocumentLoader->detachFromFrame(); | 1230 m_policyDocumentLoader->detachFromFrame(); |
1229 m_policyDocumentLoader = nullptr; | 1231 m_policyDocumentLoader = nullptr; |
1230 return; | 1232 return; |
1231 } | 1233 } |
1232 | 1234 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 // FIXME: We need a way to propagate insecure requests policy flags to | 1444 // FIXME: We need a way to propagate insecure requests policy flags to |
1443 // out-of-process frames. For now, we'll always use default behavior. | 1445 // out-of-process frames. For now, we'll always use default behavior. |
1444 if (!parentFrame->isLocalFrame()) | 1446 if (!parentFrame->isLocalFrame()) |
1445 return nullptr; | 1447 return nullptr; |
1446 | 1448 |
1447 ASSERT(toLocalFrame(parentFrame)->document()); | 1449 ASSERT(toLocalFrame(parentFrame)->document()); |
1448 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1450 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1449 } | 1451 } |
1450 | 1452 |
1451 } // namespace blink | 1453 } // namespace blink |
OLD | NEW |