"Unable to generate PDF"/"Unable to print" Error when the Content Frame is not Selected During Save to PDF/Printing
Categories
(GeckoView :: PDF Viewer, defect, P1)
Tracking
(firefox110 wontfix, firefox113 wontfix, firefox114 wontfix, firefox116 wontfix, firefox117 wontfix, firefox118 fixed)
People
(Reporter: dpop, Assigned: olivia)
References
Details
(Whiteboard: [PDF reader][geckoview:m113][geckoview:m114][geckoview:m115][geckoview:m117?][geckoview:m118][fxdroid][foundation])
Attachments
(4 files)
Steps to reproduce
- In about:config, set the pdfjs.disabled pref to false.
- Open a PDF file.
- Tap on the 3 dot-menu > Tap on the Share icon > Tap on "Save as PDF" option.
- Observe the error displayed at the bottom of the page.
Expected behavior
A download dialogue is displayed.
Actual behavior
The "Unable to generate PDF" error is sometimes displayed when attempting to save a PDF.
Device information
- Firefox version: Nightly 110.0a1 from 01/10
- Android device model: Google Pixel 6,
- Android OS version: Android 13
Any additional information?
Clear STR could not be established since the error was only displayed on a several occasions, of different PDF files which could be downloaded in previous sessions.
Note that upon receiving the error, the PDF can be downloaded after performing some scrolling on the PDF before attempting to save the PDF again.
Assignee | ||
Comment 2•2 years ago
|
||
I was able to replicate this behavior on a regular website HTML page as well as a .pdf through:
- Navigate to any website, I used www.mozilla.org
- Avoid touching the content frame. (Works as expected if the content frame is touched.)
- Dot menu -> Share -> Save as PDF
Assignee | ||
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Should we consider this bug for 111?
Updated•2 years ago
|
Comment 4•2 years ago
|
||
Updating this to the GeckoView product just to prevent it from accidentally falling into Experience team backlog.
Assignee | ||
Comment 5•2 years ago
|
||
I looked a little more into this when looking at bug 1814064, which I think is related. It is erroring out around here for both bugs. Also, the InputStream stream
needs to be explicitly closed before completing exceptionally - saw a log warning.
I had more issues reproducing this exactly in an emulator than I did when testing on a real device (still possible, but not as easy to replicate), just mentioning for future reference.
Comment 6•2 years ago
|
||
Removing this from blocking bug 1803753 because this is not specific to PDFs.
Assignee | ||
Comment 7•2 years ago
|
||
I'm looking into this primary attribute, which could be the main reason GetContentCanonicalBrowsingContext fails. Nika recommended looking into this attribute on the Fission Matrix channel, for more info.
primary
is used on desktop to track tab state; however, GeckoView follows a one window = one tab pattern. It seems like it may be safely removed, but the removal requires more investigation. Early testing looked like it solves the "Unable to Generate PDF" issue in this case, but I need to test more on a real device.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•1 years ago
|
Assignee | ||
Comment 8•1 years ago
|
||
Still investigating how best to solve the bug. Setting it as P2 for now, since I'm working on a few other bugs first. I can confirm the primary attribute state is a root cause of this bug and found a consistent reproduction of the bug.
How to Reproduce Consistently:
- Open a tab, e.g. mozilla.org (Tab 1)
- Make a new tab, e.g., getpocket.com (Tab 2), and quickly switch back to Tab 1 from Tab 2, before Tab 2 completes loading
- After switching back to Tab 1, ... -> Share -> Save to PDF
- Bug should reproduce at this point. If the bug doesn't reproduce, try loading a larger page in Tab 2 and switching back to Tab 1. May also need to avoid touching the browser frame (only touch toolbar).
- Sometimes, after causing this state, the bug will consistently happen.
Items to continue investigating:
- Investigate why non-primary/primary is set to begin with in GeckoView
- Investigate setFocused callers
- Investigate what is occurring in Fenix:
- Is the app purposely unsetting focus?
- Is the app not setting focus on a tab switch, if something else is loading in the background?
- Is something else taking the focus on Android, which then causes the browser focus to be lost/unset? (i.e., the other tab or a menu?)
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 10•1 year ago
|
||
I think this bug might impact bug 1808755 for printing too because they both get the browsing context similarly.
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Assignee | ||
Comment 11•1 year ago
|
||
Steps to Reproduce Unable to Print:
- Open a page, e.g., wikipedia.org
- Touch empty content area to gain focus
- New tab, e.g., google.com (do not touch content)
- Return to first page, e.g. wikipedia.org
- Attempt to print, will receive "Unable to Print" error
Assignee | ||
Comment 12•1 year ago
|
||
The canonical browsing context is not available if the current window/tab
is not focused for printing or saving as a PDF.
This patch adds a call to setFocused
before creating a Gecko PDF to
ensure the canonical browsing context can be used for generating a PDF
to save or print.
Assignee | ||
Updated•1 year ago
|
Comment 13•1 year ago
|
||
Comment 14•1 year ago
|
||
bugherder |
Description
•