summaryrefslogtreecommitdiff
path: root/fxjs
AgeCommit message (Collapse)Author
2018-02-06Avoid needless malloc for v8:Global array.Tom Sepez
They have move semantics, so they can directly be members of the array. Change-Id: Ia73cbc06fd22665693ae1a4efe6a6f64eca1b5fb Reviewed-on: https://pdfium-review.googlesource.com/25490 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-06Remove unused FreeObjectPrivate() overload.Tom Sepez
Change-Id: Idb1f6879a78e4ada8129250eedd37142b6f26588 Reviewed-on: https://pdfium-review.googlesource.com/25530 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-05Fold CJS_EmbedObj classes into CJS_Object classesDan Sinclair
This CL removes the CJS_EmbedObj class and various subclasses and folds the subclasses into their CJS_Object counterparts. Change-Id: If6b882a4995c0b1bf83ac783f5c27ba9216c2d5c Reviewed-on: https://pdfium-review.googlesource.com/25410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-02-05Remove the CJS_EmbedObj template param from JSConstructor.Dan Sinclair
Each of the CJS_Objects can create their CJS_EmbedObj's internally and we don't need to do it though the JSConstructor. This also removes the need for the SetEmbedObj method in CJS_Object. Change-Id: Ib0535ad922b370634fd1e622a04860a96c4f2825 Reviewed-on: https://pdfium-review.googlesource.com/25370 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-02-05Use unique pointer in CFXJS_PerObjectData.Tom Sepez
Also use the actual type information, not void* and remove casts. Template function not required to wrap virtual dtors. Change-Id: I9397cae136c3c395a368a1ef0ce8162d9b586076 Reviewed-on: https://pdfium-review.googlesource.com/25290 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-05Fix some formcalc constant naming.Lei Zhang
Mark one constant as actually constant. Change-Id: Icf046dbd6751d07d6652ce24e4217a717a58b699 Reviewed-on: https://pdfium-review.googlesource.com/25310 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-05[XFA] dot_accessor may not provide a valid object.Dan Sinclair
If the object being accessed through the dot_accessor does not exist it's possible to receive a nullptr in ResolveObject. Instead of ASSERTing just return false and let the caller handle the failure. Bug: chromium::778904 Change-Id: I918c1c5dcb23b86082793c5037d58e0ab043559e Reviewed-on: https://pdfium-review.googlesource.com/25350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-02-05Move const arrays to CFXJS_Engine from CJS_V8Tom Sepez
CJS_V8 is shared by both the non-xfa and xfa-side JS engines, but the const arrays are only used by the non-xfa side. Change-Id: Ic5ed8238df1a14dde8a4463b2388b4a7a923e392 Reviewed-on: https://pdfium-review.googlesource.com/25250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-02Small tidy of fxjsTom Sepez
Use correct include style for v8 headers. Use incomplete type to avoid including header. Change-Id: Ibd58aa25b2a17fbd1cf6a20643b6f25ca008974f Reviewed-on: https://pdfium-review.googlesource.com/25230 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-02Remove V8 context from CJS_V8Tom Sepez
Makes CFXJS_Engine and CFXJSE_Engine consistent with each other in that both have a V8 context to themselves, and not one inheritted from the CJS_V8 (which is now more per-isolate than per-context). Consolidate NewLocalContext() and GetPersistentContext(), which both did the exact same thing under the covers once inside v8 land. Rename a few things to make it simpler. Change-Id: I68905db9ad44253063da235fcb276a75627a2dbc Reviewed-on: https://pdfium-review.googlesource.com/25170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-02Make global object function names clearer.Tom Sepez
Also tidy some sub-expressions. Change-Id: Ieabd5f6cea60e8ec03c8ce5ebe372fc80b05a7bb Reviewed-on: https://pdfium-review.googlesource.com/25150 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-01Make CFXJSE-created contexts refer to their CFXJS counteparts.chromium/3337Tom Sepez
Bug: 773229 Change-Id: Ic3774c7f6abe3a195bbe09b91d91c549d4d7ac46 Reviewed-on: https://pdfium-review.googlesource.com/25110 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-01Change internal usages of GetPageIndexDeprecated() to new method.Henrique Nakashima
The new GetDestPageIndex() method does the same thing, but has a consistent form of returning an error (returns -1). Bug: pdfium:938 Change-Id: I31583e1c544d9173a28582b849edd5f73c40e174 Reviewed-on: https://pdfium-review.googlesource.com/25070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-01Introduce CXFJS_Engine::EngineFromContext/SetEngineInContext helpersTom Sepez
No functional change, but expose helpers likely to be needed by next steps. Rename CXFJS_Engine::CurrentEngineFromIsolate to be more accurately named along the way. Change-Id: Iaf2d15a09cfed85705d24ee056e78edf0660ce59 Reviewed-on: https://pdfium-review.googlesource.com/25090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-01Make FXJSE_Engine constructed from FXJS_Engine.Tom Sepez
No change in functionality yet, just passing higher level object. Precursor to maybe sharing v8 context between fxjs / fxjse. Mark unimplemented ctors / assignment operator as "delete". Change-Id: I100de7755909eec2eed96f6f51216d85923ffbb2 Reviewed-on: https://pdfium-review.googlesource.com/25050 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-01Deprecate FPDFDest_GetPageIndex and create a fixed version.Henrique Nakashima
FPDFDest_GetDestPageIndex() has a well defined return value for errors (-1). Keeping FPDFDest_GetPageIndex() to avoid changing behavior of the old API for whoever relies on it. Bug: pdfium:938 Change-Id: Iad528923cb156e957a419540c262a65f45cb777d Reviewed-on: https://pdfium-review.googlesource.com/24811 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-01Rename some CJS / IJS names for clarity.Tom Sepez
Prior cleanup before making FXJS/FXJSE share one v8 context. Return CJS object rather than isolate in one place. Use unique_ptr in one place. Change-Id: I837ae4880368a6d72e59b38f37e06908e05c34bd Reviewed-on: https://pdfium-review.googlesource.com/24950 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-01Test more context overlap in fxjs/fxjs_v8_embeddertest.cppTom Sepez
Change-Id: If9ab65019f12244938116e19f717e2092ccae4ff Reviewed-on: https://pdfium-review.googlesource.com/24931 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-31Remove handrolled search from GetEventParaInfoByNameRyan Harrison
BUG=pdfium:798 Change-Id: If6219f06303c78ecc8ddda52dd0095d658148e91 Reviewed-on: https://pdfium-review.googlesource.com/24718 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-31Remove NumericLimit params which are always the sameDan Sinclair
This CL removes the two params from NumericLmits which are always set to the same value and retrieves the values in the method itself. Change-Id: Ibeabdc7187faa58e93ffbe00063171fec0842256 Reviewed-on: https://pdfium-review.googlesource.com/24717 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-30Remove bare new from JS_Define.hTom Sepez
Change-Id: Ic734c7141e52b8ca332ca9dc78118b84904c41b0 Reviewed-on: https://pdfium-review.googlesource.com/24470 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-01-30Cleanup some param passing codeDan Sinclair
This CL cleans up some of the code around passing input information around. Change-Id: Id3c1ffa93c9e50c3b6312b15533ccc32c7406264 Reviewed-on: https://pdfium-review.googlesource.com/24710 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Fold single caller methods into callsiteDan Sinclair
This CL folds the GetNodeSameClassIndex, GetNodeSameNameIndex from CXFA_Node into the CJX_Tree callsites. Change-Id: Ia4f7750543e786ddd82abb4b6b4bde1bf1710f19 Reviewed-on: https://pdfium-review.googlesource.com/24471 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Kill some bare |new|s in cjs_field.cppTom Sepez
Change-Id: Id4d9f21d94d8b21199846ec5f7613590fd20579e Reviewed-on: https://pdfium-review.googlesource.com/24310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-01-29Cleanup the FFWidget determination code.Dan Sinclair
This CL converts the UIType to an XFA_FFWidgetType instead of reusing the XFA_Element type. The creation code is cleaned up to make it clearer what's happening. Change-Id: I5d3e4967d5c8b8a50dbb25e574b0d31fe0cf407a Reviewed-on: https://pdfium-review.googlesource.com/24390 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-29Fix identical if/else blocks.Lei Zhang
The CPWL_EditImpl::Backspace() instance occurred in commit 671a799. The other two instances where known cases. BUG=chromium:805881 Change-Id: Iae7cb8534e85342069d8753ced88543dad751e92 Reviewed-on: https://pdfium-review.googlesource.com/24050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-24Cleanup CreateUIChild node creationDan Sinclair
This CL cleans up some of the code around creating the XML nodes related to the UI widgets. Change-Id: Ib91364439ab039f46e44690e92cc0cb93a8da203 Reviewed-on: https://pdfium-review.googlesource.com/23770 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-24Fix broken XFA builds with new V8Ryan Harrison
These two methods need to be switched to using the maybe versions, since the older versions are being deprecated. BUG=pdfium:989 Change-Id: Id2b48395353af0078e51b2d3ac42103643922320 Reviewed-on: https://pdfium-review.googlesource.com/23830 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-01-23Remove GetWidgetAcc callsDan Sinclair
This CL removes the calls to CXFA_Node::GetWidgetAcc() as they redundantly return the node they were called upon. Change-Id: I46e66cf98137a1dee7cd3fa8bc7d379eb97fded5 Reviewed-on: https://pdfium-review.googlesource.com/23630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Merge CXFA_WidgetAcc into CXFA_Nodechromium/3330Dan Sinclair
This CL merges CXFA_WidgetAcc into CXFA_Node. Change-Id: Iab52ca7f98c9dcd4ab089c61b8f1324a565bf647 Reviewed-on: https://pdfium-review.googlesource.com/23610 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Use accessor for WidgetAccDan Sinclair
This CL removes places where we store CXFA_WidgetAcc into a variable and uses the accessor from CXFA_Node instead. This will ease the removal of CXFA_WidgetAcc. Change-Id: I7a6cb0079bb119481a5ae60679a537799b3be2c9 Reviewed-on: https://pdfium-review.googlesource.com/23510 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-23Tidy fxjs/cfxjse_isolatetracker.hTom Sepez
Move constructors to .cpp file. Remove unused member and its accessor method. Remove unused system includes. IsolateHandleRootContext is-a IsolateHandle (not has-a). Change-Id: Ifcba44f3ea7ad963fee731c24b2e79c5a8124539 Reviewed-on: https://pdfium-review.googlesource.com/23171 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-01-22Convert CXFA_EventParam to store a CXFA_NodeDan Sinclair
This CL changes the CXFA_EventParam code to store a CXFA_Node instead of a CXFA_WidgetAcc. Change-Id: I21510674b0b6435ca9b87bfbf97914f54e5e3464 Reviewed-on: https://pdfium-review.googlesource.com/23451 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-22Convert CXFA_FFWidgetHandler to use CXFA_NodeDan Sinclair
This CL removes CXFA_WidgetAcc from CXFA_FFWidgetHandler and uses CXFA_Node directly. Change-Id: I88cf1edc53f4489aeac018a95e9d5936d85106db Reviewed-on: https://pdfium-review.googlesource.com/23450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-22Remove CXFA_WidgetAcc from CXFA_FFNotifyDan Sinclair
This CL updates CXFA_FFNotify to use CXFA_Node instead of CXFA_WidgetAcc in its methods. Change-Id: I5036767f439ba0794a7b2b9df1898aad8390f987 Reviewed-on: https://pdfium-review.googlesource.com/23411 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Remove unused WidgetPreRemove and WidgetPostAdd paramsDan Sinclair
This CL removes the unused WidgetAcc param from both methods and updates callsites as needed. The include for cxfa_widgetacc.h was removed from fxfa.h and had to be inserted in locations where needed. Change-Id: I55ae9e935a948dff3b6d906b4567665e60530eba Reviewed-on: https://pdfium-review.googlesource.com/23391 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Change GetContainerWidgetAcc to GetContainerNodeDan Sinclair
This Cl converts the code which retrieved the containers WidgetAcc to retrieve the container itself and then get the WidgetAcc from the container. Change-Id: Ib279a150500d1204e3d18f11f6a638c1f6c368ec Reviewed-on: https://pdfium-review.googlesource.com/23350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Move IsNull and PreNull to CXFA_NodeDan Sinclair
This CL moves the m_bIsNull and m_bPreNull flags from CXFA_WidgetAcc to CXFA_Node. Change-Id: Ibdcdb8611699d6d908ab3c6ed05cbce7bba872ae Reviewed-on: https://pdfium-review.googlesource.com/23310 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Move the UI elements from CXFA_WidgetAcc to CXFA_NodeDan Sinclair
This CL moves the methods and members related to the UI nodes from the CXFA_WidgetAcc class to the CXFA_Node class. Change-Id: I1fdc5173787141065f1e607bbfefa3b22af738b4 Reviewed-on: https://pdfium-review.googlesource.com/23290 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Add flag to notify if a node widget is readyDan Sinclair
This CL updates CXFA_Object to have a flag which annotates if the node is ready. Ready means that we've gone through the OnNodeReady call in CXFA_FFNotify. Previously we'd check if the WidgetAcc exists on the node which is created in OnNodeReady. This CL replaces all the points where we check for a WidgetAcc existing with a IsWidgetReady() call. Change-Id: I54e8160269c3104cdae7a516c1814c13bee15130 Reviewed-on: https://pdfium-review.googlesource.com/23190 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-22Use MaybeLocal versions of v8::Script APIsAdam Klein
The non-Maybe versions will soon be deprecated. Where the code was already handling failures, I did the same; where the code was not handling failures, I inserted ToLocalChecked() calls. Thus the behavior before and after this patch should be the same. For consistency, also updated the use of v8::Function::Call in CFXJSE_Context::ExecuteScript() to the Maybe version, so that all code in that function now branches on the non-emptyness of MaybeLocals, rather than TryCatch::HasCaught(). ASSERTs were inserted to sanity-check the API usage. Bug: v8:7269, v8:7273, v8:7274 Change-Id: I59696e63a64a233a9f9c2b72c621a05b5e349a31 Reviewed-on: https://pdfium-review.googlesource.com/23270 Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
2018-01-17Pass Isolate to v8::String::Utf8Value APIAdam Klein
The non-Isolate version will soon be deprecated. Bug: v8:7269, v8:7282 Change-Id: I204e45bd73f5b809d6c44b77bbcf62d32e7ccbec Reviewed-on: https://pdfium-review.googlesource.com/23058 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Jochen Eisinger <jochen@chromium.org>
2018-01-17Do more forward declarations in cxfa_node.h.Lei Zhang
Including cjx_node.h pulls in v8 headers for many XFA files. Change-Id: I80a32d0a56b8de5787db5275db48c568da6d0144 Reviewed-on: https://pdfium-review.googlesource.com/22890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-12Use enum for tracking form field typesRyan Harrison
Within PDFium use enum class for better type safety when working with form field types. These values will still be converted to ints as part of the public API, since that is the existing API. This work is preperation for extending the number of form field types to have more specific entries for XFA. BUG=pdfium:952,chromium:763129,chromium:592758 Change-Id: Ie6c29f02ae22be782ff36eb87d27f1a4bf2c099e Reviewed-on: https://pdfium-review.googlesource.com/22742 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-01-12Fix "the the" typos.Lei Zhang
TBR=hnakashima@chromium.org Change-Id: I50877f5a2ff3fb6f48630019d2481aa451945118 Reviewed-on: https://pdfium-review.googlesource.com/22774 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-01-11Rename CXFA_Box methods to make return clearerDan Sinclair
This CL renames the methods in CXFA_Box to make it clearer they can return nullptr. Change-Id: I521c0e06af306f69e390a4057cabb7777a0d72f5 Reviewed-on: https://pdfium-review.googlesource.com/22740 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetItem to GetItemIfExistsDan Sinclair
Rename GetItem to make it clearer it can return nullptr. Change-Id: I0e09a79c3e2244b08212d3b51d3ad0e6a86edfd9 Reviewed-on: https://pdfium-review.googlesource.com/22713 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename CreateInstance to CreateInstanceIfPossibleDan Sinclair
This CL makes it clear that CreateInstance may return nullptr. Change-Id: I82f172a671761eae9055b0e9e55ab0e5a7d599aa Reviewed-on: https://pdfium-review.googlesource.com/22712 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Cleanup duplicate CXFA_Node accessorsDan Sinclair
These two accessors exist with other names or signatues, remove. Change-Id: Ieac073b746553160e4f2c41d9b63be47ad0ab61f Reviewed-on: https://pdfium-review.googlesource.com/22711 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-11Rename GetFormValue to GetFormValueIfExistsDan Sinclair
This CL makes it clear that GetFormValue can return nullptr and fixes up a few callsites as needed. Change-Id: Id2e85b0956a678b5b338b9e2a4d32731fe6c4729 Reviewed-on: https://pdfium-review.googlesource.com/22690 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>