Closed Bug 1719148 Opened 3 years ago Closed 3 years ago

Disabled form fields in PDFs do not contain pre-filled values (values not visible / shown )

Categories

(Firefox :: PDF Viewer, defect, P1)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
94 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox-esr91 --- fixed
firefox89 --- wontfix
firefox90 --- wontfix
firefox91 --- wontfix
firefox92 --- wontfix
firefox93 --- wontfix
firefox94 --- verified

People

(Reporter: Gijs, Assigned: calixte)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files)

Attached image Empty fields (deleted) —

(These steps require an account with ADP in the UK.)

STR:

  1. Log in to the ADP website
  2. Open the P11D form (linked on the right hand side)
  3. Scroll down to section I (second page)
  4. try to read the medical insurance values

ER:
The value of medical insurance given in the PDF is shown

AR:
No value is shown.

Opening the PDF in preview.app, the values show up fine.

Inspecting the PDF.js-generated HTML DOM in Firefox, there is no trace of the values shown in preview (ie the input elements are just empty). Removing the inputs doesn't show otherwise occluded text, either, and trying to search for the relevant values in the DOM inspector yields no hits. I don't know where the discrepancy comes from.

(In reply to :Gijs (he/him) from comment #0)

(These steps require an account with ADP in the UK.)

And it requires your employer to have sent you a P11D form.

Could you alter the form values to remove your personal information and upload the form here?

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

(In reply to :Gijs (he/him) from comment #0)

(These steps require an account with ADP in the UK.)

And it requires your employer to have sent you a P11D form.

Could you alter the form values to remove your personal information and upload the form here?

None of the form values are editable.

You could use a PDF editor, like LibreOffice Draw.

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

You could use a PDF editor, like LibreOffice Draw.

To do this I copied the PDF to a Linux VM where LibreOffice Draw was already installed. This made me notice that the original PDF does not show the relevant text on macOS, nor on Windows, but it shows text on Linux (all in Firefox's PDF.js, for the exact same PDF file - I even checked the sha256 after moving the file through vmware because I was very confused).

If I open the PDF in LibreOffice Draw and export a PDF, the text shows up everywhere (and lots of other bits of the PDF are lost / misaligned) - I don't think it manipulates the PDF in-place, it just re-exports a new PDF, which doesn't have the original problem. If I "Save as" it tries to save a LibreOffice Draw file.

I don't really mind the exact figures on the PDF, so I tried cutting out the first page (which has much more privacy-sensitive data; the second page only has the buggy bit, basically) in Preview.app on my mac, but that too re-encodes the PDF and gets rid of the problem...

Do you have any suggestions on how to debug this further? If there is something that can sort of show me the "markup" of the PDF so I can manually delete the first page, that'd probably do the trick...

Flags: needinfo?(mcastelluccio)

Turns out this is a regression, and I was seeing the correct behaviour on Linux because I was using an old (88) distro build and I was using newer builds on Windows/macOS.

Keywords: regression
Regressed by: 1702796
Has Regression Range: --- → yes

In the builds that work, the form field's input gets a value attribute with the correct value.

I've also noticed something else weird. When the PDF that is broken is saved to my local disk on Windows, when I open the file in a new blank tab on a buggy build, the text does not show up. If I then hit reload, I get a beforeunload prompt ("This page is asking you to confirm that you want to leave"). If I accept, the pdf reloads and then the text does show up. If I reload again, I don't get a beforeunload prompt, and the text stays. If I close the tab, open a new tab, paste the same file: URL back in and load the PDF anew, the text is missing again.

It feels like there's some kind of race condition in PDF.js relating to the display of these values...

:Gijs, can you send me the pdf by mail ?
If not, you can use something like qpdf --stream-data=uncrompress your.pdf newone.pdf to uncompress all the streams in the pdf.
Then you can open the new one using a text editor, if it's readable, you can replace private data with some XXX (use the same number of chars to avoid some wrong positions for the objects in the pdf) and then finally you can attach the pdf here (or send it to me).
You can "cut" the pdf in using pdftk your.pdf cat 1-3 output newone.pdf to just extract pages 1,2 and 3.

Flags: needinfo?(mcastelluccio)

Will take a look at the suggestions in comment #7 ASAP - thanks!

Flags: needinfo?(gijskruitbosch+bugs)

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

OK, I've emailed you the PDF. I did try to remove personal data so I could share it publicly, but even the uncompressed PDF is obfuscated enough (in some cases encoding info 1 character at a time) that it's difficult to ensure there's nothing left...

Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(cdenizet)
Severity: -- → S2
Priority: -- → P2

JS sets the text field as readonly and consequently the annotationStorage is containing { readonly: true } for this annotation.
And we get the value for this annotation:
https://github.com/mozilla/pdf.js/blob/7082ff9bf876b98fbda118cdbd6267d3c0df6948/src/display/annotation_layer.js#L707
but the default value (2nd argument) is not used because the storage contains something for this annotation.
So because of:
https://github.com/mozilla/pdf.js/blob/7082ff9bf876b98fbda118cdbd6267d3c0df6948/src/display/annotation_layer.js#L711
the content is an empty string.
The fix is just to add the default value which are not in the storage to the returned value.
For information I cannot reproduce this bug using pdf.js with a local server, likely because in the built-in viewer the JS stuff is executed before the annotation layer is rendered, I wonder if it matters...

Assignee: nobody → cdenizet
Status: NEW → ASSIGNED
Flags: needinfo?(cdenizet)
Priority: P2 → P1
Commit merged into master by GitHub Authored by Jonas Jenwald (Snuffleupagus)
Depends on: 1732117

:Gijs, could you verify this is fixed for you?

Flags: needinfo?(gijskruitbosch+bugs)

Yes, it works now! 😁🎉

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(gijskruitbosch+bugs)
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Target Milestone: --- → 94 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: