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

Unified Diff: third_party/WebKit/Source/web/WebFrameSerializer.cpp

Issue 2613253002: MHTML generation: safely serialize image documents (Closed)
Patch Set: Add regression unit test Created 3 years, 11 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/web/tests/WebFrameSerializerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebFrameSerializer.cpp
diff --git a/third_party/WebKit/Source/web/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
index 5fdf086b987a4235d190e22fae7cf7de62f0db1f..8d600dda9a1a94d696f37717c9d7cdf5c066d07f 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -294,6 +294,11 @@ WebThreadSafeData WebFrameSerializer::generateMHTMLParts(
FrameSerializer serializer(resources, coreDelegate);
serializer.serializeFrame(*frame);
}
+
+ // There was an error serializing the frame (e.g. of an image resource).
+ if (resources.isEmpty())
+ return WebThreadSafeData();
carlosk 2017/01/06 23:26:36 To keep tracing logic consistent this should be mo
Charlie Harrison 2017/01/07 02:31:25 Good catch, will fix this in a follow up.
+
TRACE_EVENT_END1("page-serialization",
"WebFrameSerializer::generateMHTMLParts serializing",
"resource count",
@@ -302,7 +307,6 @@ WebThreadSafeData WebFrameSerializer::generateMHTMLParts(
// Encode serialized resources as MHTML.
RefPtr<RawData> output = RawData::create();
{
- DCHECK(!resources.isEmpty());
SCOPED_BLINK_UMA_HISTOGRAM_TIMER(
"PageSerialization.MhtmlGeneration.EncodingTime.SingleFrame");
// Frame is the 1st resource (see FrameSerializer::serializeFrame doc
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698