OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void RawResource::WillNotFollowRedirect() { | 177 void RawResource::WillNotFollowRedirect() { |
178 ResourceClientWalker<RawResourceClient> w(Clients()); | 178 ResourceClientWalker<RawResourceClient> w(Clients()); |
179 while (RawResourceClient* c = w.Next()) | 179 while (RawResourceClient* c = w.Next()) |
180 c->RedirectBlocked(); | 180 c->RedirectBlocked(); |
181 } | 181 } |
182 | 182 |
183 void RawResource::ResponseReceived( | 183 void RawResource::ResponseReceived( |
184 const ResourceResponse& response, | 184 const ResourceResponse& response, |
185 std::unique_ptr<WebDataConsumerHandle> handle) { | 185 std::unique_ptr<WebDataConsumerHandle> handle) { |
| 186 if (response.WasFallbackRequiredByServiceWorker()) { |
| 187 // The ServiceWorker asked us to re-fetch the request. This resource must |
| 188 // not be reused. |
| 189 // Note: This logic is needed here because DocumentThreadableLoader handles |
| 190 // CORS independently from ResourceLoader. Fix it. |
| 191 GetMemoryCache()->Remove(this); |
| 192 } |
| 193 |
186 bool is_successful_revalidation = | 194 bool is_successful_revalidation = |
187 IsCacheValidator() && response.HttpStatusCode() == 304; | 195 IsCacheValidator() && response.HttpStatusCode() == 304; |
188 Resource::ResponseReceived(response, nullptr); | 196 Resource::ResponseReceived(response, nullptr); |
189 | 197 |
190 ResourceClientWalker<RawResourceClient> w(Clients()); | 198 ResourceClientWalker<RawResourceClient> w(Clients()); |
191 DCHECK(Clients().size() <= 1 || !handle); | 199 DCHECK(Clients().size() <= 1 || !handle); |
192 while (RawResourceClient* c = w.Next()) { | 200 while (RawResourceClient* c = w.Next()) { |
193 // |handle| is cleared when passed, but it's not a problem because |handle| | 201 // |handle| is cleared when passed, but it's not a problem because |handle| |
194 // is null when there are two or more clients, as asserted. | 202 // is null when there are two or more clients, as asserted. |
195 c->ResponseReceived(this, this->GetResponse(), std::move(handle)); | 203 c->ResponseReceived(this, this->GetResponse(), std::move(handle)); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 SECURITY_CHECK(state_ != kNotAddedAsClient); | 366 SECURITY_CHECK(state_ != kNotAddedAsClient); |
359 SECURITY_CHECK(state_ != kNotifyFinished); | 367 SECURITY_CHECK(state_ != kNotifyFinished); |
360 SECURITY_CHECK(resource->ErrorOccurred() || | 368 SECURITY_CHECK(resource->ErrorOccurred() || |
361 (state_ == kResponseReceived || | 369 (state_ == kResponseReceived || |
362 state_ == kSetSerializedCachedMetadata || | 370 state_ == kSetSerializedCachedMetadata || |
363 state_ == kDataReceived || state_ == kDataDownloaded)); | 371 state_ == kDataReceived || state_ == kDataDownloaded)); |
364 state_ = kNotifyFinished; | 372 state_ = kNotifyFinished; |
365 } | 373 } |
366 | 374 |
367 } // namespace blink | 375 } // namespace blink |
OLD | NEW |