summaryrefslogtreecommitdiff
path: root/xfa
AgeCommit message (Collapse)Author
2017-06-28XFA: Add test to show Oneof() works correctly.Lei Zhang
The new embedder test shows Oneof() works, whereas the corpus test does not. It turns out the corpus test was bad, and trying to fix it exposed a different bug. So roll DEPS for the testing corpus anyway to get improved tests, but keep the suppression for now. BUG=pdfium:781 Change-Id: I3cc6b9a414384c917f205eff064c5dd2175d09fe Reviewed-on: https://pdfium-review.googlesource.com/6973 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-26Remove a const_cast in CFDE_CSSTextBuf.Lei Zhang
Change-Id: If6d2cce6a4185c6726df7d6b9d44d74efe0be11d Reviewed-on: https://pdfium-review.googlesource.com/6931 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-26Clean up CFDE_CSSTextBuf.Lei Zhang
Change-Id: I8230c2d5e5450ea36ff6d2a4fefc1619a13e9c44 Reviewed-on: https://pdfium-review.googlesource.com/6930 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-06-26Adding back the CFX_DateTime print helpers.Henrique Nakashima
Change-Id: I23fe37139ed06a7e09f6a39ea833a6a984add49e Reviewed-on: https://pdfium-review.googlesource.com/6913 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-23Cleaning up fx_string_testhelpers.Henrique Nakashima
This is unused except for being a pathway for indirect deps. Change-Id: I717290235ccbc59429ad24231033382958e2a086 Reviewed-on: https://pdfium-review.googlesource.com/6910 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-22Add a |gGeneralPartitionAllocator| and use it in the |FX_*Alloc| wrappers.chromium/3142chromium/3141chromium/3140chromium/3139Chris Palmer
BUG=pdfium:690 Change-Id: I922279e4bdc8b411f47f49798155e8f9118c1396 Reviewed-on: https://pdfium-review.googlesource.com/6552 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-20Cleanup fpdf_parser_decodeNicolas Pena
This CL fixes some nits in fpdf_parser_decode, especially avoiding non-const reference parameters. Change-Id: Ibb914850afd924bb398f886ac862f7589519ef7e Reviewed-on: https://pdfium-review.googlesource.com/6750 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-14Fix bad format string in CXFA_FM2JSContext.Lei Zhang
PDFium's vswprintf() is based on the win32 version to be consistent across platforms. On Windows, %s has different meanings depending on whether the printf() variant is wide or not. BUG=chromium:732533 Change-Id: I7437ecd253da1234728c1e0897f02b7f907aada8 Reviewed-on: https://pdfium-review.googlesource.com/6550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-13Add CFGAS_FormatString helper to extract digits.Dan Sinclair
This CL adds ExtractCountDigits and ExtractCountDigitsWithOptional to cleanup the digit extraction code. Change-Id: I6c3f4b435ec41b429b18cd9af9be46551a7fa391 Reviewed-on: https://pdfium-review.googlesource.com/6391 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-08CFGAS_FormatString use helper to convert char to intDan Sinclair
This CL updates CFGAS_FormatString to use the FXSYS_DecimalCharToInt helper instead of doing the conversion itself. Change-Id: Ia5b0f0c008a815b4cf25e59281357285005a7ab0 Reviewed-on: https://pdfium-review.googlesource.com/6412 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-08Add CFGAS_FormatString Number to String helperDan Sinclair
This CL adds a small helper to convert a number to a string with a given number of leading digits. Change-Id: I689c0d1ab9d35341f923ac7b72ed5a96bce6b868 Reviewed-on: https://pdfium-review.googlesource.com/6411 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-08Combine more CFGAS_FormatString codeDan Sinclair
This CL continues combining CFGAS_FormatString code chunks which are very similar. Change-Id: Ie2d41ce4c9cc82716daafbe346d0e71ba971f2bc Reviewed-on: https://pdfium-review.googlesource.com/6410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-07Remove use of FXBSTR_ID from CFGAS_FormatStringchromium/3124Dan Sinclair
This CL removes the use of FXBSTR_ID and uses CFX_WideString comparisons instead. This makes the code a bit clearer as to what is being compared. Change-Id: I933bd1d7c98800ac80849d6f4d3179dd342f6270 Reviewed-on: https://pdfium-review.googlesource.com/6371 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-07Simplify some CFGAS_FormatString methodsDan Sinclair
This CL combines the similar format strings together and checks for the ' 's conditionally where needed. Change-Id: I46b2227c9d76ba66c8526c6597684e4b47301bde Reviewed-on: https://pdfium-review.googlesource.com/6370 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-07Fix some CFGAS_FormatString issuesDan Sinclair
This CL fixes the solar days calculation for months after August. Simplifies the minute rounding method. Change-Id: I5f335338ecac911ef0ab57602f41bb98c6f9fa6c Reviewed-on: https://pdfium-review.googlesource.com/6331 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-07Even more CFGAS_FormatString tests.Dan Sinclair
Change-Id: Ied2a169a3e7e9b178d746b04c67286d7a51fa635 Reviewed-on: https://pdfium-review.googlesource.com/6330 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-06Convert CFGAS_FormatString to pointer out parameterschromium/3123Dan Sinclair
This CL changes all CFGAS_FormatString methods to use pointer out paramters instead of reference out parameters. Change-Id: Ic5b57f30e4be09233898b8f4e06f908a96afedc8 Reviewed-on: https://pdfium-review.googlesource.com/6272 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-06More CFGAS_FormatString testsDan Sinclair
This CL adds tests for the numeric, text, null and zero parsing and formatting methods. Change-Id: I0a35de105fd631598a7885c4bbbd1c2abbbd4260 Reviewed-on: https://pdfium-review.googlesource.com/6271 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-06Add more CFGAS_FormatString tests.Dan Sinclair
This CL adds some more time tests for CFGAS_FormatString. Change-Id: Ida7d9e665f304b984508ff3b404e7ea9c38ef415 Reviewed-on: https://pdfium-review.googlesource.com/6270 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-05More CFGAS_FormatString testsDan Sinclair
This CL adds more tests for various CFGAS_FormatString methods. A few bugs are fixed up along the way. Change-Id: Ida1f2792d1bd72f4f52b3c7cc1ff0022b6f45fda Reviewed-on: https://pdfium-review.googlesource.com/6179 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-05Add start of CFGAS_FormatString testsDan Sinclair
This CL adds tests for the date parsing and formatting code in CFGAS_FormatString. Change-Id: I9989cdd1b3f92c90d46ee2c3f7838fe1de255be2 Reviewed-on: https://pdfium-review.googlesource.com/6178 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-05Cleaning up some XFA locale related codeDan Sinclair
This CL removes some unused locale related code and formats other bits. Change-Id: I172fc16a634a8982c00bfaf84fdcd4cd277eb36d Reviewed-on: https://pdfium-review.googlesource.com/6077 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-02Prevent OOB access in CXFA_FM2JSContext::IsIsoTimeFormat().Lei Zhang
Change-Id: I3fe0460f3a4cfd7d48ccfc79d0256fc83d7fbac8 Reviewed-on: https://pdfium-review.googlesource.com/6235 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-02Remove explicit CFX_Matrix identity matrix instantiations.Lei Zhang
Change-Id: I96c3429dbe2c572ed409706adfe3707b8b9bf51b Reviewed-on: https://pdfium-review.googlesource.com/6176 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-01Tag CFXJSE_HostObject sub-classes.Tom Sepez
CXFA_FM2JSContext and CXFA_Object both subclass CFXJSE_HostObject. When a CFXJSE_HostObject is obtained from an opaque pointer inside a V8 object internal slot, there is no way to distinguish one from the other. Bug: 728158 Change-Id: Iabc648e8b7226e2819d8795227442c3f6c61a793 Reviewed-on: https://pdfium-review.googlesource.com/6211 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-06-01Remove unused Locale codeDan Sinclair
This CL removes unused code from CFGAS_FormatString and CXFA_LocaleValue. Change-Id: I87a996231b3ad3770508be362456c435034b229c Reviewed-on: https://pdfium-review.googlesource.com/6177 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Split apart remaining xfa/fxfa/app filesDan Sinclair
This CL splits the remaining files in xfa/fxfa/app into individual files named after the classes. Change-Id: I84bd8938937641bb6897614ed15558a2682f456c Reviewed-on: https://pdfium-review.googlesource.com/6010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Mass conversion of all const-lifetime class membersTom Sepez
Sed + minimal conversions to compile, including moving some constructors into the .cpp file. Any that caused ASAN issues during the tests were omitted rather than trying to resolve the underlying issue. Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335 Reviewed-on: https://pdfium-review.googlesource.com/5891 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-25Fix FM2JSContext Round return typeDan Sinclair
This Cl fixes the return type of the Round method to return a double instead of a string. Change-Id: I740e375bdedfe22cb9f81d4beeaa079eac64b1bd Reviewed-on: https://pdfium-review.googlesource.com/5896 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-25Enable remaining boolean FM2JSContext testsdan sinclair
This CL updates the return type of the remaining boolean tests to be Integer and enables the tests. Change-Id: Ie2856ad31d17ffb496f33e6969912d0aae9678c5 Reviewed-on: https://pdfium-review.googlesource.com/5895 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable the FM2JSContext Exists testdan sinclair
This Cl fixes the Exists test of FM2JSContext to handle the return type of Integer instead of Boolean. Change-Id: I51c43e22eff5330de5ab5e63a925006af483f0ab Reviewed-on: https://pdfium-review.googlesource.com/5894 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable FM2JSContext Choose testsdan sinclair
This Cl enables the Choose tests for FM2JSContext. The Choose tests always return a String. Change-Id: I29b3ce4ed38f94886c6036f3766182fecb6e787b Reviewed-on: https://pdfium-review.googlesource.com/5893 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-25Enable most FM2JSContext boolean testsdan sinclair
This CL enables most of the FM2JSContext boolean tests. The return type is updated to Integer from Boolean. Change-Id: Ie3f665bd23a86e843cadb2ae8963767466bd1714 Reviewed-on: https://pdfium-review.googlesource.com/5892 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-24Convert to CFX_UnownedPtr, part 10Tom Sepez
Change-Id: I4eab5e843580845753c5f80c05cf9490a85114b6 Reviewed-on: https://pdfium-review.googlesource.com/5890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-24More FM2JSContext testsDan Sinclair
This CL adds tests for the FormCalc methods that don't require passing in a formcalc object reference. Change-Id: Ica6f15704cce525d38d25a27d1628089d2fc5a5a Reviewed-on: https://pdfium-review.googlesource.com/5691 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-23Cleanup default values and methods in CXFA_WidgetdataDan Sinclair
Change-Id: Ie591de17aba54d6d0f96b1133be7d899bab577cf Reviewed-on: https://pdfium-review.googlesource.com/5660 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-23Use NOTREACHED() in more places.Lei Zhang
Change-Id: I88466943171f19259f84add69679741d44c8e123 Reviewed-on: https://pdfium-review.googlesource.com/5551 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-20Use observed ptrs from CFGAS_GEFont back to its font mgrs.chromium/3106Tom Sepez
CFGAS_GEFonts are ref counted, and its a good thing since they are managed by at least three different font managers: CFGAS_FontMgr, CXFA_PDFFontMgr, and CXFA_FontMgr. None of these have a clear claim to ownership of the CFGAS_GEFont. CFGAS_GEFont has back-pointers to two of these, CFGAS_FontMgr, and CXFA_PDFFontMgr, and they could each outlive the other. Thus the font needs to watch for destruction of either of its managers, so as to stop using it after its gone. Bug: 724640 Change-Id: I907ec35e300e11e532e13545d51fb200ac86b4f9 Reviewed-on: https://pdfium-review.googlesource.com/5735 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-20Use unowned ptr from CXFA_FFDocView to CXFA_FFDocTom Sepez
There's an unique_ptr going in the other direction, so it must outlive this. Change-Id: I28a77fbff67e6682360414e26c807d707602e140 Reviewed-on: https://pdfium-review.googlesource.com/5736 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19ASAN flags zero-length StringC in GetMapModuleString()chromium/3105Tom Sepez
Corner case for StringCs: A non-referenceable ptr plus a zero length. The situation should be rare, so fix it at the spot of the foul rather than adding logic to the StringC constructors to zero the pointer when encountering zero length. Bug: 724500 Change-Id: I54b263f7db5ddef7bade6bfaa185a542ea20229c Reviewed-on: https://pdfium-review.googlesource.com/5730 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-19Move CCodec_ModuleMgr ownership to CPDF_ModuleMgr.Lei Zhang
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr holding a pointer to it. Remove assumptions that the codec modules may return nullptr, and do IWYU. Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5 Reviewed-on: https://pdfium-review.googlesource.com/5654 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-18Use UnownedPtr to check CFX_*StringC lifetimeschromium/3104Tom Sepez
Change interform to avoid temp StringC with dangling ptr. Change-Id: I8d8659973bcdf2cdbcaa6efa6012e4acce5f1604 Reviewed-on: https://pdfium-review.googlesource.com/5571 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-18Adding fm2js embedder testsDan Sinclair
This Cl adds the basis of the test framework to execute the javascript produced by CXFA_FM2JSContext and verify the results are correct. Change-Id: Ie46625b7e27ca0808e9cc41fdc00b7c0a212837d Reviewed-on: https://pdfium-review.googlesource.com/5651 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-18Remove CXFA_FMErrorInfodan sinclair
This Cl removes the CXFA_FMErrorInfo class. The message was never output, just used as a flag to determine if there was an error. The class has been replaced with a boolean. Change-Id: I1cde99ce6957f5f8c6be0755a198d80ec8378b3a Reviewed-on: https://pdfium-review.googlesource.com/5653 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-17Shorten internal JS prefixes.Dan Sinclair
This Cl shortens the prefix applied in JavaScript to reduce the size of the generated JavaScript string. Change-Id: Ica5d02cc89b17140ba42deae72484cd159f8e3e5 Reviewed-on: https://pdfium-review.googlesource.com/5590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-17Adding CXFA_Parse unittestsDan Sinclair
This CL adds the beginning of unittests for the CXFA_Parse code. Change-Id: I06e556f1a35405bc683c536d390071917ee330a6 Reviewed-on: https://pdfium-review.googlesource.com/5556 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-17Rename formcalc files to better match contentsDan Sinclair
Most files match the contents. The expression files are named to match their base type even though they contain all the expression subclasses. Change-Id: I3b7705c7b206a9fa1afae8b677f765e8b788e84d Reviewed-on: https://pdfium-review.googlesource.com/5492 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-16Be skeptical of bare |new|s.Tom Sepez
In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-16CFDE_RenderDevice::m_bOwnerDevice is always falseTom Sepez
So remove it. But they probably wanted it to be true in one place, because it looks like a leak. So find a better way to own the object. Change-Id: I15937e29da5ce8b380f82cb20ee3ecc3f49b8ca3 Reviewed-on: https://pdfium-review.googlesource.com/5473 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-16Introduce CFX_UnownedPtr to detect lifetime inversion issues.Tom Sepez
There are places where an object "child" has a raw pointer back to object "owner" with the understanding that owner will always outlive child. Violating this constraint can lead to use after free, but this requires finding two paths: one that frees the objects in the wrong order, and one that uses the object after the free. The purpose of this patch is to detect the constraint violation even when the second path is not hit. We create a template that is used in place of TYPE*. It's dtor, when a memory tool is present, goes out and probes the first byte of the object to which it points. Used in "child", this allows the memory tool to prove that the "owner" is still alive at the time the child is destroyed, and hence the constraint is never violated. Change-Id: I2a6d696d51dda4a79ee2f00a6752965e058a6417 Reviewed-on: https://pdfium-review.googlesource.com/5475 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>