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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 ClientRedirectPolicy clientRedirectPolicy) | 100 ClientRedirectPolicy clientRedirectPolicy) |
101 : m_frame(frame), | 101 : m_frame(frame), |
102 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)), | 102 m_fetcher(FrameFetchContext::createContextAndFetcher(this, nullptr)), |
103 m_originalRequest(req), | 103 m_originalRequest(req), |
104 m_substituteData(substituteData), | 104 m_substituteData(substituteData), |
105 m_request(req), | 105 m_request(req), |
106 m_isClientRedirect(clientRedirectPolicy == | 106 m_isClientRedirect(clientRedirectPolicy == |
107 ClientRedirectPolicy::ClientRedirect), | 107 ClientRedirectPolicy::ClientRedirect), |
108 m_replacesCurrentHistoryItem(false), | 108 m_replacesCurrentHistoryItem(false), |
109 m_dataReceived(false), | 109 m_dataReceived(false), |
110 m_mainResourceIdentifier(0), | |
110 m_navigationType(NavigationTypeOther), | 111 m_navigationType(NavigationTypeOther), |
111 m_documentLoadTiming(*this), | 112 m_documentLoadTiming(*this), |
112 m_timeOfLastDataReceived(0.0), | 113 m_timeOfLastDataReceived(0.0), |
113 m_applicationCacheHost(ApplicationCacheHost::create(this)), | 114 m_applicationCacheHost(ApplicationCacheHost::create(this)), |
114 m_wasBlockedAfterXFrameOptionsOrCSP(false), | 115 m_wasBlockedAfterXFrameOptionsOrCSP(false), |
115 m_state(NotStarted), | 116 m_state(NotStarted), |
116 m_inDataReceived(false), | 117 m_inDataReceived(false), |
117 m_dataBuffer(SharedBuffer::create()) { | 118 m_dataBuffer(SharedBuffer::create()) { |
118 // The document URL needs to be added to the head of the list as that is | 119 // The document URL needs to be added to the head of the list as that is |
119 // where the redirects originated. | 120 // where the redirects originated. |
(...skipping 18 matching lines...) Expand all Loading... | |
138 visitor->trace(m_fetcher); | 139 visitor->trace(m_fetcher); |
139 visitor->trace(m_mainResource); | 140 visitor->trace(m_mainResource); |
140 visitor->trace(m_writer); | 141 visitor->trace(m_writer); |
141 visitor->trace(m_documentLoadTiming); | 142 visitor->trace(m_documentLoadTiming); |
142 visitor->trace(m_applicationCacheHost); | 143 visitor->trace(m_applicationCacheHost); |
143 visitor->trace(m_contentSecurityPolicy); | 144 visitor->trace(m_contentSecurityPolicy); |
144 RawResourceClient::trace(visitor); | 145 RawResourceClient::trace(visitor); |
145 } | 146 } |
146 | 147 |
147 unsigned long DocumentLoader::mainResourceIdentifier() const { | 148 unsigned long DocumentLoader::mainResourceIdentifier() const { |
148 return m_mainResource ? m_mainResource->identifier() : 0; | 149 return m_mainResourceIdentifier; |
Yoav Weiss
2016/11/29 10:39:32
Why do we need to store this rather than get the i
sunjian
2016/11/29 19:33:30
Yeah, m_mainResource gets reset to nullptr after i
| |
150 } | |
151 | |
152 ResourceTimingInfo* DocumentLoader::getMainResourceTimingInfo() const { | |
153 return fetcher()->getMainResourceTimingInfo(mainResourceIdentifier()); | |
149 } | 154 } |
150 | 155 |
151 const ResourceRequest& DocumentLoader::originalRequest() const { | 156 const ResourceRequest& DocumentLoader::originalRequest() const { |
152 return m_originalRequest; | 157 return m_originalRequest; |
153 } | 158 } |
154 | 159 |
155 const ResourceRequest& DocumentLoader::request() const { | 160 const ResourceRequest& DocumentLoader::request() const { |
156 return m_request; | 161 return m_request; |
157 } | 162 } |
158 | 163 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 } | 715 } |
711 | 716 |
712 DEFINE_STATIC_LOCAL( | 717 DEFINE_STATIC_LOCAL( |
713 ResourceLoaderOptions, mainResourceLoadOptions, | 718 ResourceLoaderOptions, mainResourceLoadOptions, |
714 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, | 719 (DoNotBufferData, AllowStoredCredentials, ClientRequestedCredentials, |
715 CheckContentSecurityPolicy, DocumentContext)); | 720 CheckContentSecurityPolicy, DocumentContext)); |
716 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, | 721 FetchRequest fetchRequest(m_request, FetchInitiatorTypeNames::document, |
717 mainResourceLoadOptions); | 722 mainResourceLoadOptions); |
718 m_mainResource = | 723 m_mainResource = |
719 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); | 724 RawResource::fetchMainResource(fetchRequest, fetcher(), m_substituteData); |
725 m_mainResourceIdentifier = m_mainResource ? m_mainResource->identifier() : 0; | |
720 | 726 |
721 // PlzNavigate: | 727 // PlzNavigate: |
722 // The final access checks are still performed here, potentially rejecting | 728 // The final access checks are still performed here, potentially rejecting |
723 // the "provisional" load, but the browser side already expects the renderer | 729 // the "provisional" load, but the browser side already expects the renderer |
724 // to be able to unconditionally commit. | 730 // to be able to unconditionally commit. |
725 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && | 731 if (!m_mainResource || (m_frame->settings()->browserSideNavigationEnabled() && |
726 m_mainResource->errorOccurred())) { | 732 m_mainResource->errorOccurred())) { |
727 m_request = ResourceRequest(blankURL()); | 733 m_request = ResourceRequest(blankURL()); |
728 maybeLoadEmpty(); | 734 maybeLoadEmpty(); |
729 return; | 735 return; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
793 m_writer ? m_writer->encoding() : emptyAtom, true, | 799 m_writer ? m_writer->encoding() : emptyAtom, true, |
794 ForceSynchronousParsing); | 800 ForceSynchronousParsing); |
795 if (!source.isNull()) | 801 if (!source.isNull()) |
796 m_writer->appendReplacingData(source); | 802 m_writer->appendReplacingData(source); |
797 endWriting(); | 803 endWriting(); |
798 } | 804 } |
799 | 805 |
800 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 806 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
801 | 807 |
802 } // namespace blink | 808 } // namespace blink |
OLD | NEW |