summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_formcalc_context_embeddertest.cpp
AgeCommit message (Collapse)Author
2018-06-21Use the length of calculated string instead of sourceRyan Harrison
In this function a string is converted to UTF8, if there are non-printing characters in the original string, the generated string will be shorter. Thus using the original string length for iteration range will cause an OOB read. BUG=chromium:854623 Change-Id: I338005476c3de529709f3eae6892d27a6c7f2263 Reviewed-on: https://pdfium-review.googlesource.com/35810 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-06-20c_str() calls not needed when writing to ostreamTom Sepez
c_str() is a bit of a code smell, esp. since Byte/Wide strings know how to do this all by themselves. Change-Id: I9c86cee42c12a3f72ddb1d410a91cf25647d0ce6 Reviewed-on: https://pdfium-review.googlesource.com/35530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-05-29[xfa] Propagate the xfa change data for text to JS and back.Dan Sinclair
This CL adds the necessary plumbing to propagate the change information for a text widget from FWL out to JS and handle the returned value as necessary. Bug: pdfium:1066 Change-Id: I78fd81761b90294f1836e9f09dba12ed238963cc Reviewed-on: https://pdfium-review.googlesource.com/33070 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-25[xfa] Generate CXFA_EventParam.newText dynamicallyDan Sinclair
When an xfa.event is sent it is possible to change the selStart, selEnd and change values of the event. This should cause the value of newText to be changed as needed. This CL removes m_wsNewText from CXFA_EventParam and instead generates the new text based on the previous text, the selection and the change. Bug: 1066 Change-Id: I35d126fad9771c8980654a8af64d2b98989bff3f Reviewed-on: https://pdfium-review.googlesource.com/32970 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-25[xfa] Add missing xfa.event.cancelAction propertyDan Sinclair
This CL adds the missing cancleAction property from the xfa.event object. Bug: 1066 Change-Id: I7d38956e2985c1f6ac0eba6de090874f1f72003c Reviewed-on: https://pdfium-review.googlesource.com/32950 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-25[xfa] Clamp selStart, selEnd values in CJX_EventPseudoModelDan Sinclair
This CL adds bounds checking for the selStart and selEnd settings of the event object. The selEnd is not allowed to be less then selStart. They are also not allowed to be negative. This also clamps them to the length of the prevText string. Bug: 1066 Change-Id: Ifc9113c669c83a4a97655554affbbce30c2bfc64 Reviewed-on: https://pdfium-review.googlesource.com/32933 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-25[xfa] Restrict the editable xfa.change propertiesDan Sinclair
According to the XFA Spec only the cancelAction, selStart, selEnd and change properties of xfa.event are editable. This CL adds checking to early out if attempting to set any of the other properties. Bug: 1066 Change-Id: Ie6129e1f65de7584f0b5f3072a1acf6e25d44a2c Reviewed-on: https://pdfium-review.googlesource.com/32932 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-25[xfa] Allow accessing the event changed parameter from JS.Dan Sinclair
This CL updates the CFXJSE_Engine code to access the defined properties of a class if we fail to find the property in any other way. This fixes up an issue where we were unable to read the 'change' property of the CJX_EventPseudoModel because we could not find the 'change' property. Bug: 1066 Change-Id: I4ad205bc527beeca1c3e24a36cdde0c21287d9fb Reviewed-on: https://pdfium-review.googlesource.com/32930 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-10Cleanup formcalc method generationchromium/3427Dan Sinclair
This CL simplifies the FormCalc method call generation when converted to JavaScript. Currently we output the same chunk of code to run the given method on an array or object per method call. This CL pulls out the common execution code to a pfm_method_runner function which is used instead. An embedder test has been added to verify that method invocation from formcalc works correctly. Bug: chromium:814848 Change-Id: I1ec052eab051053fedcb464d57e0e15228b8c5a2 Reviewed-on: https://pdfium-review.googlesource.com/32372 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-01Move some XFA JS code into fxjs/Dan Sinclair
This CL renames cxfa_scriptcontext to cfxjse_engine and cxfa_fm2jscontext to cfxjse_formcalc_context. From reading the code, the script context appears to handle the v8 setup and object code. The formcalc context code is related to handling the JS code generated from the transpiler. I, think, these new names make the intended usage clearer. They also move the code into fxjs/ to keep along side the rest of the JS code. Change-Id: I50619fbe48ca1f553a44cf0e0cb0210be8e45e4f Reviewed-on: https://pdfium-review.googlesource.com/17130 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>