summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_dataavail.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-01 17:42:33 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-01 17:42:33 +0000
commitb80edf3fcb286c3265341c8905f0885c1d535d08 (patch)
tree9447b51c1487d26821631645297ad86c2e7a091f /fpdfsdk/fpdf_dataavail.cpp
parent3018c1c7323a1aa9fd89c7de5420ed925b5b6611 (diff)
downloadpdfium-b80edf3fcb286c3265341c8905f0885c1d535d08.tar.xz
Creating XFA context shouldn't be a side-effect of FPDF_* conversion.
Create it explicitly as needed. Change-Id: I42d5a6f33bc32e7fb768bed96aa6d239d133467e Reviewed-on: https://pdfium-review.googlesource.com/33350 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_dataavail.cpp')
-rw-r--r--fpdfsdk/fpdf_dataavail.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index 6f201d69f1..d7bcf8f5c7 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -17,6 +17,10 @@
#include "public/fpdf_formfill.h"
#include "third_party/base/ptr_util.h"
+#ifdef PDF_ENABLE_XFA
+#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
+#endif // PDF_ENABLE_XFA
+
// These checks are here because core/ and public/ cannot depend on each other.
static_assert(CPDF_DataAvail::DataError == PDF_DATA_ERROR,
"CPDF_DataAvail::DataError value mismatch");
@@ -153,6 +157,11 @@ FPDFAvail_GetDocument(FPDF_AVAIL avail, FPDF_BYTESTRING password) {
ProcessParseError(error);
return nullptr;
}
+
+#ifdef PDF_ENABLE_XFA
+ document->SetExtension(pdfium::MakeUnique<CPDFXFA_Context>(document.get()));
+#endif // PDF_ENABLE_XFA
+
CheckUnSupportError(document.get(), FPDF_ERR_SUCCESS);
return FPDFDocumentFromCPDFDocument(document.release());
}