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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 1707013002: [WIP][SVG 3/4] Allow invalid data: URLs to be served synchronously by Resource::load() Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_SVGImage_Fix2
Patch Set: Rebase + reflect comments. Created 4 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index ddeb28f44f51b867387db8582fdffe35a41a0aee..34d7d9f0675fcf4f16983c5767aff1804208693f 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -331,22 +331,32 @@ PassRefPtrWillBeRawPtr<Resource> ResourceFetcher::resourceForStaticData(const Fe
mimetype = substituteData.mimeType();
charset = substituteData.textEncoding();
data = substituteData.content();
+ ASSERT(data);
} else {
WrappedResourceRequest wrappedRequest(request.resourceRequest());
WebData webData;
if (!Platform::current()->parseDataURLIfCanBeHandledLocally(wrappedRequest, mimetype, charset, webData))
return nullptr;
data = PassRefPtr<SharedBuffer>(webData);
- if (!data)
- return nullptr;
}
- ResourceResponse response(url, mimetype, data->size(), charset, String());
- response.setHTTPStatusCode(200);
- response.setHTTPStatusText("OK");
RefPtrWillBeRawPtr<Resource> resource = factory.create(request.resourceRequest(), request.charset());
resource->setNeedsSynchronousCacheHit(substituteData.forceSynchronousLoad());
resource->setOptions(request.options());
+
+ if (!data) {
+ // We don't add |resource| to MemoryCache because it has an error,
+ // but make ResourceFetcher::requestResource() to return this
+ // Resource to make all data font URLs to be resolved synchronously.
+ // https://crbug.com/382170
+ resource->error(Resource::LoadError);
Nate Chapin 2016/03/01 23:11:34 ASSERT(url.protocolIsData()) here, just to be clea
+ return resource.release();
+ }
+
+ ResourceResponse response(url, mimetype, data->size(), charset, String());
+ response.setHTTPStatusCode(200);
+ response.setHTTPStatusText("OK");
+
// FIXME: We should provide a body stream here.
resource->responseReceived(response, nullptr);
resource->setDataBufferingPolicy(BufferData);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698