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 if (request.lockBackForwardList()) | 667 // From the HTML5 spec for location.assign(): |
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()))) | |
668 return FrameLoadTypeRedirectWithLockedBackForwardList; | 674 return FrameLoadTypeRedirectWithLockedBackForwardList; |
669 if (!request.originDocument() && request.resourceRequest().url() == m_docume ntLoader->urlForHistory()) | 675 if (!request.originDocument() && request.resourceRequest().url() == m_docume ntLoader->urlForHistory()) |
670 return FrameLoadTypeSame; | 676 return FrameLoadTypeSame; |
671 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory () && m_loadType == FrameLoadTypeReload) | 677 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory () && m_loadType == FrameLoadTypeReload) |
672 return FrameLoadTypeReload; | 678 return FrameLoadTypeReload; |
673 return FrameLoadTypeStandard; | 679 return FrameLoadTypeStandard; |
674 } | 680 } |
675 | 681 |
676 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) | 682 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) |
677 { | 683 { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1204 { | 1210 { |
1205 ASSERT(client()->hasWebView()); | 1211 ASSERT(client()->hasWebView()); |
1206 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) | 1212 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) |
1207 return; | 1213 return; |
1208 | 1214 |
1209 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent()); | 1215 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent()); |
1210 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType)); | 1216 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType)); |
1211 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); | 1217 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); |
1212 ResourceRequest& request = frameLoadRequest.resourceRequest(); | 1218 ResourceRequest& request = frameLoadRequest.resourceRequest(); |
1213 | 1219 |
1214 // The current load should replace the history item if it is the first real | |
Charlie Reis
2015/06/11 16:43:48
This was Nasko's original fix from https://coderev
| |
1215 // load of the frame. | |
1216 bool replacesCurrentHistoryItem = false; | |
1217 if (type == FrameLoadTypeRedirectWithLockedBackForwardList | |
1218 || !m_stateMachine.committedFirstRealDocumentLoad()) { | |
1219 replacesCurrentHistoryItem = true; | |
1220 } | |
1221 | |
1222 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() : defaultSubstituteDataForURL(request.url())); | 1220 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, fr ameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData() : defaultSubstituteDataForURL(request.url())); |
1223 m_policyDocumentLoader->setNavigationType(navigationType); | 1221 m_policyDocumentLoader->setNavigationType(navigationType); |
1224 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); | 1222 m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeR edirectWithLockedBackForwardList); |
1225 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect( ) == ClientRedirect); | 1223 m_policyDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedirect( ) == ClientRedirect); |
1226 | 1224 |
1227 // stopAllLoaders can detach the LocalFrame, so protect it. | 1225 // stopAllLoaders can detach the LocalFrame, so protect it. |
1228 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1226 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1229 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) || !shouldClose()) && m_policyDocumentLoader) { | 1227 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, fra meLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), navigationPolicy) || !shouldClose()) && m_policyDocumentLoader) { |
1230 m_policyDocumentLoader->detachFromFrame(); | 1228 m_policyDocumentLoader->detachFromFrame(); |
1231 m_policyDocumentLoader = nullptr; | 1229 m_policyDocumentLoader = nullptr; |
1232 return; | 1230 return; |
1233 } | 1231 } |
1234 | 1232 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1444 // FIXME: We need a way to propagate insecure requests policy flags to | 1442 // FIXME: We need a way to propagate insecure requests policy flags to |
1445 // out-of-process frames. For now, we'll always use default behavior. | 1443 // out-of-process frames. For now, we'll always use default behavior. |
1446 if (!parentFrame->isLocalFrame()) | 1444 if (!parentFrame->isLocalFrame()) |
1447 return nullptr; | 1445 return nullptr; |
1448 | 1446 |
1449 ASSERT(toLocalFrame(parentFrame)->document()); | 1447 ASSERT(toLocalFrame(parentFrame)->document()); |
1450 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; | 1448 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; |
1451 } | 1449 } |
1452 | 1450 |
1453 } // namespace blink | 1451 } // namespace blink |
OLD | NEW |