From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 17 Jan 2022 23:47:54 +0100 Subject: fix: crash when saving edited PDF files Originally, this patch contained a code change. Since then, the code has been upstreamed[1] but placed behind a flag. This patch now enables the flag by default, therefore using the code fix from the original patch. This flag will eventually be removed and the original code fix will be all that is left behind. When that happens, this patch will be safe to remove. [1]: https://chromium-review.googlesource.com/c/chromium/src/+/6205762 Original patch description: > This commit fixes a crash that persists any time a user attempts to > download an edited PDF. This was happening because the logic flow for > downloading of any edited PDF triggers a call to > chrome.fileSystem.chooseEntry, which we do not support and which > therefore causes unmapped page access crashes. > > This patch can be removed should we choose to support chrome.fileSystem > or support it enough to fix the crash. diff --git a/chrome/browser/resources/pdf/pdf_viewer.ts b/chrome/browser/resources/pdf/pdf_viewer.ts index 0bab3a5c852357bb6dc7758e573093a080e06b79..594d168331eba048b4bc5d25ad6f6834e2e88360 100644 --- a/chrome/browser/resources/pdf/pdf_viewer.ts +++ b/chrome/browser/resources/pdf/pdf_viewer.ts @@ -269,7 +269,7 @@ export class PdfViewerElement extends PdfViewerBaseElement { // protected pdfInk2Enabled_: boolean = false; // - private pdfUseShowSaveFilePicker_: boolean = false; + private pdfUseShowSaveFilePicker_: boolean = true; private pluginController_: PluginController = PluginController.getInstance(); protected printingEnabled_: boolean = false; // diff --git a/pdf/pdf_features.cc b/pdf/pdf_features.cc index 387174b3ee8aa39f0e3c4c67274e8c6b738c889f..a8ee6d48009de8fb10eff8689a694ac2e60a3723 100644 --- a/pdf/pdf_features.cc +++ b/pdf/pdf_features.cc @@ -55,7 +55,7 @@ BASE_FEATURE(kPdfTags, "PdfTags", base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kPdfUseShowSaveFilePicker, "PdfUseShowSaveFilePicker", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kPdfUseSkiaRenderer, "PdfUseSkiaRenderer",