Age | Commit message (Collapse) | Author |
|
Turns out that "FromUnicode" is misleading in that, on linux, it simply
removes any characters beyond 0xFF and passes the rest unchanged, so
no unicode decoding actually takes place. On Windows, it passes it into
the system function specifying FX_CODEPAGE_DefANSI, converting it into
the so-called "default ANSI code plane", passing some characters,
converting others to '?' and still others to 'A'. Either way, nothing
resembling UTF8 comes out of this, so pick a better name.
These now immediately look suspicious, so a follow-up CL will see
which ones should really be WideString::UTF8Encode() instead.
Making this a normal method on a widestring rather than a static
method on a bytestring feels more natural; this is parallel to
the UTF8Encode and UTF16LE_Encode functions.
Add a test that shows these conversions.
Change-Id: Ia7551b47199eba61b5c328a97bfe9176ac8e583c
Reviewed-on: https://pdfium-review.googlesource.com/39690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
No need for variadic printf-like functions, since callers can cobble
arguments into a string much more simply.
Change-Id: I0e8d6f6a55a3715ef9d5c6940b73ce8bb2220a1a
Reviewed-on: https://pdfium-review.googlesource.com/39611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Avoid possibility of an unterminated string or nullptr by avoiding
stringviews, since the non-view classes copy and always provide
a suitable result. Always use %ls and widestrings in wprintf()
variants, since that combination is consistent across our platforms
(%s, %S, etc. have idiosyncracies).
Bug: 870952
Change-Id: Ief62a42c3486e8298f9583b56e9333db1a74972a
Reviewed-on: https://pdfium-review.googlesource.com/39551
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Fix some nits as well.
Change-Id: Iaef79056b68ea0dae7f76c09e7a133cc545896fd
Reviewed-on: https://pdfium-review.googlesource.com/39353
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Return results instead of writing them to an out parameter. Remove start
index which is always 1.
Change-Id: I4b969a1e27679fca56b2cde1a901a8967c7fa8ce
Reviewed-on: https://pdfium-review.googlesource.com/39092
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Also remove a check that is always false, and simplify another check.
Change-Id: I89193eebc84a6fd139b34b890a8c3003a635851b
Reviewed-on: https://pdfium-review.googlesource.com/39091
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Make consistent with other public API types.
Introduce CPDFSDKFormFillEnvironmentFromFPDFFormHandle() and
FPDFFormHandleFromCPDFSDKFormFillEnvironment() helper functions.
Use these to kill off some casts in the process.
Change-Id: I6230ecdb4cecd03076f5e24c8cc49c45ad694da7
Reviewed-on: https://pdfium-review.googlesource.com/39250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
They are only used inside CFXJSE_FormCalcContext. Move into an anonymous
namespace.
Change-Id: Ib8a0ff9b90cf951459c04655bedada3bdb1979a4
Reviewed-on: https://pdfium-review.googlesource.com/39090
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Return a std::pair instead of having a non-const ref out parameter. Use
early returns / continues to simplify code.
Change-Id: I093fe667d31447ed42b8d44e354405094adaf8fd
Reviewed-on: https://pdfium-review.googlesource.com/39070
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Also fix C++ style errors.
Change-Id: Ia4b815c2fa8430791bb44a218ef93f8efde8c3af
Reviewed-on: https://pdfium-review.googlesource.com/39050
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Instead, move the methods to the subclass where they belong.
Fix IWYU in CJX_Object.h to fix compilation.
Change-Id: I4c71f28235b9cf5000e9ddaf33d6602baf22205f
Reviewed-on: https://pdfium-review.googlesource.com/39170
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I3fdc6d473f08835b6caeacbbd583bb651a9c5678
Reviewed-on: https://pdfium-review.googlesource.com/39111
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
It makes illegal casts and requires its callers to double-check the
type validity of results before use. Instead, use the parent
class iterator and perform checked casts.
No functional difference, since it looks like the requisite checks
were being made in all places.
Make one "using" visible to other files to save some verbosity.
Change-Id: I894ca15b4bdddd4723b787663950a58bc58b7f06
Reviewed-on: https://pdfium-review.googlesource.com/39030
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
XFA introduces some additional subclasses, so it doesn't hurt
to be sure in all cases before making a static cast.
Change-Id: I7447ca58be0b57201b39ba40a3fc5f47505cee58
Reviewed-on: https://pdfium-review.googlesource.com/39013
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Because we don't want to trust anything V8 gives us back.
Use a deep namespace so we can have a short declaration in the
structs, but avoid collisions.
Change-Id: Ibb832a5dcd34c652159c3343dd70c9e2ee561537
Reviewed-on: https://pdfium-review.googlesource.com/38972
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Introduces checks in a few new places, but mainly just consolidates
checking/casting logic.
Change-Id: I634a03060d254db099972c6978249992367e146c
Reviewed-on: https://pdfium-review.googlesource.com/38900
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Part of the effort to reduce unchecked static casts.
Change-Id: I1bff1c53aa7c5804660de4b65cf01523d70fcbb7
Reviewed-on: https://pdfium-review.googlesource.com/38896
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Value::ToString is deprecated since the Isolate is inferred from the
memory address of the object being converted to a string which will soon
not be reliable. As such this method will be removed in the very near
future.
Change-Id: I1e5a1a0464f2052cc3aa5eeb1ddbdb7b0a9222d3
Reviewed-on: https://pdfium-review.googlesource.com/38914
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
|
|
And use it in place of ASSERT() that the type was correct. Since we
can check it, doing so at runtime may help avoid type confusion, and
we'll get a nice safe SEGV if the asserted condition ever fails.
Change-Id: I46b65a4b70e819a670d7cad7966e0d100f0d9a63
Reviewed-on: https://pdfium-review.googlesource.com/38810
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Because the other helpers are declared here.
Rename VariablesThis to ThisProxy in a few places; VariablesThis is
a slightly different concept (see GetVariablesThis()).
Then introduce helper for CXFA_List subclass as well.
Remove unused const version of some helpers.
Change-Id: Ia328d8cd170a8b97015e98c1c770fa8a44810455
Reviewed-on: https://pdfium-review.googlesource.com/38670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Do not allow instanceManager methods to run in Foreground XFA forms.
They are static, and their widgets should not be inserted or removed.
See "XML Forms Architecture (XFA) Specification Version 3.3", page 272.
Bug: chromium:860697
Change-Id: Ia96834e085ee508618ca4dcb2bd5271466369ede
Reviewed-on: https://pdfium-review.googlesource.com/38751
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Because they are too easily confused with non-XFA JS_STATIC_PROP despite
being on the XFA side. The JSE_ prefix mirrors the fxjs/fxjse split
("e" presumably standing for "extension" or some such) between the
non-xfa/xfa V8 adapter layer.
Rename fxjs/{cjx_define.h => jse_define.h}, since there aren't any
symbols starting with |CJX| in it.
Fix some IWYU for jse_define.h
No functional changes.
Change-Id: I6a0b2b6fe6ef1b564b0bfa2fa7ba317a0cea0953
Reviewed-on: https://pdfium-review.googlesource.com/38730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
In turn, it too is always nullptr. This shows that the V8
side check for hasInstance() was never being applied. We will
augment this with C++ side checks down the road, since we don't
want to trust V8 anyways.
Change-Id: Iee38f32af9561783dbf253d798bd975029f3a4a2
Reviewed-on: https://pdfium-review.googlesource.com/38594
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Previous CLs have shown that the "lpClass" checks aren't sufficient
here, so ensure we are always checking C++ enum value before
downcasting this type.
Change-Id: I418127c5e7131e0a3363363a60d1976719d6837c
Reviewed-on: https://pdfium-review.googlesource.com/38550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Insert another unowned ptr along the way.
Change-Id: I953baa3448282fd4f655bb99524f131f66b7ed86
Reviewed-on: https://pdfium-review.googlesource.com/38593
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Like the other cases, it is always nullptr.
Change-Id: I280f25899ffbe5e35f4ef3342aec7896edf3e1f2
Reviewed-on: https://pdfium-review.googlesource.com/38592
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
It, too, is always passed as nullptr.
Change-Id: I2573bea4cc33f48c13979026ea8ae42b368ce8a5
Reviewed-on: https://pdfium-review.googlesource.com/38590
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
More foolproof technique, and saves one word in every instance at a
cost of two pointers in every subclass vtable.
Change-Id: Ied4f91d4d203b5e6d83abe751159eb7e55489bb5
Reviewed-on: https://pdfium-review.googlesource.com/38530
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
It's always passsed as nullptr. Rename function to ToFormCalcContext()
for clarity while we're at it.
Change-Id: I96581c6b86b7ac7b48b60429e2144f16af7e46ca
Reviewed-on: https://pdfium-review.googlesource.com/38570
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Callers already explicitly pass nullptr as needed.
Change-Id: I8cf9d4951ec1b75cf90dccc1b53bfcd6fb6a42e6
Reviewed-on: https://pdfium-review.googlesource.com/38450
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Given the issues we've seen on the non-XFA side, be more careful
about using V8-provided data on the XFA side.
Change-Id: I13b7fa9ac852be74c8135410734445b2c9a23c97
Reviewed-on: https://pdfium-review.googlesource.com/38430
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Second line of defense for issue in the associated bug.
Bug: chromium:862059
Change-Id: I58ba890dfe02c89dd6bcfa23e2e116e107f9adbc
Reviewed-on: https://pdfium-review.googlesource.com/37991
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
This a convenient place to assert that the callback that is about
to be invoked on the object doesn't destroy the object at any point
during its execution.
Change-Id: Iacb9d4e01603cc6bf316b00fdd062955c903ca5c
Reviewed-on: https://pdfium-review.googlesource.com/37970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Isolates are long-lived, but this may catch a few things.
Introduce CFX_V8IsolateDeleter for unique_ptr<v8::Isolate> usage.
Fix Dispose()/SetIsolate(nullptr) ordering in cjs_runtime.cpp
Remove one unused isolate member.
Flip protected -> private in one place.
Change-Id: I26cdd120f799192e93b0d9d04dcde8f348dc21f3
Reviewed-on: https://pdfium-review.googlesource.com/37931
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This CL adds an experimental callback to the form fill API that
allows PDFium to signal to the embedder that an attempt call save
occurred. The embedder is responsible for showing an appropriate
UI when this occurs. When PDF saving is implemented the API can
be removed.
BUG=pdfium:953
Change-Id: Iba30f4d0547fe773b793e499995be426626092a0
Reviewed-on: https://pdfium-review.googlesource.com/35870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ib758cfc97a4e2bb94f58afa999608f77c0972336
Reviewed-on: https://pdfium-review.googlesource.com/37730
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
It is always the same value. Also mark ValueIsOccur() as const.
Change-Id: Ifdfc33f8213ed272e7d36e1e4c2de1d2070fbcbd
Reviewed-on: https://pdfium-review.googlesource.com/37712
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Its what many CJS_Field methods really want to do.
Change-Id: I18cf61a15be7b783b795c61a5c26c42ef5d82127
Reviewed-on: https://pdfium-review.googlesource.com/37711
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
These types are commonly checked together.
- IsComboBoxOrListBox()
- IsComboBoxOrTextField()
Change-Id: Ia363bd9822f8dfe61e11cf552ec516f9403a8fcc
Reviewed-on: https://pdfium-review.googlesource.com/37673
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I0e06d641d482cbcd2cf33f327d9504e55a772157
Reviewed-on: https://pdfium-review.googlesource.com/37672
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Idfe70f86fbaf341ba6b197689a65ac722e671f39
Reviewed-on: https://pdfium-review.googlesource.com/37674
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=chromium:862059
Change-Id: Id354a5e6dbc037dbb76f901de8311a4f4a4d8940
Reviewed-on: https://pdfium-review.googlesource.com/37670
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I7f26709bdad56cc2712f21e8e644be7c53ec5ec4
Reviewed-on: https://pdfium-review.googlesource.com/37513
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Consolidate all the checks into JSGetObject(), and add GetObjDefnID()
methods for classes that are missing it.
BUG=chromium:862059
Change-Id: I2c2b725a01dcd259ef712d2513fcf740cc410b15
Reviewed-on: https://pdfium-review.googlesource.com/37510
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I533a702947ba371cbc7971d88a3b7dabbc81a298
Reviewed-on: https://pdfium-review.googlesource.com/37511
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Idcd992224fc5411c97f3001293af83a6c581e695
Reviewed-on: https://pdfium-review.googlesource.com/36991
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Icdbdd1c0e5052490c251009b5b2b31b2c46fb580
Reviewed-on: https://pdfium-review.googlesource.com/36833
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
This enables more complicated cleanup when an observed object
is destroyed. Use it to make documents observable and to allow
the CPDF_Avail to cleanup without the need for intermediate class.
Change-Id: I3a8e758b7ff542e0a58710eff1ac8017205cbd45
Reviewed-on: https://pdfium-review.googlesource.com/36373
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Part 2.
Change-Id: I26fe434dac3c3f5186414440acc2a495a5f14091
Reviewed-on: https://pdfium-review.googlesource.com/36670
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Comment raw pointers subject to nondeterministic tree destruction
order as such to avoid re-attempting to convert to the unowned
mechanism.
Change-Id: Ia9fe3c8a2729dc1e2b1de4a8c62ae3d2c3d7ec0a
Reviewed-on: https://pdfium-review.googlesource.com/36635
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|