Commit a69e93f6 authored by spelchat's avatar spelchat Committed by Commit bot

Call FPDFAvail_IsFormAvail() before creating form.

FPDFAvail_IsFormAvail() must be called before the PDF form is
initialized if new data was downloaded since the document was created.

BUG=572943

Review URL: https://codereview.chromium.org/1556603002

Cr-Commit-Position: refs/heads/master@{#367191}
parent d6da931d
...@@ -2599,12 +2599,13 @@ void PDFiumEngine::ContinueLoadingDocument( ...@@ -2599,12 +2599,13 @@ void PDFiumEngine::ContinueLoadingDocument(
permissions_handler_revision_ = FPDF_GetSecurityHandlerRevision(doc_); permissions_handler_revision_ = FPDF_GetSecurityHandlerRevision(doc_);
if (!form_) { if (!form_) {
// Only returns 0 when data isn't available. If form data is downloaded, or int form_status =
// if this isn't a form, returns positive values. FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_);
if (!doc_loader_.IsDocumentComplete() && bool doc_complete = doc_loader_.IsDocumentComplete();
!FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { // Try again if the data is not available and the document hasn't finished
// downloading.
if (form_status == PDF_FORM_NOTAVAIL && !doc_complete)
return; return;
}
form_ = FPDFDOC_InitFormFillEnvironment( form_ = FPDFDOC_InitFormFillEnvironment(
doc_, static_cast<FPDF_FORMFILLINFO*>(this)); doc_, static_cast<FPDF_FORMFILLINFO*>(this));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment