OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. |
3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) | 3 * (C) 2007 Graham Dennis (graham.dennis@gmail.com) |
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 347 |
348 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor
eHTTPStatusCodeErrors()) | 348 if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnor
eHTTPStatusCodeErrors()) |
349 return; | 349 return; |
350 m_state = Finishing; | 350 m_state = Finishing; |
351 m_resource->error(CachedResource::LoadError); | 351 m_resource->error(CachedResource::LoadError); |
352 cancel(); | 352 cancel(); |
353 } | 353 } |
354 | 354 |
355 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt
h, int encodedDataLength) | 355 void ResourceLoader::didReceiveData(ResourceHandle*, const char* data, int lengt
h, int encodedDataLength) |
356 { | 356 { |
| 357 // It is possible to receive data on uninitialized resources if it had an er
ror status code, and we are running a nested message |
| 358 // loop. When this occurs, ignoring the data is the correct action. |
| 359 if (m_resource->response().httpStatusCode() >= 400 && !m_resource->shouldIgn
oreHTTPStatusCodeErrors()) |
| 360 return; |
357 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv
eResourceData(m_frame.get(), identifier(), encodedDataLength); | 361 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiv
eResourceData(m_frame.get(), identifier(), encodedDataLength); |
358 ASSERT(m_state == Initialized); | 362 ASSERT(m_state == Initialized); |
359 | 363 |
360 // Reference the object in this method since the additional processing can d
o | 364 // Reference the object in this method since the additional processing can d
o |
361 // anything including removing the last reference to this object. | 365 // anything including removing the last reference to this object. |
362 RefPtr<ResourceLoader> protect(this); | 366 RefPtr<ResourceLoader> protect(this); |
363 | 367 |
364 // FIXME: If we get a resource with more than 2B bytes, this code won't do t
he right thing. | 368 // FIXME: If we get a resource with more than 2B bytes, this code won't do t
he right thing. |
365 // However, with today's computers and networking speeds, this won't happen
in practice. | 369 // However, with today's computers and networking speeds, this won't happen
in practice. |
366 // Could be an issue with a giant local file. | 370 // Could be an issue with a giant local file. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 info.addMember(m_request, "request"); | 428 info.addMember(m_request, "request"); |
425 info.addMember(m_originalRequest, "originalRequest"); | 429 info.addMember(m_originalRequest, "originalRequest"); |
426 info.addMember(m_deferredRequest, "deferredRequest"); | 430 info.addMember(m_deferredRequest, "deferredRequest"); |
427 info.addMember(m_options, "options"); | 431 info.addMember(m_options, "options"); |
428 info.addMember(m_resource, "resource"); | 432 info.addMember(m_resource, "resource"); |
429 info.addMember(m_documentLoader, "documentLoader"); | 433 info.addMember(m_documentLoader, "documentLoader"); |
430 info.addMember(m_requestCountTracker, "requestCountTracker"); | 434 info.addMember(m_requestCountTracker, "requestCountTracker"); |
431 } | 435 } |
432 | 436 |
433 } | 437 } |
OLD | NEW |