Skip to content

Add a 'supportsDownloading' browser option to gate saving/downloading - #21310

Merged
calixteman merged 1 commit into
mozilla:masterfrom
calixteman:dont_save
Jun 18, 2026
Merged

calixteman merged 1 commit into
mozilla:masterfrom
calixteman:dont_save

Conversation

@calixteman

Copy link
Copy Markdown
Contributor

Introduces a 'supportsDownloading' browser option (defaulting to false) that lets embedders disable the save/download paths entirely. When disabled:

  • the toolbar and secondary-toolbar download buttons are hidden;
  • PDFViewerApplication.{download,save,downloadOrSave} and the "beforeunload" save prompt bail out early;
  • the BaseDownloadManager helpers (download, downloadData, openOrDownloadData) and the Firefox/generic _triggerDownload implementations no-op.

Comment thread web/app_options.js Resolved
@codecov-commenter

codecov-commenter commented May 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.79%. Comparing base (2ed018e) to head (ece1e2e).

Files with missing lines Patch % Lines
web/app.js 90.47% 2 Missing ⚠️
web/pdf_attachment_viewer.js 0.00% 1 Missing ⚠️
web/pdf_outline_viewer.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #21310      +/-   ##
==========================================
- Coverage   89.80%   89.79%   -0.01%     
==========================================
  Files         260      260              
  Lines       66058    66078      +20     
==========================================
+ Hits        59321    59333      +12     
- Misses       6737     6745       +8     
Flag Coverage Δ
browsertest 66.90% <ø> (-0.01%) ⬇️
integrationtest 68.91% <82.60%> (+<0.01%) ⬆️
unittest 57.22% <ø> (+<0.01%) ⬆️
unittestcli 56.18% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread web/app.js Resolved

@timvandermeij timvandermeij left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, with one comment. Thank you for implementing this!

Comment thread test/integration/viewer_spec.mjs Resolved
Introduces a 'supportsDownloading' browser option (defaulting to false)
that lets embedders disable the save/download paths entirely. When
disabled:
  - the toolbar and secondary-toolbar download buttons are hidden;
  - PDFViewerApplication.{download,save,downloadOrSave} and the
    "beforeunload" save prompt bail out early;
  - the BaseDownloadManager helpers (download, downloadData,
    openOrDownloadData) and the Firefox/generic _triggerDownload
    implementations no-op.
@calixteman
calixteman merged commit 187c221 into mozilla:master Jun 18, 2026
17 checks passed
@calixteman
calixteman deleted the dont_save branch June 18, 2026 13:36

This branch was previously deployed

1 inactive deployment
code-coverage — ece1e2ed Deployed Jun 18, 2026 by calixteman via windows-latest / chrome #777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants