[Android] Share | Save-as-PDF fails to save a file (reported as "Download Completed (0.00 KB)" but really no file gets generated)
Categories
(Firefox for Android :: Downloads, defect)
Tracking
()
People
(Reporter: tfpbcd, Assigned: npoon)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [fxdroid] [group4])
Attachments
(6 files)
299.19 KB,
image/png
|
Details | |
2.72 MB,
video/mp4
|
Details | |
3.67 MB,
video/mp4
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-beta+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-release+
|
Details | Review |
Clone of https://bugzilla.mozilla.org/show_bug.cgi?id=1949200
I cannot reopen the original bug.
I tested on multiple android phones.
Steps to reproduce:
Firefox share page > Save as PDF
Confirm the size of the document is 0 byte
Confirm that there is no file saved on the phone
Actual results:
The Firefox can only print "Zero Bytes" PDFs for several months
Expected results:
Normal PDFs should be printed out with contents and should be able to be opened by Preview
Updated•17 days ago
|
Comment 1•17 days ago
|
||
Thanks, I can reproduce that. (It's good that we didn't reopen bug 1949200, since this is a different underlying issue from what was happening there; the reporter in that bug was dependent on a particular extension to trigger the issue, and that's not the case here.)
Regression range, bisecting Firefox-for-Android Nightly builds with mozregression:
Newest known good nightly: 2025-02-03
Oldest known bad nightly: 2025-02-04
Pushlog: https://hg-edge.mozilla.org/mozilla-central/pushloghtml?fromchange=29c957dc0c6f&tochange=1a07567906ae
Comment 2•17 days ago
|
||
Given that this was an Android-specific regression and it broke save-as-PDF for every page (rather than for particular special bits of pathological content), I'm suspicious that this would be some sort of Android-specific change.
In the pushlog, bug 1912455 looks like a possible culprit - it's about file-downloads and specifically about an edge-casey scenario when a download reaches 100%, and in this case save-as-PDF represented as a PDF that ~instantly jumps to 100%, so maybe it's
I don't know that code, but I do notice that it added an early-return from performDownload
, to make us bail out if we happen to get a call to that function when we've reached 100%.
Assuming that save-as-PDF actually exercises that code, I wonder if maybe we're running into trouble because the early-return is preventing us from getting to some important piece that has to happen at least once, later in the function?
npoon, it looks like you've got some experience with file downloads and save-as-PDF - maybe you could take a look here?
Updated•17 days ago
|
Comment 3•17 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Downloads' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 4•17 days ago
•
|
||
I think more generally, actual zero-byte downloads are broken entirely right now, too - they don't generate any file at all on your filesystem, likely due to this same bug.
STR:
- Click this link (or paste it into your URLbar and submit): https://dholbert.org/zero.zip (this is just an 0-byte empty file)
- Click through any UI to confirm that you'd like to download the file.
- Open your Android file-explorer program (e.g. "Files" on pixel phones) to check for the file in your downloads folder.
ACTUAL RESULTS:
No such file.
EXPECTED RESULTS:
File should be there. (with a size of 0 bytes)
Firefox Nightly gives ACTUAL RESULTS.
Chrome gives EXPECTED RESULTS. (It shows "download error" in the system tray, presumably because it assumes that the 0-byte file size means that something went amiss, but in fact it does successfully "download" the 0-byte file and generate a file on my filesystem.)
I think this^ bug and the PDF bug are versions of the same issue -- files that download ~instantly don't actually get created, possibly because they never get beyond the very start of performDownload
as hypothesized above.
Assignee | ||
Comment 9•17 days ago
|
||
Thanks for flagging this Daniel! I will add this bug into our next sprint and if I don't take a look at it, someone else on my squad will :)
Assignee | ||
Updated•17 days ago
|
Assignee | ||
Updated•16 days ago
|
Assignee | ||
Updated•16 days ago
|
Updated•16 days ago
|
Assignee | ||
Updated•16 days ago
|
Assignee | ||
Comment 10•16 days ago
•
|
||
Hey Daniel,
When you were bisecting this with moz-regression, did you try to open the file (from save as PDF) after a successful download. I tried removing the early return and I see that the prompt shows that the webpage pdf downloads successfully but upon opening the file, it can't be displayed
Comment 11•16 days ago
|
||
Yes - Nightly 2025-02-03 (last good build from comment 1) generates a PDF file that opens just fine.
Comment 12•16 days ago
|
||
For reference: here's a screencast captured from mozregression-launched Nightly 2025-02-04, showing the "bad" results.
Updated•16 days ago
|
Comment 13•16 days ago
•
|
||
For reference: here's a screencast captured from mozregression-launched Nightly 2025-02-03, showing the "good" results -- notably:
- Nonzero size reported for the PDF file
- The generated PDF successfully opens in Firefox Nightly when I tap through the "Download completed" toast.
- The generated PDF shows up in my file viewer application and successfully opens in a 3rd-party PDF viewer when I tap to open it there.
(Note, my Downloads folder was empty when I started this screen recording, so the PDF that ends up being listed there really is the one that this Nightly generated during the screencast.)
Comment 14•15 days ago
|
||
I can confirm the Bug (using Firefox 137.0.2) as described here.
A workaround that works for me on a Samsung phone:
Open a website (wikipedia.org), then in the ⋮-Menu tap on "🖨️ Print" and select "Save as PDF" as printer, then tap the yellow ⤓PDF-Button.
Comment 15•14 days ago
|
||
The workaround works for me too, thanks Chris. W!
Assignee | ||
Comment 16•13 days ago
•
|
||
Just did some investigation. We have multiple issues here.
- Save as PDF results in 0B and PDF is not shown in downloads directory. This issue was regressed by Bug 1912455 in Fx 137.
- PDF is malformed when being saved through Save as PDF or Print. This issue was regressed since Fx 139. I ran a moz-regression with the following results:
Newest known good nightly: 2025-04-14
Oldest known bad nightly: 2025-04-15
a. If trying to save as PDF, you will not be able to open the saved file (through fenix or external application) because the PDF is malformed
b. If trying to print PDF, android will open the print page. It will try to generate a preview of the page. This is not possible because of the malformed PDF so the app will then crash withjava.lang.RuntimeException: Cannot print a malformed PDF file
Comment 17•13 days ago
|
||
Note that bug 1961443 is currently being tracked as an Android topcrash at the moment.
Assignee | ||
Comment 18•12 days ago
|
||
I have found the regression of issue number 2 from comment 16. Setting the regression fields to reflect this - Bug 1841946.
I can fix issue 1 but I'm not as familiar with toolkit. Can the author of the regressor take a look please?
Comment 19•12 days ago
|
||
We need two bugs for the two issues. Will this bug be about issue 1 or issue 2?
Comment 20•12 days ago
|
||
We also need a test that would have caught issue 2.
Assignee | ||
Comment 21•12 days ago
|
||
Thanks for calling this out Markus! I was thinking about a test for issue 2 as well. I will file this soon.
Let's make this bug about issue 1 and Bug 1961443 can be about issue 2 then
Assignee | ||
Updated•12 days ago
|
Assignee | ||
Comment 22•12 days ago
|
||
(In reply to Markus Stange [:mstange] from comment #20)
We also need a test that would have caught issue 2.
I addressed this over in Bug 1961443 since this focuses on issue 2
Assignee | ||
Comment 23•12 days ago
|
||
Revert Bug 1912455
Comment 24•11 days ago
|
||
Assignee | ||
Comment 25•10 days ago
|
||
Comment on attachment 9484389 [details]
Bug 1962075 - Fetch download even if content length is equal to current bytes copied
Beta/Release Uplift Approval Request
- User impact if declined/Reason for urgency: Users won't be able to save webpages as PDFs. There have been lots of complains about this on the Google Play store.
- Is this code covered by automated tests?: No
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: 1. Go to wikipedia.org
- Click the share icon
- Click save as PDF
- Download the PDF
- Open the PDF and verify that it can be opened
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky):
- String changes made/needed:
- Is Android affected?: Yes
Assignee | ||
Updated•10 days ago
|
Assignee | ||
Comment 26•10 days ago
|
||
Comment 27•10 days ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Users won't be able to save webpages as PDFs. There have been lots of complains about this on the Google Play store.
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: Go to wikipedia.org. Click the share icon. Click save as PDF. Download the PDF. Open the PDF and verify that it can be opened
- Risk associated with taking this patch: Low
- Explanation of risk level: The feature is already broken on beta
- String changes made/needed: N/A
- Is Android affected?: yes
Assignee | ||
Comment 28•10 days ago
|
||
Original revision: https://phabricator.services.mozilla.com/D247174
Comment 29•10 days ago
|
||
firefox-release Uplift Approval Request
- User impact if declined: Users won't be able to save webpages as PDFs. There have been lots of complains about this on the Google Play store.
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: Go to wikipedia.org. Click the share icon. Click save as PDF. Download the PDF. Open the PDF and verify that it can be opened
- Risk associated with taking this patch: Low
- Explanation of risk level: The feature is already broken on release
- String changes made/needed: N/A
- Is Android affected?: yes
Assignee | ||
Comment 30•10 days ago
|
||
Just closing the loop here, it turns out that issue 2 only happens on certain websites. It's only for FT
fonts
Comment 31•10 days ago
|
||
firefox-release Uplift Approval Request
- User impact if declined: Users won't be able to save webpages as PDFs. There have been lots of complains about this on the Google Play store.
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: Go to wikipedia.org. Click the share icon. Click save as PDF. Download the PDF. Make sure that the download completed dialog shows a file size that isn't 0B. Open the PDF and verify that it can be opened
- Risk associated with taking this patch: Low
- Explanation of risk level: The feature is already broken on release
- String changes made/needed: N/A
- Is Android affected?: yes
Comment 32•10 days ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined: Users won't be able to save webpages as PDFs. There have been lots of complains about this on the Google Play store.
- Code covered by automated testing: no
- Fix verified in Nightly: no
- Needs manual QE test: yes
- Steps to reproduce for manual QE testing: Go to wikipedia.org. Click the share icon. Click save as PDF. Download the PDF. Make sure that the download completed dialog shows a file size that isn't 0B. Open the PDF and verify that it can be opened (depends on Bug 1961443)
- Risk associated with taking this patch: Low
- Explanation of risk level: The feature is already broken on beta
- String changes made/needed: N/A
- Is Android affected?: yes
Updated•10 days ago
|
Updated•10 days ago
|
Comment 33•10 days ago
|
||
uplift |
Updated•10 days ago
|
Comment 34•10 days ago
|
||
bugherder |
Comment 35•6 days ago
|
||
Verified as fixed on the latest Firefox Beta 139.0b3, and on Nightly 140.0a1.
Tested with Xiaomi Mi8 Lite 9Android 10), Google Pixel 6 (Android 16), and Samsung Galaxy Tab S9 Ultra (Android 14).
Saving a Wikipedia page as a PDF is working correctly. The downloaded PDF can be opened without issues.
Updated•2 days ago
|
Updated•2 days ago
|
Updated•2 days ago
|
Comment 38•2 days ago
|
||
uplift |
Updated•2 days ago
|
Description
•