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

Side by Side Diff: testing/embedder_test.cpp

Issue 973673002: Check whether a pdf has XFA fields before loading XFA fields (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 PDFium Authors. All rights reserved. 1 // Copyright (c) 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "embedder_test.h" 5 #include "embedder_test.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 (void) FPDFAvail_IsDocAvail(avail_, &hints_); 249 (void) FPDFAvail_IsDocAvail(avail_, &hints_);
250 250
251 if (!FPDFAvail_IsLinearized(avail_)) { 251 if (!FPDFAvail_IsLinearized(avail_)) {
252 document_ = FPDF_LoadCustomDocument(&file_access_, NULL); 252 document_ = FPDF_LoadCustomDocument(&file_access_, NULL);
253 } else { 253 } else {
254 document_ = FPDFAvail_GetDocument(avail_, NULL); 254 document_ = FPDFAvail_GetDocument(avail_, NULL);
255 } 255 }
256 if (!document_) { 256 if (!document_) {
257 return false; 257 return false;
258 } 258 }
259 (void) FPDF_LoadXFA(document_); 259 int docType = DOCTYPE_PDF;
260 if (FPDF_HasXFAField(document_, docType))
261 {
262 if (docType != DOCTYPE_PDF)
263 (void) FPDF_LoadXFA(document_);
264 }
260 (void) FPDF_GetDocPermissions(document_); 265 (void) FPDF_GetDocPermissions(document_);
261 (void) FPDFAvail_IsFormAvail(avail_, &hints_); 266 (void) FPDFAvail_IsFormAvail(avail_, &hints_);
262 267
263 IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this); 268 IPDF_JSPLATFORM* platform = static_cast<IPDF_JSPLATFORM*>(this);
264 memset(platform, 0, sizeof(IPDF_JSPLATFORM)); 269 memset(platform, 0, sizeof(IPDF_JSPLATFORM));
265 platform->version = 1; 270 platform->version = 1;
266 platform->app_alert = AlertTrampoline; 271 platform->app_alert = AlertTrampoline;
267 272
268 FPDF_FORMFILLINFO* formfillinfo = static_cast<FPDF_FORMFILLINFO*>(this); 273 FPDF_FORMFILLINFO* formfillinfo = static_cast<FPDF_FORMFILLINFO*>(this);
269 memset(formfillinfo, 0, sizeof(FPDF_FORMFILLINFO)); 274 memset(formfillinfo, 0, sizeof(FPDF_FORMFILLINFO));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 345 }
341 346
342 // Can't use gtest-provided main since we need to stash the path to the 347 // Can't use gtest-provided main since we need to stash the path to the
343 // executable in order to find the external V8 binary data files. 348 // executable in order to find the external V8 binary data files.
344 int main(int argc, char** argv) { 349 int main(int argc, char** argv) {
345 g_exe_path_ = argv[0]; 350 g_exe_path_ = argv[0];
346 testing::InitGoogleTest(&argc, argv); 351 testing::InitGoogleTest(&argc, argv);
347 testing::InitGoogleMock(&argc, argv); 352 testing::InitGoogleMock(&argc, argv);
348 return RUN_ALL_TESTS(); 353 return RUN_ALL_TESTS();
349 } 354 }
OLDNEW
« no previous file with comments | « samples/pdfium_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698