Commit 75a18c2b authored by rbpotter's avatar rbpotter Committed by Commit Bot

Fix printing crash

CHECK is failing because if the preview is a subset of the document and
is cancelled or fails after the subset is completed but while draft data
is still being generated, 2 messages are sent to the UI. Fix this issue
so that only 1 message is sent to the UI per preview request.

Bug: 740377
Change-Id: I751432f24e6283a55939a51cfe452f331da3f850
Reviewed-on: https://chromium-review.googlesource.com/571516
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487348}
parent 89ddf7b9
...@@ -1572,11 +1572,13 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { ...@@ -1572,11 +1572,13 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
case FAIL_PREVIEW: case FAIL_PREVIEW:
if (notify_browser_of_print_failure_) { if (!is_print_ready_metafile_sent_) {
LOG(ERROR) << "CreatePreviewDocument failed"; if (notify_browser_of_print_failure_) {
Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie)); LOG(ERROR) << "CreatePreviewDocument failed";
} else { Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie));
Send(new PrintHostMsg_PrintPreviewCancelled(routing_id(), cookie)); } else {
Send(new PrintHostMsg_PrintPreviewCancelled(routing_id(), cookie));
}
} }
print_preview_context_.Failed(notify_browser_of_print_failure_); print_preview_context_.Failed(notify_browser_of_print_failure_);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment