OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 case Resource::ImportResource: | 183 case Resource::ImportResource: |
184 resource = RawResource::fetchImport(request, fetcher()); | 184 resource = RawResource::fetchImport(request, fetcher()); |
185 break; | 185 break; |
186 case Resource::Raw: | 186 case Resource::Raw: |
187 resource = RawResource::fetch(request, fetcher()); | 187 resource = RawResource::fetch(request, fetcher()); |
188 break; | 188 break; |
189 default: | 189 default: |
190 NOTREACHED(); | 190 NOTREACHED(); |
191 } | 191 } |
192 | 192 |
193 if (resource) | 193 // CSP layout tests verify that preloads are subject to access checks by |
| 194 // seeing if they are in the `preload started` list. Therefore do not add |
| 195 // them to the list if the load is immediately denied. |
| 196 if (resource && !resource->resourceError().isAccessCheck()) |
194 fetcher()->preloadStarted(resource); | 197 fetcher()->preloadStarted(resource); |
195 return resource; | 198 return resource; |
196 } | 199 } |
197 | 200 |
198 void DocumentLoader::didRedirect(const KURL& oldURL, const KURL& newURL) { | 201 void DocumentLoader::didRedirect(const KURL& oldURL, const KURL& newURL) { |
199 timing().addRedirect(oldURL, newURL); | 202 timing().addRedirect(oldURL, newURL); |
200 | 203 |
201 // If a redirection happens during a back/forward navigation, don't restore | 204 // If a redirection happens during a back/forward navigation, don't restore |
202 // any state from the old HistoryItem. There is a provisional history item for | 205 // any state from the old HistoryItem. There is a provisional history item for |
203 // back/forward navigation only. In the other case, clearing it is a no-op. | 206 // back/forward navigation only. In the other case, clearing it is a no-op. |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 677 } |
675 | 678 |
676 DEFINE_STATIC_LOCAL( | 679 DEFINE_STATIC_LOCAL( |
677 ResourceLoaderOptions, mainResourceLoadOptions, | 680 ResourceLoaderOptions, mainResourceLoadOptions, |
678 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, | 681 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, |
679 CheckContentSecurityPolicy, DocumentContext)); | 682 CheckContentSecurityPolicy, DocumentContext)); |
680 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, | 683 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, |
681 mainResourceLoadOptions); | 684 mainResourceLoadOptions); |
682 m_mainResource = | 685 m_mainResource = |
683 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); | 686 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); |
684 if (!m_mainResource) { | 687 |
| 688 // PlzNavigate: |
| 689 // The final access checks are still performed here, potentially rejecting |
| 690 // the "provisional" load, but the browser side already expects the renderer |
| 691 // to be able to unconditionally commit. |
| 692 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && |
| 693 m_mainResource->errorOccurred())) { |
685 m_request = ResourceRequest(blankURL()); | 694 m_request = ResourceRequest(blankURL()); |
686 maybeLoadEmpty(); | 695 maybeLoadEmpty(); |
687 return; | 696 return; |
688 } | 697 } |
689 // A bunch of headers are set when the underlying resource load begins, and | 698 // A bunch of headers are set when the underlying resource load begins, and |
690 // m_request needs to include those. Even when using a cached resource, we may | 699 // m_request needs to include those. Even when using a cached resource, we may |
691 // make some modification to the request, e.g. adding the referer header. | 700 // make some modification to the request, e.g. adding the referer header. |
692 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() | 701 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() |
693 : fetchRequest.resourceRequest(); | 702 : fetchRequest.resourceRequest(); |
694 m_mainResource->addClient(this); | 703 m_mainResource->addClient(this); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 m_writer ? m_writer->encoding() : emptyAtom, true, | 761 m_writer ? m_writer->encoding() : emptyAtom, true, |
753 ForceSynchronousParsing); | 762 ForceSynchronousParsing); |
754 if (!source.isNull()) | 763 if (!source.isNull()) |
755 m_writer->appendReplacingData(source); | 764 m_writer->appendReplacingData(source); |
756 endWriting(m_writer.get()); | 765 endWriting(m_writer.get()); |
757 } | 766 } |
758 | 767 |
759 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 768 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
760 | 769 |
761 } // namespace blink | 770 } // namespace blink |
OLD | NEW |