Skip to content

fix(download): keep the download iframe alive after a successful export - #27

Merged
gmaclennan merged 1 commit into
chore/cloudflare-deployfrom
fix/keep-download-iframe
Sep 17, 2026
Merged

gmaclennan merged 1 commit into
chore/cloudflare-deployfrom
fix/keep-download-iframe

Conversation

@gmaclennan

@gmaclennan gmaclennan commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Large exports from iOS Safari came back truncated at an IDAT chunk boundary with no IEND, at 42% and 56% in two runs, even though the page had reported Saved. The page-side sink only learns that the service worker's network consumer has read a chunk, not that it is on disk, and on iOS the download layer buffers well ahead of the disk. Removing the hidden iframe that initiated the download in the export's finally block then made iOS Safari finalise the download with whatever it had flushed.

The iframe now stays in the document after a successful export and is replaced when the next download starts; it is still removed on failure so an aborted export leaves nothing behind. Desktop WebKit, Chromium and Firefox never showed the problem because they finish writing before the page does, so the existing e2e suite covers the unchanged paths only; verification is a re-run of the 1200×1200 mm at 288 dpi export on the phone.

Stack created with GitHub Stacks CLI • Give Feedback 💬

iOS Safari finalises a download when its initiating frame is removed, even
while bytes it has already accepted are still being flushed to disk, so
large exports came out truncated at a chunk boundary although the page had
reported success. The iframe now stays until the next download replaces it
and is only removed on failure.
@gmaclennan
gmaclennan added this pull request to stack #26 September 17, 2026 08:56
@gmaclennan
gmaclennan merged commit 9fdbb63 into master Sep 17, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant