diff options
author | tonikitoo <tonikitoo@igalia.com> | 2016-08-26 08:37:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-26 08:37:10 -0700 |
commit | 3e98158a6c47361ca7d6c2c18d47c9f8f3aabb8a (patch) | |
tree | 704926c3b5edbabde50fbee3aa1abceb8e180e72 /public | |
parent | 9b57ec9ff50aeab53cf3f028222f69c78840385d (diff) | |
download | pdfium-3e98158a6c47361ca7d6c2c18d47c9f8f3aabb8a.tar.xz |
Extend pdfium_test capability so that more Javascript can be executedchromium/2841
In [1], the lack of support of pdfium_test to some application
level hooks was felt.
More specifically, the lack of implementation of the hook FFI_GetPage,
called when 'this.getAnnot()' is executed in an Acrobar JS context,
makes it non-trivial to JS texts that manipulate PDF annotations.
[1] https://codereview.chromium.org/2265313002/
Here is the failing call stack in pdfium_test:
0 ::RenderPdf (samples/pdfium_test.cc)
1 ::FORM_DoDocumentOpenAction (fpdfsdk/fpdfformfill.cpp)
2 CPDFSDK_Document::ProcOpenAction (fpdfsdk/fsdk_mgr.cpp)
3 CPDFSDK_ActionHandler::DoAction_DocOpen (fpdfsdk/fsdk_actionhandler.cpp)
<----v8---->
4 Document::getAnnot (fpdfsdk/javascript/Document.cpp)
5 CPDFSDK_Document::GetPageView (fpdfsdk/fsdk_mgr.cpp)
6 CPDFDoc_Environment::FFI_GetPage (fpdfsdk/include/fsdk_mgr.h)
(frame 6 returns nullptr, and getAnnot call in frame 4 bails)
CL extends pdfium_test app with a FFI_GetPage hook implementation.
Basically what FFI_GetPage does is returning a FPDF_PAGE instance.
In case of pdfium_test, FPDF_PAGE instances were only created on demand
when the page was going to get rendered, and then discarded.
Since FFI_GetPage can be called by JS before pages are rendered,
CL moved the page creation code into a helper function, and cached
the FPDF_PAGE instances created in a map, so it does not recreate
them needlessly.
BUG=pdfium:492
Review-Url: https://codereview.chromium.org/2277063003
Diffstat (limited to 'public')
0 files changed, 0 insertions, 0 deletions