[Bug] Firefox Fenix crashes when trying to open a PDF file hosted in a GitLab repository
Steps to reproduce
Navigate to a GitLab project that has pushed a PDF file in it. Click on the file and wait for the page to load.
Expected behavior
The GitLab PDF viewer should display the uploaded PDF file, after Firefox has fully finished loading the page.
Actual behavior
Firefox tries to load the page, but fails. During the initial attempt, the loading process is interrupted and an about:blank page is loaded instead, after which the browser tries loading the page with the PDF for a second time. During this second load attempt, the browser crashes to the Android home screen without any error messages.
Device information
- Android device: Nokia 8, Android 9 with the 2020-07-01 security update.
- Fenix version: 81.1.4, build #2015768387
┆Issue is synchronized with this Jira Task
@SeSodesa thanks for the report!
@SeSodesa could you share the link of the document? We did some improvement on nightly.If it's not much trouble would you mind trying it on nightly? :)
@SeSodesa could you share the link of the document? We did some improvement on nightly.If it's not much trouble would you mind trying it on nightly? :)
I am unable to link to the specific document, as it is in a private repository. I tried loading the page on nightly, but the same thing happened again: two load attempts, the first one fails and then the second one crashes the browser. The only thing that was maybe a little different was that the about:blank page didn't flash on screen visibly, before the second load attempt.
I should mention, that the culprit PDF size is roughly 1 MB. I don't know if GitLab does something special to prevent larger documents from loading and the failure occurs because of that, but it might be something to look into.
Don't worry, thanks for the info. There is a way to send us the crash, you have to go to: the three dotted menu -> Settings -> About Firefox Nightly -> Crashes
Each item has a share button, you could share it to the clipboard or another app that allows you to copy it and paste it here.
Thanks in advance!
@SeSodesa we did some improvements in nightly could you verify if this is still an issue? I will ask to the QA team to help us to verify too.
The issue still persists with the ~1.3MB file. I tried it with a different, much smaller PDF file (~20kB) as well and it has no trouble loading.
The file size might be an issue, then. Both have embedded vector graphics (Matplotlib or TikZ/PGF images), so that can't be the issue.
Also, the About Firefox Nightly > Crashes page shows a message "No crash reports have been submitted.".
I had tested this issue on Release 81.1.4 from 10/07 and the latest Nightly 201118 GV 85 from 11/18 with Motorola Moto G6 (Android 8) and Huawei P9 Lite (Android 7) and I can reproduce it following the steps:
- Launch Fenix and go to https://gitlab.com/SeppPenner/PySimpleGUI/-/blob/master/YoloObjectDetection/cv_dl_resource_guide.pdf
- Tap on Download button;
- Observe the behavior.
The page becomes blank and sometimes the app is closing but is still in the Recent Apps list.

This is not reproducible on Pixel 2 (Android 9). I will remove the qa:needed label for now.
After some debugging, I noticed the error doesn't have to do with the download process, it's linked to the embedded PDF viewer. I'm able to replicate the issue using an Android 8 emulator just by loading the page and trying to scroll the page after the first page of the PDF is rendered. As it's a native crash I opened a bug for the GV team to take a look https://bugzilla.mozilla.org/show_bug.cgi?id=1687333
This is a heavy page, and some older phones cannot handle it. That's OK, there's nothing really that we can do about not crashing in this case. Chrome also crashes on this page.
@Amejia481 The only thing we should do is display an error page when the content process gets killed while it's displaying a foreground page, this matches what Chrome does, so at least we don't kill the whole browsing session.
Note that sometimes the main process gets killed instead of the content process, in that case there's no way to recover, and that's fine, Chrome also sometimes gets killed outright for the same reason.

This is a heavy page, and some older phones cannot handle it. That's OK, there's nothing really that we can do about not crashing in this case. Chrome also crashes on this page.
@Amejia481 The only thing we should do is display an error page when the content process gets killed while it's displaying a foreground page, this matches what Chrome does, so at least we don't kill the whole browsing session.
Note that sometimes the main process gets killed instead of the content process, in that case there's no way to recover, and that's fine, Chrome also sometimes gets killed outright for the same reason.
Thanks for investigating! Do you have a callback on gv for detecting when that happens?
Yes GeckoSession.ContentDelegate.onKill: https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.ContentDelegate.html#onKill-org.mozilla.geckoview.GeckoSession-
You have to check in Fenix/AC that the session that received onKill is the one being displayed, and if so, display an error page similar to Chrome above
Thanks! I opened this issue for handling this case https://github.com/mozilla-mobile/fenix/issues/17698