Index: third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
diff --git a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
index 2ff8e64f0f3caeb801343d7cdba34af92545fd17..052bec7207a49909f1a65272bbbf282cb9de7566 100644 |
--- a/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
+++ b/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp |
@@ -69,7 +69,6 @@ ResourceLoader::ResourceLoader(ResourceFetcher* fetcher, Resource* resource, con |
: m_fetcher(fetcher) |
, m_notifiedLoadComplete(false) |
, m_defersLoading(fetcher->defersLoading()) |
- , m_loadingMultipartContent(false) |
, m_options(options) |
, m_resource(resource) |
, m_state(Initialized) |
@@ -202,8 +201,13 @@ void ResourceLoader::didDownloadData(WebURLLoader*, int length, int encodedDataL |
void ResourceLoader::didFinishLoadingOnePart(double finishTime, int64_t encodedDataLength) |
{ |
- // If load has been cancelled after finishing (which could happen with a |
- // JavaScript that changes the window location), do nothing. |
+ ASSERT(m_state != Terminated); |
Nate Chapin
2016/03/01 19:02:15
This means we both ASSERT and early-exit for this
yhirano
2016/03/01 19:43:23
Calling subresourceLoaderFinishedLoadingOnePar may
Nate Chapin
2016/03/01 19:56:45
...of course. Never mind :)
|
+ if (m_state != Finishing) { |
+ // When loading a multipart resource, make the loader non-block when |
+ // finishing loading the first part. |
+ m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); |
+ } |
+ |
if (m_state == Terminated) |
return; |
@@ -322,10 +326,8 @@ void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res |
// |rawHandle|'s ownership is transferred to the callee. |
OwnPtr<WebDataConsumerHandle> handle = adoptPtr(rawHandle); |
- bool isMultipartPayload = response.isMultipartPayload(); |
bool isValidStateTransition = (m_connectionState == ConnectionStateStarted || m_connectionState == ConnectionStateReceivedResponse); |
- // In the case of multipart loads, calls to didReceiveData & didReceiveResponse can be interleaved. |
- RELEASE_ASSERT(isMultipartPayload || isValidStateTransition); |
+ RELEASE_ASSERT(isValidStateTransition); |
m_connectionState = ConnectionStateReceivedResponse; |
const ResourceResponse& resourceResponse = response.toResourceResponse(); |
@@ -363,23 +365,6 @@ void ResourceLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& res |
if (m_state == Terminated) |
return; |
- if (response.toResourceResponse().isMultipart()) { |
- // We only support multipart for images, though the image may be loaded |
- // as a main resource that we end up displaying through an ImageDocument. |
- if (!m_resource->isImage() && m_resource->getType() != Resource::MainResource) { |
- cancel(); |
- return; |
- } |
- m_loadingMultipartContent = true; |
- } else if (isMultipartPayload) { |
- // Since a subresource loader does not load multipart sections progressively, data was delivered to the loader all at once. |
- // After the first multipart section is complete, signal to delegates that this load is "finished" |
- m_fetcher->subresourceLoaderFinishedLoadingOnePart(this); |
- didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncodedDataLength); |
- } |
- if (m_state == Terminated) |
- return; |
- |
if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors()) |
return; |
m_state = Finishing; |