| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 if (request.resourceRequest().cachePolicy() == ReloadBypassingCache) | 732 if (request.resourceRequest().cachePolicy() == ReloadBypassingCache) |
| 733 return FrameLoadTypeReloadFromOrigin; | 733 return FrameLoadTypeReloadFromOrigin; |
| 734 // From the HTML5 spec for location.assign(): | 734 // From the HTML5 spec for location.assign(): |
| 735 // "If the browsing context's session history contains only one Document, | 735 // "If the browsing context's session history contains only one Document, |
| 736 // and that was the about:blank Document created when the browsing context | 736 // and that was the about:blank Document created when the browsing context |
| 737 // was created, then the navigation must be done with replacement enabled.
" | 737 // was created, then the navigation must be done with replacement enabled.
" |
| 738 if (request.replacesCurrentItem() | 738 if (request.replacesCurrentItem() |
| 739 || (!m_stateMachine.committedMultipleRealLoads() | 739 || (!m_stateMachine.committedMultipleRealLoads() |
| 740 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) | 740 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) |
| 741 return FrameLoadTypeReplaceCurrentItem; | 741 return FrameLoadTypeReplaceCurrentItem; |
| 742 if (!request.originDocument() && request.resourceRequest().url() == m_docume
ntLoader->urlForHistory()) | 742 |
| 743 return FrameLoadTypeSame; | 743 if (request.resourceRequest().url() == m_documentLoader->urlForHistory()) { |
| 744 if (!request.originDocument()) |
| 745 return FrameLoadTypeSame; |
| 746 return request.resourceRequest().httpMethod() == "POST" ? FrameLoadTypeS
tandard : FrameLoadTypeReplaceCurrentItem; |
| 747 } |
| 748 |
| 744 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) | 749 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) |
| 745 return FrameLoadTypeReload; | 750 return FrameLoadTypeReload; |
| 746 return FrameLoadTypeStandard; | 751 return FrameLoadTypeStandard; |
| 747 } | 752 } |
| 748 | 753 |
| 749 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) | 754 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) |
| 750 { | 755 { |
| 751 // If no origin Document* was specified, skip remaining security checks and
assume the caller has fully initialized the FrameLoadRequest. | 756 // If no origin Document* was specified, skip remaining security checks and
assume the caller has fully initialized the FrameLoadRequest. |
| 752 if (!request.originDocument()) | 757 if (!request.originDocument()) |
| 753 return true; | 758 return true; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 newLoadType = FrameLoadTypeReplaceCurrentItem; | 915 newLoadType = FrameLoadTypeReplaceCurrentItem; |
| 911 } | 916 } |
| 912 | 917 |
| 913 loadInSameDocument(url, stateObject, newLoadType, request.clientRedirect
()); | 918 loadInSameDocument(url, stateObject, newLoadType, request.clientRedirect
()); |
| 914 | 919 |
| 915 if (sameDocumentHistoryNavigation) | 920 if (sameDocumentHistoryNavigation) |
| 916 restoreScrollPositionAndViewState(); | 921 restoreScrollPositionAndViewState(); |
| 917 return; | 922 return; |
| 918 } | 923 } |
| 919 | 924 |
| 920 // Perform navigation to a different document. | |
| 921 bool sameURL = url == m_documentLoader->urlForHistory(); | |
| 922 startLoad(request, newLoadType, policy); | 925 startLoad(request, newLoadType, policy); |
| 923 | |
| 924 // Example of this case are sites that reload the same URL with a different
cookie | |
| 925 // driving the generated content, or a master frame with links that drive a
target | |
| 926 // frame, where the user has clicked on the same link repeatedly. | |
| 927 if (sameURL | |
| 928 && !isBackForwardLoadType(frameLoadType) | |
| 929 && newLoadType != FrameLoadTypeReload | |
| 930 && newLoadType != FrameLoadTypeReloadFromOrigin | |
| 931 && request.resourceRequest().httpMethod() != "POST") { | |
| 932 m_loadType = FrameLoadTypeSame; | |
| 933 } | |
| 934 } | 926 } |
| 935 | 927 |
| 936 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) | 928 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) |
| 937 { | 929 { |
| 938 if (!shouldTreatURLAsSrcdocDocument(url)) | 930 if (!shouldTreatURLAsSrcdocDocument(url)) |
| 939 return SubstituteData(); | 931 return SubstituteData(); |
| 940 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr
); | 932 String srcdoc = m_frame->deprecatedLocalOwner()->fastGetAttribute(srcdocAttr
); |
| 941 ASSERT(!srcdoc.isNull()); | 933 ASSERT(!srcdoc.isNull()); |
| 942 CString encodedSrcdoc = srcdoc.utf8(); | 934 CString encodedSrcdoc = srcdoc.utf8(); |
| 943 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); | 935 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 // FIXME: We need a way to propagate insecure requests policy flags to | 1486 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1495 // out-of-process frames. For now, we'll always use default behavior. | 1487 // out-of-process frames. For now, we'll always use default behavior. |
| 1496 if (!parentFrame->isLocalFrame()) | 1488 if (!parentFrame->isLocalFrame()) |
| 1497 return nullptr; | 1489 return nullptr; |
| 1498 | 1490 |
| 1499 ASSERT(toLocalFrame(parentFrame)->document()); | 1491 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1500 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1492 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1501 } | 1493 } |
| 1502 | 1494 |
| 1503 } // namespace blink | 1495 } // namespace blink |
| OLD | NEW |