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

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

Issue 2834013002: PlzNavigate: make MHTML iframe load working. (Closed)
Patch Set: Move comments about data-url from test to function Created 3 years, 7 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
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 0554a74ba34eafad9c243add53a20c9f6df3ee9f..b8d199639b6a58cf78e66f43c9da3eafb911df46 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -413,7 +413,7 @@ Resource* ResourceFetcher::ResourceForStaticData(
} else {
ArchiveResource* archive_resource =
archive_->SubresourceForURL(params.Url());
- // Fall back to the network if the archive doesn't contain the resource.
+ // The archive doesn't contain the resource, the request must be aborted.
if (!archive_resource)
return nullptr;
data = archive_resource->Data();
@@ -578,13 +578,19 @@ Resource* ResourceFetcher::RequestResource(
params.Options().initiator_info.name);
}
+ // An URL with the "cid" scheme can only be handled by an MHTML Archive.
+ // Abort the request when there is none.
+ if (resource_request.Url().ProtocolIs(kContentIdScheme) && !archive_) {
pfeldman 2017/05/05 20:45:36 [perf]: check !archive_ first [style nit]: drop {}
+ return nullptr;
+ }
+
bool is_data_url = resource_request.Url().ProtocolIsData();
bool is_static_data = is_data_url || substitute_data.IsValid() || archive_;
if (is_static_data) {
resource = ResourceForStaticData(params, factory, substitute_data);
// Abort the request if the archive doesn't contain the resource, except in
// the case of data URLs which might have resources such as fonts that need
- // to be decoded only on demand. These data URLs are allowed to be
+ // to be decoded only on demand. These data URLs are allowed to be
// processed using the normal ResourceFetcher machinery.
if (!resource && !is_data_url && archive_)
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698