Closed Bug 1942753 Opened 1 month ago Closed 2 days ago

Not rendering online PDFs in <embed> and <object> tags

Categories

(Firefox :: PDF Viewer, defect)

Firefox 136
defect

Tracking

()

RESOLVED FIXED
137 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox135 --- wontfix
firefox136 + affected
firefox137 + fixed

People

(Reporter: kb, Assigned: nika, NeedInfo)

References

(Regressed 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(8 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:136.0) Gecko/20100101 Firefox/136.0

Steps to reproduce:

I’ve noticed that Firefox Nightly 136.0a1 no longer renders PDFs when hosted online. My online banking PDFs stopped showing up since 3-4 weeks, which led me to investigate.

I created a minimal test case here: https://a0a6.com/pdf-debug/

Actual results:

Running the example locally by file, both the <embed> and <object> tags work fine, but when hosted on a web server (calling my URL from above), neither works in Nightly.

Expected results:

However, in regular Firefox 134, both methods work as expected, both online and offline.

Summary: Firefox Nightly stopped rendering online PDFs → Not rendering online PDFs in <embed> and <object> tags
Component: Untriaged → PDF Viewer

Moved to the PDF Viewer component to be triaged.

Klaus, thanks for the report. I was unable to reproduce this in nightly 136.0a1. The PDF renders correctly for me.
If you are willing to try, you could use mozregression to narrow down which recent change introduced this
https://mozilla.github.io/mozregression/quickstart.html

Did you disable PDF.js by any chance? (the pdfjs.disabled pref in about:config)

Flags: needinfo?(kb)

(In reply to Marco Castelluccio [:marco] from comment #3)

Did you disable PDF.js by any chance? (the pdfjs.disabled pref in about:config)

pdfjs.disabled is false. ( I usually do not tinker around in those settings as I prefer vanilla :) )

Flags: needinfo?(kb)

(In reply to Donal Meehan [:dmeehan] from comment #1)

Moved to the PDF Viewer component to be triaged.

Klaus, thanks for the report. I was unable to reproduce this in nightly 136.0a1. The PDF renders correctly for me.
If you are willing to try, you could use mozregression to narrow down which recent change introduced this
https://mozilla.github.io/mozregression/quickstart.html

When I use the latest build without my profile, it works. When I use it with my profile, I still have the same issue of not rendering.

So I removed my profile ( I have a backup) and created a new one. Now everything works (again). I just found it suspicious that it broke on two different computers at the same time. Let me know if I should try something out on my other one.

Are using sync between these two profiles? Or have the same extensions? Would you mind attaching your about:support information?

Attached file about:support
I do not sync my profiles, if you mean rsync or something. However, I do use the same Mozilla Account to sync bookmarks, etc. Resetting the profile brought relief to one computer. The other (though synced by the Mozilla account) still has the issue. Here is the about:support from the computer with the issue.

The bug came again. 136.0a1 (2025-02-02) (aarch64)

deleted the profile, pdfs are displayed.

Immediatly after syncing my bookmarks and everything via mozilla account, the issue is back again.

Maybe there's some pref in your profile that is causing this.

Hello! Thank you for submitting this issue I have tried to reproduce the issue on my end but unfortunately I wasn't able to with firefox 136.0a1(2025-02-03) on Ubuntu 22.04
Could you please answer the following questions in order to further investigate this issue?

  1. Does this issue happen with a new profile? Here is a link on how to create one: https://support.mozilla.org/en-US/kb/profile-manager-create-remove-switch-firefox-profiles
  2. Does this issue happen in the latest nightly? Here is a link from where you can download it: https://www.mozilla.org/en-US/firefox/channel/desktop/
  3. Do you have any addons installed? If yes could you please list them?
Flags: needinfo?(kb)

(In reply to Marco Castelluccio [:marco] from comment #12)

Maybe there's some pref in your profile that is causing this.

I had created a new profile previously. I now create a new profile without deleting the old one (including the profile.ini). Lets see, what happens..

Flags: needinfo?(kb)

(In reply to Negritas Sergiu, Desktop QA from comment #13)

Hello! Thank you for submitting this issue I have tried to reproduce the issue on my end but unfortunately I wasn't able to with firefox 136.0a1(2025-02-03) on Ubuntu 22.04
Could you please answer the following questions in order to further investigate this issue?

  1. Does this issue happen with a new profile? Here is a link on how to create one: https://support.mozilla.org/en-US/kb/profile-manager-create-remove-switch-firefox-profiles
  2. Does this issue happen in the latest nightly? Here is a link from where you can download it: https://www.mozilla.org/en-US/firefox/channel/desktop/
  3. Do you have any addons installed? If yes could you please list them?
  1. I have deleted my profile completly on one of the computers (including the profile.ini). Now I am trying with a new profile without deleting the old one.
  2. yes.
  3. My Extensions:

1Password – Passwort-Manager extension 8.10.58.41 true {d634138d-c276-4fc8-924b-40a0ea21d284}
Add-ons Search Detection extension 2.0.0 true addons-search-detection@mozilla.com
Facebook Container extension 2.3.11 true @contain-facebook
Firefox Multi-Account Containers extension 8.2.0 true @testpilot-containers
Google Analytics Debugger extension 2.8.2 true {ca6be013-d122-41e1-a41e-98092dfff1e3}
Grammarly: AI Writing and Grammar Checker App extension 8.927.0 true 87677a2c52b84ad3a151a4a72f5bd3c4@jetpack
LetyShops — Cashback Service extension 5.0.3 true cashback_letyshops@LetyShops
Open bookmark in Container Tab menu item extension 1.3 true bookmark-menu-container@robwu.nl
Temporary Containers extension 1.9.2 true {c607c8df-14a7-4f28-894f-29e8722976af}
To Google Translate extension 4.2.0 true jid1-93WyvpgvxzGATw@jetpack
Wappalyzer - Technology profiler extension 6.10.77 true wappalyzer@crunchlabz.com
Dunkel theme 1.3.2 true firefox-compact-dark@mozilla.org
uBlock Origin extension 1.62.0 false uBlock0@raymondhill.net
Firefox Alpenglow theme 1.5 false firefox-alpenglow@mozilla.org
Hell theme 1.3 false firefox-compact-light@mozilla.org
System-Theme – automatisch theme 1.4.1 false default-theme@mozilla.org

I can confirm this issue and we are now getting multiple reports that corroborate this, see https://github.com/paperless-ngx/paperless-ngx/discussions/9022#discussioncomment-12071021

Here you can see the issue being re-created using the link posted by Klaus above, tested using BrowserStack:

https://bugzilla.mozilla.org/attachment.cgi?id=9464097
vs
https://bugzilla.mozilla.org/attachment.cgi?id=9464098

:Klaus, what's the default pdf handler you set in your settings (in the hamburger menu (top right button), then Settings, then section Files and Applications) ?

Flags: needinfo?(kb)

Getting this on a new Firefox profile with Arch linux after upgrading to Firefox 135.0. Firefox 134.0.2 works fine.

I see "NS_ERROR_WONT_HANDLE_CONTENT" in the transferred column on the network tab.

:bytesized, were there any changes on your side about the pdf handler which could explain this behavior ?

Flags: needinfo?(bytesized)

Not that I know of.

Flags: needinfo?(bytesized)

:bytesized, where is the pdf handler value stored ? I'm not able to find it in about:config.
If it's outside Firefox, would it be possible that it has been reset to another value by the OS or something else ?

Flags: needinfo?(bytesized)

I'm not sure what you mean by "the pdf handler value". Could you elaborate?

Flags: needinfo?(bytesized)

(In reply to Calixte Denizet (:calixte) from comment #21)

:Klaus, what's the default pdf handler you set in your settings (in the hamburger menu (top right button), then Settings, then section Files and Applications) ?

OH. This is the issue!

If I make it "save file," it will not display the pdf on the example website.
If I "display in nightly," it will show the pdf on the example websites.

Flags: needinfo?(kb)

:bytesized, I meant the name of the pdf handler or whatever stuff used to open it in case of downloading a pdf, sorry about the confusion (I hope I'm more clear, else ping me on slack or element).

Part of why I'm struggling here is that I can think of two different things you could be referring to: The setting that controls what Firefox does when it opens a PDF, and the setting that the operating system uses to control what the operating system does with a PDF when the user requests one be opened.

The former is stored somewhere in Firefox. That's not really my team's wheelhouse, but glancing through the code, it looks like it's being stored in a JSON file in the profile directory.

The latter is stored somewhere in the operating system. I'm not sure exactly where and I'm sure it varies from OS to OS.

Hey all, the new firefox update hit me and now I am also experiencing this exact issue on two windows devices (one firefox and one librewolf).

User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0

I can confirm the embed issue is fixed when PDFs are set to Open in Firefox.
When set to any other option (Always ask, Save file, Use Windows default application, Use other...) the embed issue comes back.

I can confirm this issue happened as soon as I restarted the browser to update to v135.0 (firefox) and v135.0-1 (librewolf).

The workaround I use for now is setting "Open In FIrefox" for PDFs under the Applications section in the preferences, then in about:config, set browser.download.force_save_internally_handled_attachments to true. This lets me view embedded pdfs and gives me my download popup window back when clicking pdf links. I suppose this won't work for you if you preferred the "Always Ask" dialog, which gives more options.

Status: UNCONFIRMED → NEW
Component: PDF Viewer → File Handling
Ever confirmed: true
See Also: → 1948494
See Also: → 1948670

It appears that my changes revealed an old bug in the stream converter logic for pdf.js. Specifically, the pdf.js converter logic would fail in the case where we load a pdf.js file in an object/embed element if it is happening in the parent process. This would be interpreted as an error, so we wouldn't process-switch, and then because we always succeeded in the content process, we'd render it inline in the content process.

My change made it more consistent between the two processes how we want to handle the network request, meaning that we now fail to load across the board in that case.

The easiest fix here is probably to add a check in PdfStreamConverter.sys.mjs to always allow the stream converter to run for object/embed loads.

Assignee: nobody → nika
Flags: needinfo?(nika)

Before the regressing change, we were accidentally enabling pdf.js for
object/embed loads due to the parent process thinking the load has
failed, and the content process coming to a different conclusion.

This check ensures that we always enable pdf.js within object/embed
elements so that the pdfs are rendered as expected.

This does not impact pdfs loaded in other places which could otherwise
be handled externally, such as in iframes.

Keywords: regression
Regressed by: 1918167
Duplicate of this bug: 1948670
See Also: 1948670
Status: NEW → ASSIGNED
Component: File Handling → PDF Viewer

Set release status flags based on info from the regressing bug 1918167

: --- → affected
: --- → affected
: --- → affected
Attachment #9467246 - Attachment description: Bug 1942753 - Always enable the pdf.js stream converter for object/embed elements, r=calixte → Bug 1942753 - Always enable the pdf.js stream converter for object/embed elements, r=#pdfjs-reviewers
Duplicate of this bug: 1948986

Tracking for the releases in flight. This bug should have a priority and severity set.

: --- → +
: --- → +

Given the number of duplicates in the relatively short timeframe, it seems frequent enough to warrant S2.

Severity: -- → S2
Attachment #9467246 - Attachment description: Bug 1942753 - Always enable the pdf.js stream converter for object/embed elements, r=#pdfjs-reviewers → Bug 1942753 - Always enable the pdf.js stream converter for object/embed elements, r=calixte
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9f817223bb7e Always enable the pdf.js stream converter for object/embed elements, r=pdfjs-reviewers,calixte
Regressions: 1949503
Status: ASSIGNED → RESOLVED
Closed: 2 days ago
Resolution: --- → FIXED
Target Milestone: --- → 137 Branch

:nike could you add an uplift request on this when you have a moment? We could include it in 136.0 RC1 depending on the risk

Flags: needinfo?(nika)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: