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

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

Issue 2866873002: Validate generated MHTML in mhtml_generation_browsertest.cc tests. (Closed)
Patch Set: Fixed layout test expectation. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/mhtml/mhtml_in_iframe-expected.txt ('k') | no next file » | 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 a9aa01e650b5749678a56564d80a243c294be77f..1da2a15cea6ea0f8da7f22aeccd0f90d9cf6f2c0 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -1157,10 +1157,24 @@ void ResourceFetcher::WarnUnusedPreloads() {
ArchiveResource* ResourceFetcher::CreateArchive(Resource* resource) {
// Only the top-frame can load MHTML.
- if (!Context().IsMainFrame())
+ if (!Context().IsMainFrame()) {
+ Context().AddConsoleMessage(
+ "Attempted to load a multipart archive into an subframe: " +
+ resource->Url().GetString(),
+ FetchContext::kLogErrorMessage);
return nullptr;
+ }
+
archive_ = MHTMLArchive::Create(resource->Url(), resource->ResourceBuffer());
- return archive_ ? archive_->MainResource() : nullptr;
+ if (!archive_) {
+ // Log if attempting to load an invalid archive resource.
+ Context().AddConsoleMessage(
+ "Malformed multipart archive: " + resource->Url().GetString(),
+ FetchContext::kLogErrorMessage);
+ return nullptr;
+ }
+
+ return archive_->MainResource();
}
ResourceTimingInfo* ResourceFetcher::GetNavigationTimingInfo() {
« no previous file with comments | « third_party/WebKit/LayoutTests/mhtml/mhtml_in_iframe-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698