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

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: Remove unused local variables 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 1d35e159ac55f11d369f885c2958d02f23da2541..5da07fedfbf64be59c14a7d0fe30091e34b073cb 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -363,16 +363,16 @@ 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 = PassRefPtr<SharedBuffer>(NetworkUtils::parseDataURL(url, response));
kouhei (in TOK) 2017/03/21 07:29:20 can we note that response is modified by parseData
hiroshige 2017/03/21 08:04:47 Done.
if (!data)
return nullptr;
} else {
@@ -381,15 +381,11 @@ Resource* ResourceFetcher::resourceForStaticData(
// 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);
hiroshige 2017/03/21 08:00:12 This block is moved to parseDataURL().
- 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