| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "platform/Logging.h" | 85 #include "platform/Logging.h" |
| 86 #include "platform/PluginScriptForbiddenScope.h" | 86 #include "platform/PluginScriptForbiddenScope.h" |
| 87 #include "platform/ScriptForbiddenScope.h" | 87 #include "platform/ScriptForbiddenScope.h" |
| 88 #include "platform/UserGestureIndicator.h" | 88 #include "platform/UserGestureIndicator.h" |
| 89 #include "platform/network/HTTPParsers.h" | 89 #include "platform/network/HTTPParsers.h" |
| 90 #include "platform/network/ResourceRequest.h" | 90 #include "platform/network/ResourceRequest.h" |
| 91 #include "platform/scroll/ScrollAnimatorBase.h" | 91 #include "platform/scroll/ScrollAnimatorBase.h" |
| 92 #include "platform/weborigin/SecurityOrigin.h" | 92 #include "platform/weborigin/SecurityOrigin.h" |
| 93 #include "platform/weborigin/SecurityPolicy.h" | 93 #include "platform/weborigin/SecurityPolicy.h" |
| 94 #include "platform/weborigin/Suborigin.h" | 94 #include "platform/weborigin/Suborigin.h" |
| 95 #include "public/platform/WebCachePolicy.h" |
| 95 #include "public/platform/WebURLRequest.h" | 96 #include "public/platform/WebURLRequest.h" |
| 96 #include "wtf/TemporaryChange.h" | 97 #include "wtf/TemporaryChange.h" |
| 97 #include "wtf/text/CString.h" | 98 #include "wtf/text/CString.h" |
| 98 #include "wtf/text/WTFString.h" | 99 #include "wtf/text/WTFString.h" |
| 99 | 100 |
| 100 using blink::WebURLRequest; | 101 using blink::WebURLRequest; |
| 101 | 102 |
| 102 namespace blink { | 103 namespace blink { |
| 103 | 104 |
| 104 using namespace HTMLNames; | 105 using namespace HTMLNames; |
| 105 | 106 |
| 106 bool isBackForwardLoadType(FrameLoadType type) | 107 bool isBackForwardLoadType(FrameLoadType type) |
| 107 { | 108 { |
| 108 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto
ryLoad; | 109 return type == FrameLoadTypeBackForward || type == FrameLoadTypeInitialHisto
ryLoad; |
| 109 } | 110 } |
| 110 | 111 |
| 111 static bool needsHistoryItemRestore(FrameLoadType type) | 112 static bool needsHistoryItemRestore(FrameLoadType type) |
| 112 { | 113 { |
| 113 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload | 114 return type == FrameLoadTypeBackForward || type == FrameLoadTypeReload |
| 114 || type == FrameLoadTypeReloadBypassingCache; | 115 || type == FrameLoadTypeReloadBypassingCache; |
| 115 } | 116 } |
| 116 | 117 |
| 117 // static | 118 // static |
| 118 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, | 119 ResourceRequest FrameLoader::resourceRequestFromHistoryItem(HistoryItem* item, W
ebCachePolicy cachePolicy) |
| 119 ResourceRequestCachePolicy cachePolicy) | |
| 120 { | 120 { |
| 121 RefPtr<EncodedFormData> formData = item->formData(); | 121 RefPtr<EncodedFormData> formData = item->formData(); |
| 122 ResourceRequest request(item->url()); | 122 ResourceRequest request(item->url()); |
| 123 request.setHTTPReferrer(item->referrer()); | 123 request.setHTTPReferrer(item->referrer()); |
| 124 request.setCachePolicy(cachePolicy); | 124 request.setCachePolicy(cachePolicy); |
| 125 if (formData) { | 125 if (formData) { |
| 126 request.setHTTPMethod(HTTPNames::POST); | 126 request.setHTTPMethod(HTTPNames::POST); |
| 127 request.setHTTPBody(formData); | 127 request.setHTTPBody(formData); |
| 128 request.setHTTPContentType(item->formContentType()); | 128 request.setHTTPContentType(item->formContentType()); |
| 129 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer().referrer); | 129 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer().referrer); |
| 130 request.addHTTPOriginIfNeeded(securityOrigin); | 130 request.addHTTPOriginIfNeeded(securityOrigin); |
| 131 } | 131 } |
| 132 return request; | 132 return request; |
| 133 } | 133 } |
| 134 | 134 |
| 135 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp
e, | 135 ResourceRequest FrameLoader::resourceRequestForReload(FrameLoadType frameLoadTyp
e, |
| 136 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy) | 136 const KURL& overrideURL, ClientRedirectPolicy clientRedirectPolicy) |
| 137 { | 137 { |
| 138 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp
eReloadBypassingCache); | 138 ASSERT(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTyp
eReloadBypassingCache); |
| 139 ResourceRequestCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloa
dBypassingCache ? BypassingCache : ValidatingCacheData; | 139 WebCachePolicy cachePolicy = frameLoadType == FrameLoadTypeReloadBypassingCa
che ? WebCachePolicy::BypassingCache : WebCachePolicy::ValidatingCacheData; |
| 140 if (!m_currentItem) | 140 if (!m_currentItem) |
| 141 return ResourceRequest(); | 141 return ResourceRequest(); |
| 142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); | 142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); |
| 143 | 143 |
| 144 // ClientRedirectPolicy is an indication that this load was triggered by | 144 // ClientRedirectPolicy is an indication that this load was triggered by |
| 145 // some direct interaction with the page. If this reload is not a client | 145 // some direct interaction with the page. If this reload is not a client |
| 146 // redirect, we should reuse the referrer from the original load of the | 146 // redirect, we should reuse the referrer from the original load of the |
| 147 // current document. If this reload is a client redirect (e.g., location.rel
oad()), | 147 // current document. If this reload is a client redirect (e.g., location.rel
oad()), |
| 148 // it was initiated by something in the current document and should | 148 // it was initiated by something in the current document and should |
| 149 // therefore show the current document's url as the referrer. | 149 // therefore show the current document's url as the referrer. |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
t) | 760 FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
t) |
| 761 { | 761 { |
| 762 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) | 762 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) |
| 763 return FrameLoadTypeInitialInChildFrame; | 763 return FrameLoadTypeInitialInChildFrame; |
| 764 if (!m_frame->tree().parent() && !client()->backForwardLength()) | 764 if (!m_frame->tree().parent() && !client()->backForwardLength()) |
| 765 return FrameLoadTypeStandard; | 765 return FrameLoadTypeStandard; |
| 766 if (m_provisionalDocumentLoader && request.substituteData().failingURL() ==
m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward) | 766 if (m_provisionalDocumentLoader && request.substituteData().failingURL() ==
m_provisionalDocumentLoader->url() && m_loadType == FrameLoadTypeBackForward) |
| 767 return FrameLoadTypeBackForward; | 767 return FrameLoadTypeBackForward; |
| 768 if (request.resourceRequest().getCachePolicy() == ValidatingCacheData) | 768 if (request.resourceRequest().getCachePolicy() == WebCachePolicy::Validating
CacheData) |
| 769 return FrameLoadTypeReload; | 769 return FrameLoadTypeReload; |
| 770 if (request.resourceRequest().getCachePolicy() == BypassingCache) | 770 if (request.resourceRequest().getCachePolicy() == WebCachePolicy::BypassingC
ache) |
| 771 return FrameLoadTypeReloadBypassingCache; | 771 return FrameLoadTypeReloadBypassingCache; |
| 772 // From the HTML5 spec for location.assign(): | 772 // From the HTML5 spec for location.assign(): |
| 773 // "If the browsing context's session history contains only one Document, | 773 // "If the browsing context's session history contains only one Document, |
| 774 // and that was the about:blank Document created when the browsing context | 774 // and that was the about:blank Document created when the browsing context |
| 775 // was created, then the navigation must be done with replacement enabled.
" | 775 // was created, then the navigation must be done with replacement enabled.
" |
| 776 if (request.replacesCurrentItem() | 776 if (request.replacesCurrentItem() |
| 777 || (!m_stateMachine.committedMultipleRealLoads() | 777 || (!m_stateMachine.committedMultipleRealLoads() |
| 778 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) | 778 && equalIgnoringCase(m_frame->document()->url(), blankURL()))) |
| 779 return FrameLoadTypeReplaceCurrentItem; | 779 return FrameLoadTypeReplaceCurrentItem; |
| 780 | 780 |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 // FIXME: We need a way to propagate insecure requests policy flags to | 1563 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1564 // out-of-process frames. For now, we'll always use default behavior. | 1564 // out-of-process frames. For now, we'll always use default behavior. |
| 1565 if (!parentFrame->isLocalFrame()) | 1565 if (!parentFrame->isLocalFrame()) |
| 1566 return nullptr; | 1566 return nullptr; |
| 1567 | 1567 |
| 1568 ASSERT(toLocalFrame(parentFrame)->document()); | 1568 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1569 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1569 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 } // namespace blink | 1572 } // namespace blink |
| OLD | NEW |