Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2085)

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 1556603002: Call FPDFAvail_IsFormAvail() before creating form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't call FPDF_IsFormAvail() if |fpdf_availability_| is not set Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 0528c94ecca007a1e58ec053c96689974027318d..1739f7192a091f1acca5ec5fbc55a324be42c92c 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2597,11 +2597,15 @@ void PDFiumEngine::ContinueLoadingDocument(
permissions_handler_revision_ = FPDF_GetSecurityHandlerRevision(doc_);
if (!form_) {
- // Only returns 0 when data isn't available. If form data is downloaded, or
- // if this isn't a form, returns positive values.
- if (!doc_loader_.IsDocumentComplete() &&
- !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) {
- return;
+ if (fpdf_availability_) {
spelchat 2015/12/30 19:01:08 This check and DCHECK_NE could be removed instead.
Lei Zhang 2015/12/30 19:58:19 I think for this to happen, the error from FPDFAva
spelchat 2015/12/30 20:14:00 Yes all the FPDFAvail_* functions get called but r
+ int form_status =
+ FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_);
+ DCHECK_NE(form_status, PDF_FORM_ERROR);
+ bool doc_complete = doc_loader_.IsDocumentComplete();
+ // Try again if the data is not available and the document hasn't finished
+ // downloading.
+ if (form_status == PDF_FORM_NOTAVAIL && !doc_complete)
+ return;
}
form_ = FPDFDOC_InitFormFillEnvironment(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698