fix_crash_when_saving_edited_pdf_files.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: Shelley Vohr <[email protected]>
  3. Date: Mon, 17 Jan 2022 23:47:54 +0100
  4. Subject: fix: crash when saving edited PDF files
  5. Originally, this patch contained a code change. Since then, the code has
  6. been upstreamed[1] but placed behind a flag. This patch now enables the
  7. flag by default, therefore using the code fix from the original patch.
  8. This flag will eventually be removed and the original code fix will be
  9. all that is left behind. When that happens, this patch will be safe to
  10. remove.
  11. [1]: https://chromium-review.googlesource.com/c/chromium/src/+/6205762
  12. Original patch description:
  13. > This commit fixes a crash that persists any time a user attempts to
  14. > download an edited PDF. This was happening because the logic flow for
  15. > downloading of any edited PDF triggers a call to
  16. > chrome.fileSystem.chooseEntry, which we do not support and which
  17. > therefore causes unmapped page access crashes.
  18. >
  19. > This patch can be removed should we choose to support chrome.fileSystem
  20. > or support it enough to fix the crash.
  21. diff --git a/chrome/browser/resources/pdf/pdf_viewer.ts b/chrome/browser/resources/pdf/pdf_viewer.ts
  22. index 0bab3a5c852357bb6dc7758e573093a080e06b79..594d168331eba048b4bc5d25ad6f6834e2e88360 100644
  23. --- a/chrome/browser/resources/pdf/pdf_viewer.ts
  24. +++ b/chrome/browser/resources/pdf/pdf_viewer.ts
  25. @@ -269,7 +269,7 @@ export class PdfViewerElement extends PdfViewerBaseElement {
  26. // <if expr="enable_pdf_ink2">
  27. protected pdfInk2Enabled_: boolean = false;
  28. // </if>
  29. - private pdfUseShowSaveFilePicker_: boolean = false;
  30. + private pdfUseShowSaveFilePicker_: boolean = true;
  31. private pluginController_: PluginController = PluginController.getInstance();
  32. protected printingEnabled_: boolean = false;
  33. // <if expr="enable_pdf_ink2">
  34. diff --git a/pdf/pdf_features.cc b/pdf/pdf_features.cc
  35. index 387174b3ee8aa39f0e3c4c67274e8c6b738c889f..a8ee6d48009de8fb10eff8689a694ac2e60a3723 100644
  36. --- a/pdf/pdf_features.cc
  37. +++ b/pdf/pdf_features.cc
  38. @@ -55,7 +55,7 @@ BASE_FEATURE(kPdfTags, "PdfTags", base::FEATURE_DISABLED_BY_DEFAULT);
  39. BASE_FEATURE(kPdfUseShowSaveFilePicker,
  40. "PdfUseShowSaveFilePicker",
  41. - base::FEATURE_DISABLED_BY_DEFAULT);
  42. + base::FEATURE_ENABLED_BY_DEFAULT);
  43. BASE_FEATURE(kPdfUseSkiaRenderer,
  44. "PdfUseSkiaRenderer",