From 7bb5331087248998a5821937f55f1c900d057a00 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 29 Jul 2021 14:27:17 +0200 Subject: [PATCH] XFA - Avoid an error when an exdata is a string (bug 1723114) --- src/core/xfa/template.js | 3 +++ test/pdfs/xfa_bug1722038.pdf.link | 1 + test/test_manifest.json | 8 ++++++++ 3 files changed, 12 insertions(+) create mode 100644 test/pdfs/xfa_bug1722038.pdf.link diff --git a/src/core/xfa/template.js b/src/core/xfa/template.js index 57498b591..21f7e59d5 100644 --- a/src/core/xfa/template.js +++ b/src/core/xfa/template.js @@ -5905,6 +5905,9 @@ class Value extends XFAObject { [$text]() { if (this.exData) { + if (typeof this.exData[$content] === "string") { + return this.exData[$content].trim(); + } return this.exData[$content][$text]().trim(); } for (const name of Object.getOwnPropertyNames(this)) { diff --git a/test/pdfs/xfa_bug1722038.pdf.link b/test/pdfs/xfa_bug1722038.pdf.link new file mode 100644 index 000000000..d800fcaf2 --- /dev/null +++ b/test/pdfs/xfa_bug1722038.pdf.link @@ -0,0 +1 @@ +https://bugzilla.mozilla.org/attachment.cgi?id=9232853 diff --git a/test/test_manifest.json b/test/test_manifest.json index 5dc6d9881..aca8124dc 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -952,6 +952,14 @@ "enableXfa": true, "type": "eq" }, + { "id": "xfa_bug1722038", + "file": "pdfs/xfa_bug1722038.pdf", + "md5": "95170baaade2ab6e1d0372f35db01747", + "link": true, + "rounds": 1, + "enableXfa": true, + "type": "eq" + }, { "id": "xfa_bug1720888", "file": "pdfs/xfa_bug1720888.pdf", "md5": "3a9486b851b7d069c3cb31b0be2bc2ff",