From b7540e5b16e9e6fb169fcf28533940cb0e015570 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 19 Jul 2022 14:46:08 +0200 Subject: [PATCH] fix: delegate to `PrintViewManagerBase` on failed print (#34893) fix: delegate to PrintViewManagerBase on failed print --- shell/browser/printing/print_view_manager_electron.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/shell/browser/printing/print_view_manager_electron.cc b/shell/browser/printing/print_view_manager_electron.cc index 866f439f5aec4..369b97fbd049e 100644 --- a/shell/browser/printing/print_view_manager_electron.cc +++ b/shell/browser/printing/print_view_manager_electron.cc @@ -163,12 +163,23 @@ void PrintViewManagerElectron::ScriptedPrint( } void PrintViewManagerElectron::ShowInvalidPrinterSettingsError() { + if (headless_jobs_.size() == 0) { + PrintViewManagerBase::ShowInvalidPrinterSettingsError(); + return; + } + ReleaseJob(INVALID_PRINTER_SETTINGS); } void PrintViewManagerElectron::PrintingFailed( int32_t cookie, printing::mojom::PrintFailureReason reason) { + auto entry = std::find(headless_jobs_.begin(), headless_jobs_.end(), cookie); + if (entry == headless_jobs_.end()) { + PrintViewManagerBase::PrintingFailed(cookie, reason); + return; + } + ReleaseJob(reason == printing::mojom::PrintFailureReason::kInvalidPageRange ? PAGE_COUNT_EXCEEDED : PRINTING_FAILED);