OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 // If we're moving in the back/forward list, we might want to replace the | 1682 // If we're moving in the back/forward list, we might want to replace the |
1683 // content of this child frame with whatever was there at that point. | 1683 // content of this child frame with whatever was there at that point. |
1684 HistoryItem* childItem = nullptr; | 1684 HistoryItem* childItem = nullptr; |
1685 if (isBackForwardLoadType(frame()->loader().documentLoader()->loadType()) && | 1685 if (isBackForwardLoadType(frame()->loader().documentLoader()->loadType()) && |
1686 !frame()->document()->loadEventFinished()) | 1686 !frame()->document()->loadEventFinished()) |
1687 childItem = webframeChild->client()->historyItemForNewChildFrame(); | 1687 childItem = webframeChild->client()->historyItemForNewChildFrame(); |
1688 | 1688 |
1689 FrameLoadRequest newRequest = request; | 1689 FrameLoadRequest newRequest = request; |
1690 FrameLoadType loadType = FrameLoadTypeStandard; | 1690 FrameLoadType loadType = FrameLoadTypeStandard; |
1691 if (childItem) { | 1691 if (childItem) { |
1692 newRequest = FrameLoadRequest( | 1692 newRequest = FrameLoadRequest(request.originDocument(), |
1693 request.originDocument(), | 1693 childItem->generateResourceRequest( |
1694 FrameLoader::resourceRequestFromHistoryItem( | 1694 WebCachePolicy::UseProtocolCachePolicy)); |
1695 childItem, WebCachePolicy::UseProtocolCachePolicy)); | |
1696 loadType = FrameLoadTypeInitialHistoryLoad; | 1695 loadType = FrameLoadTypeInitialHistoryLoad; |
1697 } | 1696 } |
1698 webframeChild->frame()->loader().load(newRequest, loadType, childItem); | 1697 webframeChild->frame()->loader().load(newRequest, loadType, childItem); |
1699 | 1698 |
1700 // Note a synchronous navigation (about:blank) would have already processed | 1699 // Note a synchronous navigation (about:blank) would have already processed |
1701 // onload, so it is possible for the child frame to have already been | 1700 // onload, so it is possible for the child frame to have already been |
1702 // detached by script in the page. | 1701 // detached by script in the page. |
1703 if (!webframeChild->parent()) | 1702 if (!webframeChild->parent()) |
1704 return nullptr; | 1703 return nullptr; |
1705 return webframeChild->frame(); | 1704 return webframeChild->frame(); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 if (!frame()) | 1998 if (!frame()) |
2000 return true; | 1999 return true; |
2001 | 2000 |
2002 return frame()->loader().shouldClose(isReload); | 2001 return frame()->loader().shouldClose(isReload); |
2003 } | 2002 } |
2004 | 2003 |
2005 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem( | 2004 WebURLRequest WebLocalFrameImpl::requestFromHistoryItem( |
2006 const WebHistoryItem& item, | 2005 const WebHistoryItem& item, |
2007 WebCachePolicy cachePolicy) const { | 2006 WebCachePolicy cachePolicy) const { |
2008 HistoryItem* historyItem = item; | 2007 HistoryItem* historyItem = item; |
2009 ResourceRequest request = | 2008 return WrappedResourceRequest( |
2010 FrameLoader::resourceRequestFromHistoryItem(historyItem, cachePolicy); | 2009 historyItem->generateResourceRequest(cachePolicy)); |
2011 return WrappedResourceRequest(request); | |
2012 } | 2010 } |
2013 | 2011 |
2014 WebURLRequest WebLocalFrameImpl::requestForReload( | 2012 WebURLRequest WebLocalFrameImpl::requestForReload( |
2015 WebFrameLoadType loadType, | 2013 WebFrameLoadType loadType, |
2016 const WebURL& overrideUrl) const { | 2014 const WebURL& overrideUrl) const { |
2017 DCHECK(frame()); | 2015 DCHECK(frame()); |
2018 ResourceRequest request = frame()->loader().resourceRequestForReload( | 2016 ResourceRequest request = frame()->loader().resourceRequestForReload( |
2019 static_cast<FrameLoadType>(loadType), overrideUrl); | 2017 static_cast<FrameLoadType>(loadType), overrideUrl); |
2020 return WrappedResourceRequest(request); | 2018 return WrappedResourceRequest(request); |
2021 } | 2019 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2056 bool isClientRedirect) { | 2054 bool isClientRedirect) { |
2057 DCHECK(frame()); | 2055 DCHECK(frame()); |
2058 | 2056 |
2059 // If we are loading substitute data to replace an existing load, then | 2057 // If we are loading substitute data to replace an existing load, then |
2060 // inherit all of the properties of that original request. This way, | 2058 // inherit all of the properties of that original request. This way, |
2061 // reload will re-attempt the original request. It is essential that | 2059 // reload will re-attempt the original request. It is essential that |
2062 // we only do this when there is an unreachableURL since a non-empty | 2060 // we only do this when there is an unreachableURL since a non-empty |
2063 // unreachableURL informs FrameLoader::reload to load unreachableURL | 2061 // unreachableURL informs FrameLoader::reload to load unreachableURL |
2064 // instead of the currently loaded URL. | 2062 // instead of the currently loaded URL. |
2065 ResourceRequest request; | 2063 ResourceRequest request; |
2066 if (replace && !unreachableURL.isEmpty() && | 2064 HistoryItem* historyItem = item; |
2067 frame()->loader().provisionalDocumentLoader()) | 2065 DocumentLoader* provisionalDocumentLoader = |
2068 request = frame()->loader().provisionalDocumentLoader()->originalRequest(); | 2066 frame()->loader().provisionalDocumentLoader(); |
| 2067 if (replace && !unreachableURL.isEmpty() && provisionalDocumentLoader) { |
| 2068 request = provisionalDocumentLoader->originalRequest(); |
| 2069 if (provisionalDocumentLoader->loadType() == FrameLoadTypeBackForward) { |
| 2070 historyItem = provisionalDocumentLoader->historyItem(); |
| 2071 webFrameLoadType = WebFrameLoadType::BackForward; |
| 2072 } |
| 2073 } |
2069 request.setURL(baseURL); | 2074 request.setURL(baseURL); |
2070 request.setCheckForBrowserSideNavigation(false); | 2075 request.setCheckForBrowserSideNavigation(false); |
2071 | 2076 |
2072 FrameLoadRequest frameRequest( | 2077 FrameLoadRequest frameRequest( |
2073 0, request, SubstituteData(data, mimeType, textEncoding, unreachableURL)); | 2078 0, request, SubstituteData(data, mimeType, textEncoding, unreachableURL)); |
2074 DCHECK(frameRequest.substituteData().isValid()); | 2079 DCHECK(frameRequest.substituteData().isValid()); |
2075 frameRequest.setReplacesCurrentItem(replace); | 2080 frameRequest.setReplacesCurrentItem(replace); |
2076 if (isClientRedirect) | 2081 if (isClientRedirect) |
2077 frameRequest.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | 2082 frameRequest.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
2078 | 2083 |
2079 HistoryItem* historyItem = item; | |
2080 frame()->loader().load( | 2084 frame()->loader().load( |
2081 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem, | 2085 frameRequest, static_cast<FrameLoadType>(webFrameLoadType), historyItem, |
2082 static_cast<HistoryLoadType>(webHistoryLoadType)); | 2086 static_cast<HistoryLoadType>(webHistoryLoadType)); |
2083 } | 2087 } |
2084 | 2088 |
2085 bool WebLocalFrameImpl::maybeRenderFallbackContent( | 2089 bool WebLocalFrameImpl::maybeRenderFallbackContent( |
2086 const WebURLError& error) const { | 2090 const WebURLError& error) const { |
2087 DCHECK(frame()); | 2091 DCHECK(frame()); |
2088 | 2092 |
2089 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) | 2093 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) |
2090 return false; | 2094 return false; |
2091 | 2095 |
2092 FrameLoader& frameloader = frame()->loader(); | 2096 DCHECK(frame()->loader().provisionalDocumentLoader()); |
2093 DCHECK(frameloader.provisionalDocumentLoader()); | 2097 frame()->loader().provisionalDocumentLoader()->loadFailed(error); |
2094 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); | |
2095 return true; | 2098 return true; |
2096 } | 2099 } |
2097 | 2100 |
2098 // Called when a navigation is blocked because a Content Security Policy (CSP) | 2101 // Called when a navigation is blocked because a Content Security Policy (CSP) |
2099 // is infringed. | 2102 // is infringed. |
2100 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( | 2103 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( |
2101 const blink::WebContentSecurityPolicyViolation& violation) { | 2104 const blink::WebContentSecurityPolicyViolation& violation) { |
2102 DCHECK(frame() && frame()->document()); | 2105 DCHECK(frame() && frame()->document()); |
2103 Document* document = frame()->document(); | 2106 Document* document = frame()->document(); |
2104 Vector<String> reportEndpoints; | 2107 Vector<String> reportEndpoints; |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2515 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2518 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2516 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2519 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2517 } else { | 2520 } else { |
2518 clipHtml = | 2521 clipHtml = |
2519 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2522 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2520 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2523 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2521 } | 2524 } |
2522 } | 2525 } |
2523 | 2526 |
2524 } // namespace blink | 2527 } // namespace blink |
OLD | NEW |