Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2766583002: Set the same headers for data URLs in WebURLLoaderImpl and ResourceFetcher (Closed)
Patch Set: reflect comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index f7fcd772965cc5c12ac3a9c865d8872eae65906a..f998689a0a92c13a192c5c173ceeff51e1269ae3 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -369,33 +369,31 @@ Resource* ResourceFetcher::resourceForStaticData(
memoryCache()->remove(oldResource);
}
- AtomicString mimetype;
- AtomicString charset;
+ ResourceResponse response;
RefPtr<SharedBuffer> data;
if (substituteData.isValid()) {
- mimetype = substituteData.mimeType();
- charset = substituteData.textEncoding();
data = substituteData.content();
+ response.setURL(url);
+ response.setMimeType(substituteData.mimeType());
+ response.setExpectedContentLength(data->size());
+ response.setTextEncodingName(substituteData.textEncoding());
} else if (url.protocolIsData()) {
- data = PassRefPtr<SharedBuffer>(
- NetworkUtils::parseDataURL(url, mimetype, charset));
+ data = NetworkUtils::parseDataURLAndPopulateResponse(url, response);
if (!data)
return nullptr;
+ // |response| is modified by parseDataURLAndPopulateResponse() and is
+ // ready to be used.
} else {
ArchiveResource* archiveResource =
m_archive->subresourceForURL(request.url());
// Fall back to the network if the archive doesn't contain the resource.
if (!archiveResource)
return nullptr;
- mimetype = archiveResource->mimeType();
- charset = archiveResource->textEncoding();
data = archiveResource->data();
- }
-
- ResourceResponse response(url, mimetype, data->size(), charset);
- if (!substituteData.isValid() && url.protocolIsData()) {
- response.setHTTPStatusCode(200);
- response.setHTTPStatusText("OK");
+ response.setURL(url);
+ response.setMimeType(archiveResource->mimeType());
+ response.setExpectedContentLength(data->size());
+ response.setTextEncodingName(archiveResource->textEncoding());
}
Resource* resource = factory.create(request.resourceRequest(),
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698