Skip to content

fix: allow PDF viewer to show save file picker - #51042

Merged
ckerr merged 1 commit into
mainfrom
fix-picker-oopif-pdf
Apr 15, 2026
Merged

ckerr merged 1 commit into
mainfrom
fix-picker-oopif-pdf

Conversation

@codebytere

Copy link
Copy Markdown
Member

Description of Change

Closes #51041
Refs CL:6111160

The PDF viewer's "save with changes" feature uses
window.showSaveFilePicker(), but the PDF extension runs in a cross-origin iframe (chrome-extension:// inside the app's origin). Chromium's File System Access API blocks cross-origin subframes from showing file pickers unless the embedder explicitly allows them via ContentClient::IsFilePickerAllowedForCrossOriginSubframe().

Chrome overrides this in ChromeContentClient to allowlist the PDF extension origin, but Electron never did — so the picker was always blocked with a SecurityError.

This adds the same override to ElectronContentClient, allowing the built-in PDF extension origin to bypass the cross-origin check.

Screenshot

Screenshot 2026-04-14 at 2 33 41 PM

Checklist

Release Notes

Notes: Fixed an issue where saving edited PDF files would fail with a cross-origin SecurityError.

The PDF viewer's "save with changes" feature uses
`window.showSaveFilePicker()`, but the PDF extension runs in a
cross-origin iframe (chrome-extension:// inside the app's origin).
Chromium's File System Access API blocks cross-origin subframes from
showing file pickers unless the embedder explicitly allows them via
`ContentClient::IsFilePickerAllowedForCrossOriginSubframe()`.

Chrome overrides this in `ChromeContentClient` to allowlist the PDF
extension origin, but Electron never did — so the picker was always
blocked with a SecurityError.

This adds the same override to `ElectronContentClient`, allowing the
built-in PDF extension origin to bypass the cross-origin check.
@codebytere codebytere added semver/patch backwards-compatible bug fixes target/41-x-y PR should also be added to the "41-x-y" branch. target/42-x-y PR should also be added to the "42-x-y" branch. labels Apr 14, 2026
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Apr 14, 2026
@jkleinsc jkleinsc added the new-pr 🌱 PR opened recently label Apr 15, 2026
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Apr 15, 2026
@ckerr
ckerr merged commit 0227bcf into main Apr 15, 2026
134 of 135 checks passed
@ckerr
ckerr deleted the fix-picker-oopif-pdf branch April 15, 2026 23:04
@release-clerk

release-clerk Bot commented Apr 15, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed an issue where saving edited PDF files would fail with a cross-origin SecurityError.

@trop

trop Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "42-x-y", please check out #51072

@trop trop Bot added in-flight/42-x-y and removed target/42-x-y PR should also be added to the "42-x-y" branch. labels Apr 15, 2026
@trop

trop Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "41-x-y", please check out #51073

@trop trop Bot added in-flight/41-x-y merged/42-x-y PR was merged to the "42-x-y" branch. merged/41-x-y PR was merged to the "41-x-y" branch. and removed target/41-x-y PR should also be added to the "41-x-y" branch. in-flight/42-x-y in-flight/41-x-y labels Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/41-x-y PR was merged to the "41-x-y" branch. merged/42-x-y PR was merged to the "42-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PDF viewer showSaveFilePicker CORS error

3 participants