summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_value.cpp
AgeCommit message (Collapse)Author
2018-08-30Stop using deprecated V8 APIs in CFXJSE_Value.Lei Zhang
Change-Id: I11772d2826ca23e8a07fef43a4fa50ead83292be Reviewed-on: https://pdfium-review.googlesource.com/41430 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-28Stop using deprecated v8::ObjectTemplate::NewInstance().Lei Zhang
Fix nits in affected files. Change-Id: I3a0363c9b7c28359fd1c7cea305e4f7705a228c2 Reviewed-on: https://pdfium-review.googlesource.com/41355 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-21Fix usage of deprecated V8 Value::*Value methodsDan Elphick
These parameterless methods are 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 these method will be removed in the very near future. Bug: v8:7786 Change-Id: Idbcd56a633c3b0b06ba8e60909fc0fb9c80f3410 Reviewed-on: https://pdfium-review.googlesource.com/40310 Commit-Queue: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org>
2018-07-24Remove lpClass argument from FXJSE_RetrieveObjectBinding()Tom Sepez
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>
2018-07-23Remove argument from CFXJSE_Value::ToHostObject()Tom Sepez
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>
2018-07-16Use UnownedPtr<> to v8::Isolates.Tom Sepez
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>
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>
2017-12-04XFA JS method cleanupdan sinclair
Change-Id: I182388970e422bd31d011628a4f1b905d12b0da0 Reviewed-on: https://pdfium-review.googlesource.com/20193 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Cleanup CFXJSE_Value::SetObjectDan Sinclair
All of the callers to SetObject pass in the class so we can remove the class check. The SetJSObject method is no longer needed. The SetHostObject method has been merged into the SetObject method. Change-Id: Id80931b88cc0656d021350ea8d62369513b86b9d Reviewed-on: https://pdfium-review.googlesource.com/17858 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-07-19Rename StringCs c_str() to unterminated_c_str().Tom Sepez
Since there is no guarantee of termination if the StringC was extracted from a snippet of another string. Make it more obvious that things like strlen(str.unterminated_c_str()) might be a bad idea. Change-Id: I7832248ed89ebbddf5c0bcd402aac7d40ec2adc2 Reviewed-on: https://pdfium-review.googlesource.com/8170 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-03-14Replace FX_FLOAT with underlying float type.Dan Sinclair
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-01-11Cleaning up memory allocation in CXFA_FM2JSContext - IVDan Sinclair
This CL removes the use of FX_Alloc and any remaining new'd CFXJSE_Value objects from CXFA_FM2JSContext and replaces them with unique_ptrs and vectors. Change-Id: I30ba697d65ee326d2faa895c3217bdc407419298 Reviewed-on: https://pdfium-review.googlesource.com/2157 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-11-03Remove FX_BOOL entirely.tsepez
FX_BOOL was a type just like a regular C++ bool, except that it took 4x the space and frequently was used to hold values besides true or false. Review-Url: https://codereview.chromium.org/2471353002
2016-09-29Move fxjs/include to fxjsdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2380713005
2016-07-12Rename fxjse/ to fxjs/ update files to match class names.dsinclair
This Cl moves the fxjse/ directory to fxjs/ in anticipation of merging in fpdfsdk/jsapi. In the process the filenames are updated to better match the class contents. Static methods are moved to anonymous namespaces as possible. Review-Url: https://codereview.chromium.org/2136213002