| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { | 170 std::unique_ptr<WebDocumentSubresourceFilter> subresourceFilter) { |
| 171 m_subresourceFilter = std::move(subresourceFilter); | 171 m_subresourceFilter = std::move(subresourceFilter); |
| 172 } | 172 } |
| 173 | 173 |
| 174 Resource* DocumentLoader::startPreload(Resource::Type type, | 174 Resource* DocumentLoader::startPreload(Resource::Type type, |
| 175 FetchRequest& request) { | 175 FetchRequest& request) { |
| 176 Resource* resource = nullptr; | 176 Resource* resource = nullptr; |
| 177 switch (type) { | 177 switch (type) { |
| 178 case Resource::Image: | 178 case Resource::Image: |
| 179 if (m_frame && m_frame->settings() && | 179 if (m_frame && m_frame->settings() && |
| 180 m_frame->settings()->fetchImagePlaceholders()) { | 180 m_frame->settings()->getFetchImagePlaceholders()) { |
| 181 request.setAllowImagePlaceholder(); | 181 request.setAllowImagePlaceholder(); |
| 182 } | 182 } |
| 183 resource = ImageResource::fetch(request, fetcher()); | 183 resource = ImageResource::fetch(request, fetcher()); |
| 184 break; | 184 break; |
| 185 case Resource::Script: | 185 case Resource::Script: |
| 186 resource = ScriptResource::fetch(request, fetcher()); | 186 resource = ScriptResource::fetch(request, fetcher()); |
| 187 break; | 187 break; |
| 188 case Resource::CSSStyleSheet: | 188 case Resource::CSSStyleSheet: |
| 189 resource = CSSStyleSheetResource::fetch(request, fetcher()); | 189 resource = CSSStyleSheetResource::fetch(request, fetcher()); |
| 190 break; | 190 break; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 DCHECK_EQ(m_state, NotStarted); | 707 DCHECK_EQ(m_state, NotStarted); |
| 708 m_state = Provisional; | 708 m_state = Provisional; |
| 709 | 709 |
| 710 if (maybeLoadEmpty()) | 710 if (maybeLoadEmpty()) |
| 711 return; | 711 return; |
| 712 | 712 |
| 713 DCHECK(timing().navigationStart()); | 713 DCHECK(timing().navigationStart()); |
| 714 | 714 |
| 715 // PlzNavigate: | 715 // PlzNavigate: |
| 716 // The fetch has already started in the browser. Don't mark it again. | 716 // The fetch has already started in the browser. Don't mark it again. |
| 717 if (!m_frame->settings()->browserSideNavigationEnabled()) { | 717 if (!m_frame->settings()->getBrowserSideNavigationEnabled()) { |
| 718 DCHECK(!timing().fetchStart()); | 718 DCHECK(!timing().fetchStart()); |
| 719 timing().markFetchStart(); | 719 timing().markFetchStart(); |
| 720 } | 720 } |
| 721 | 721 |
| 722 DEFINE_STATIC_LOCAL( | 722 DEFINE_STATIC_LOCAL( |
| 723 ResourceLoaderOptions, mainResourceLoadOptions, | 723 ResourceLoaderOptions, mainResourceLoadOptions, |
| 724 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, | 724 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, |
| 725 CheckContentSecurityPolicy, DocumentContext)); | 725 CheckContentSecurityPolicy, DocumentContext)); |
| 726 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, | 726 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, |
| 727 mainResourceLoadOptions); | 727 mainResourceLoadOptions); |
| 728 m_mainResource = | 728 m_mainResource = |
| 729 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); | 729 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); |
| 730 | 730 |
| 731 // PlzNavigate: | 731 // PlzNavigate: |
| 732 // The final access checks are still performed here, potentially rejecting | 732 // The final access checks are still performed here, potentially rejecting |
| 733 // the "provisional" load, but the browser side already expects the renderer | 733 // the "provisional" load, but the browser side already expects the renderer |
| 734 // to be able to unconditionally commit. | 734 // to be able to unconditionally commit. |
| 735 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && | 735 if (!m_mainResource || |
| 736 m_mainResource->errorOccurred())) { | 736 (m_frame->settings()->getBrowserSideNavigationEnabled() && |
| 737 m_mainResource->errorOccurred())) { |
| 737 m_request = ResourceRequest(blankURL()); | 738 m_request = ResourceRequest(blankURL()); |
| 738 maybeLoadEmpty(); | 739 maybeLoadEmpty(); |
| 739 return; | 740 return; |
| 740 } | 741 } |
| 741 // A bunch of headers are set when the underlying resource load begins, and | 742 // A bunch of headers are set when the underlying resource load begins, and |
| 742 // m_request needs to include those. Even when using a cached resource, we may | 743 // m_request needs to include those. Even when using a cached resource, we may |
| 743 // make some modification to the request, e.g. adding the referer header. | 744 // make some modification to the request, e.g. adding the referer header. |
| 744 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() | 745 m_request = m_mainResource->isLoading() ? m_mainResource->resourceRequest() |
| 745 : fetchRequest.resourceRequest(); | 746 : fetchRequest.resourceRequest(); |
| 746 m_mainResource->addClient(this); | 747 m_mainResource->addClient(this); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 m_writer ? m_writer->encoding() : emptyAtom, true, | 802 m_writer ? m_writer->encoding() : emptyAtom, true, |
| 802 ForceSynchronousParsing); | 803 ForceSynchronousParsing); |
| 803 if (!source.isNull()) | 804 if (!source.isNull()) |
| 804 m_writer->appendReplacingData(source); | 805 m_writer->appendReplacingData(source); |
| 805 endWriting(); | 806 endWriting(); |
| 806 } | 807 } |
| 807 | 808 |
| 808 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 809 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
| 809 | 810 |
| 810 } // namespace blink | 811 } // namespace blink |
| OLD | NEW |