summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
AgeCommit message (Collapse)Author
2016-02-04Pdfium does not create isolate when it runs in chromiumjinming_wang
BUG=pdfium:373 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1652873003 .
2016-01-08XFA: Remove relative includes outside of xfa/.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1572523002 .
2015-12-22Merge to XFA: Add ContainsKey() and ContainsValue() and use them where ↵Lei Zhang
appropriate. TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1540263003 . (cherry picked from commit 1fc92867ca53f0fba4272fbee3814d844f487495) Review URL: https://codereview.chromium.org/1542193002 .
2015-11-30Tidy PDF_ENABLE_XFA #ifdefs in fpdfsdk.Tom Sepez
-- label matching #endifs -- prefer #ifdef over #ifndef -- consolidate some blocks. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1484843002 .
2015-11-25Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1477583002 .
2015-11-24Introduce "underlying types" to abstract XFA differences.Tom Sepez
See the comment in fsdk_define.h. Also tidy up a bit, and remove dead DeletePages(). This should help us match master more closely (given corresponding changes on the master side). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1473503002 .
2015-11-20Update XFA fpdfsdk to match masterTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1465663002 .
2015-11-12Merge to XFA: Remove relative includes.Lei Zhang
That refer to parent directories. TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 . (cherry picked from commit 22bc4227fbbda5a5e9abad2a2c0a98c04fe7f228) Review URL: https://codereview.chromium.org/1439223003 .
2015-11-10Merge to XFA: Keep "static" objects per-context rather than per isolate.Tom Sepez
Original Review URL: https://codereview.chromium.org/1424933013 . (cherry picked from commit 7d4c74d1b96d82681d49519c129262a1568e87d4) TBR=jochen@chromium.org Review URL: https://codereview.chromium.org/1407063012 .
2015-11-10Segv when PDF-side JS object property getter invoked from XFA.Tom Sepez
The PDF-side native objects require that the current v8 context has been set-up to point at the state (via CJS_Runtime) for the getters, setters, and methods to operate against. XFA doesn't supply a context with that state, so at the first opportunity for a PDF-side object to be leaked to XFA, set up the context to mimic the PDF side. Changed FXJS_GetRuntimeFromIsolate() to FXJS_GetRuntimeFromV8Context() for consistency with the newly added method. BUG=pdfium:266 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1412103010 .
2015-10-13Merge to XFA: Pass IJS_Runtime, not IJS_Context, to native object constructors.Tom Sepez
Original Review URL: https://codereview.chromium.org/1389163007 . (cherry picked from commit 848a13b6777cbff8cc4aea3ab3d69eaa0b82ae6c) Merge conflics in: fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/javascript/JS_Runtime_Stub.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394993006 .
2015-10-13Merge to XFA: Allow compiling PDFium without V8.Tom Sepez
Original Review URL: https://codereview.chromium.org/1395733006 . (cherry picked from commit f1c713663192368d26031a4caed1f9705f4510af) Conflicts: BUILD.gn fpdfsdk/src/fpdfview.cpp fpdfsdk/src/javascript/JS_Runtime.cpp pdfium.gyp samples/BUILD.gn samples/samples.gyp BUG=pdfium:211 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1393833006 .
2015-10-12Allow building of XFA branch without XFATom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1399833002 .
2015-10-08Merge to XFA: Wean CJS_Value off of v8::Isolate.Tom Sepez
(cherry picked from commit 287b63d9ab410783d71cf37291f09fd57d3059b4) Original Review URL: https://codereview.chromium.org/1394103002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394053003 .
2015-10-08Merge to XFA: Only call DefineJSObjects() once for the global V8 isolate.Lei Zhang
BUG=539106 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1386823002 . (cherry picked from commit 7dfe5929282cb6d78d7b5e32e1d72e9db99d3066) Review URL: https://codereview.chromium.org/1400503003 .
2015-10-08Merge to XFA: Rename IFXJS_Runtime and IFXJS_Context to IJS_.Tom Sepez
Merge conflicts in: fpdfsdk/src/javascript/Document.cpp fpdfsdk/src/javascript/JS_Define.h New code in: fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp (cherry picked from commit 213a172779fddbd7e588ee2e2b3906ccc47d6896) Original Review URL: https://codereview.chromium.org/1386173002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1395713002 .
2015-10-07Merge to XFA: Pass v8::Isolate to PDFium at init time.Tom Sepez
New code changes in JS_Runtime.cpp. (cherry picked from commit 3dedace9623fef6161a8666e53a4ab2b9be61e4c) Original Review URL: https://codereview.chromium.org/1367033002 . Also merge to XFA: Run FXJS_V8 embedder tests against a shared isolate, since the two go together. (cherry picked from commit 4ea721cb7954898a9722c389dae86c62957352d0) Original Review URL: https://codereview.chromium.org/1377293004 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1381633008 .
2015-10-06Merge to XFA: Store object definition ID in each js_class.Tom Sepez
Manual edits in JS_Define.h. (cherry picked from commit f0a5b2803c09f3605dcd606e764ef604f0d2a8ea) Original Review URL: https://codereview.chromium.org/1382263002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1382683008 .
2015-10-06Merge to XFA: Make the vast majority of JS headers private to src/javascript.Tom Sepez
(cherry picked from commit 5b3d0208723f21c50b9922bdc500c9d78c359a25) Original Review URL: https://codereview.chromium.org/1389783002 . New changes to fix IWYU in: fpdfsdk/include/fpdfxfa/fpdfxfa_app.h xfa/include/fxfa/fxfa.h xfa/include/fxfa/fxfa_objectacc.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1388023003 .
2015-10-05Merge to XFA: CJS_Timer should observe CJS_Runtime destruction.Lei Zhang
Also remove dead CJS_EmbedObj::{Begin,End}Timer code. BUG=539107 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1384883002 . (cherry picked from commit 794c9b67d3d519342aa7e15052766f7d4a99f551) Review URL: https://codereview.chromium.org/1386053002 .
2015-10-05Merge to XFA: Remove JavaScript.hTom Sepez
Small manaul merge in JS_Object.cpp (cherry picked from commit 5e8b7356d68e35d7d631a2a917e651a4e7c73b65) Original Review URL: https://codereview.chromium.org/1385983002 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1381233005 .
2015-09-22Merge to XFA: Use std::set<> to track active event handlers.Tom Sepez
Merge conflicts in JS_Runtime.cpp (cherry picked from commit d8d223127d706aa4961b2c9b0037ab256fce9a8f) Original Review URL: https://codereview.chromium.org/1352393003 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1365503003 .
2015-09-22XFA: contention between FXJSE and FXJS over isolate data slotsTom Sepez
This probably broke at 06b60021e when the FXJS slot moved to 0 from 1 unless explicitly overriden by the embedder, which conflicted with the FXJSE_ usage of slot 0. Also simplify some logic used to track global intialization of the underling JS. TEST=run_javascript_tests.py on XFA branch doesn't segv. R=jochen@chromium.org Review URL: https://codereview.chromium.org/1351173002 .
2015-09-21Merge to XFA: Remove CJS_RuntimeFactoryTom Sepez
New edits in: fpdfsdk/include/fpdfxfa/fpdfxfa_app.h fpdfsdk/include/javascript/IJavaScript.h fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp (cherry picked from commit bca779d0957965eb2ebfad5479e0894844749626) Original Review URL: https://codereview.chromium.org/1360523004 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1348393007 .
2015-09-17Merge to XFA: Don't pass null isolates to FXJS_ when we have a real isolate.Tom Sepez
(cherry picked from commit 34b39e1d4fa0b16d47770b823230344356cc451a) Original Review URL: https://codereview.chromium.org/1350703003 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1342403005 .
2015-09-17Merge to XFA: Ensure functions in FXJS_V8 are prefixed by FXJS_.Tom Sepez
Manual edits: fpdfsdk/include/javascript/JS_Define.h fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp fpdfsdk/src/javascript/Document.cpp fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp (cherry picked from commit 506df426d5d64d68e9dc27ffebcf56f6c6a1bccf) Original Review URL: https://codereview.chromium.org/1347833002 . (cherry picked from commit 455019ca48f60bd285e043986471f51f17c69a0d) Original Review URL: https://codereview.chromium.org/1349783003 . (cherry picked from commit 1af240cc45480520b447be767686e73a29c48f9e) Original Review URL: https://codereview.chromium.org/1348693003 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1356563003 .
2015-09-15Merge to XFA: Refactor fxjs_v8 and add embeddertests for it.Tom Sepez
(cherry picked from commit b17d62601b21dfce85718e08cfd0ffce3a45d74e) (cherry picked from commit 09ed30750282bf56a92d0e646ab22c64bea81a36) Manual edits: fpdfsdk/src/jsapi/fxjs_v8_embeddertest.cpp - add lockers. fppdfsdk/src/javascript/JS_Runtime.cpp - rework XFA init path. Original Review URL: https://codereview.chromium.org/1338073002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1348433002 .
2015-09-14Merge to XFA: Get CJS_RuntimeFactory out of CJS_GlobalData management.Tom Sepez
(cherry picked from commit 9a817f092e6800e9338b41acf4ea0416b6ad4467) Original Review URL: https://codereview.chromium.org/1338993005 . Small manual merge in fpdfsdk/src/javascript/JS_GlobalData.cpp fpdfsdk/src/javascript/global.cpp TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1341913002 .
2015-09-11Merge to XFA: Fix strings, ..., void return types for Consts.h.Tom Sepez
(cherry picked from commit f9e40aec10263f9445d69598657f42550294d653) Orignal Review URL: https://codereview.chromium.org/1342433002 . R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1338003004 .
2015-09-11Merge to XFA: Rename Init methods to more accurately describe purposeTom Sepez
(cherry picked from commit df4de98c06075b0e491ac645f2d118a6813cedc9) Trivial manual merges in fpdfsdk/include/javascript/JS_Runtime.h fpdfsdk/src/javascript/JS_Runtime.cpp Original Review URL: https://codereview.chromium.org/1335763002 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1334313002 .
2015-09-10Merge to XFA: Remove some abstractions in fxjs_v8.h.Tom Sepez
Conflicts: fpdfsdk/src/javascript/Document.cpp fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp New: fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp (cherry picked from commit 6df59849472958e7de96da6d9fc7b223b7c1f1c3) Original Review URL: https://codereview.chromium.org/1332973002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1334833003 .
2015-08-05Merge to XFA: Don't dispose the isolate if its provided by the embedderJochen Eisinger
(cherry picked from commit 7ea305f1bd4efc1838fba053e4399358d6765ec7) Original Review URL: https://codereview.chromium.org/1269783005 . BUG=chromium:515718 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1270293002 .
2015-08-04XFA: clang-format all pdfium code.Nico Weber
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
2015-07-30Merge to XFA: Plumb in an externally created v8::IsolateJochen Eisinger
Origin Review URL: - https://codereview.chromium.org/1234053003 - https://codereview.chromium.org/1241863004 - https://codereview.chromium.org/1235303003 R=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1263963002 .
2015-07-23Merge to XFA - else after returns.Tom Sepez
(cherry picked from commit 3c012fef2bb72c8ec1faa73e11ee35539b2559d6) Original Review URL: https://codereview.chromium.org/1243953004 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1239313005 .
2015-07-22Merge to XFA: Remove dead code found by Scythe.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1249643003 . (cherry picked from commit b05f1fd710496dea44b001bb905fa1c16a39bb28) Review URL: https://codereview.chromium.org/1250433003 .
2015-07-16Merge to XFA: Cleanup: Do not check pointers before deleting them, part 2.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1195363002 . (cherry picked from commit 21bf242a31eff79f754c5e9c3b41c52e33483bb0) Review URL: https://codereview.chromium.org/1235753006 .
2015-06-13Remove trailing whitespaces in fpdfsdk, XFA edition.Lei Zhang
Review URL: https://codereview.chromium.org/1185843005.
2015-06-10Merge to XFA: Remove FX_BSTR and FX_WSTR typedefs.Tom Sepez
Nearly automatic merge + re-run script on new files. Original Review URL: https://codereview.chromium.org/1180593004. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1174303002.
2015-06-10Merge to XFA: Remove typdefs for pointer types in fx_system.h.Tom Sepez
Original Review URL: https://codereview.chromium.org/1171733003 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1178613002.
2015-05-27Make CPDFXFA_App / IXFA_AppProvider sanerTom Sepez
Move interface comments from the implementation header to the interface header. Replace Create / Release functions with static methods. Replace dubious Release() methods with deletion via virtual dtor, also for IXFA_App and IXFA_FontMgr while we're at it. Untabify and fix (theoretically) illegal _CAP include guard definitions for fpdfxfa/ headers. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1153553003
2015-05-19Merge V8 API updates to xfa branchJochen Eisinger
Set pointers in internal fields directly instead of wrapping them Review URL: https://codereview.chromium.org/1139853003 Use phantom handles instead of weak handles Review URL: https://codereview.chromium.org/1129253004 Replace deprecated with non-deprecated V8 APIs Review URL: https://codereview.chromium.org/1126203010 Add myself to OWNERS file Review URL: https://codereview.chromium.org/1133333005 Replace v8::Handle with v8::Local and v8::Persistent with v8::Global Review URL: https://codereview.chromium.org/1138823004 TBR=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1140033004
2015-04-30Merge to XFA: Fix V8 array buffer allocator.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1118143003
2015-02-25Merge to XFA: Kill off unused IFXJS interface methods.Tom Sepez
Original Review URL: https://codereview.chromium.org/954923004 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/952213004
2015-02-10Merge https://codereview.chromium.org/897973002/ and ↵John Abd-El-Malek
https://codereview.chromium.org/902753002/ to XFA branch R=jochen@chromium.org Review URL: https://codereview.chromium.org/887073005
2014-12-15XFA: merge patch from issue 801913002 and 804463003John Abd-El-Malek
Simplify PDFium by removing code that's not used in the open source repo. -remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused Fix build after previous commit. TBR=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/809513002
2014-11-14Merge to XFA: Patch from CL 726143002Bo Xu
BUG=https://code.google.com/p/pdfium/issues/detail?id=78 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/726143002
2014-11-14Merge to XFA: Patch from CL 705503004Bo Xu
Change from 'this' to L'this' and remove the cast that was hiding this mismatch. Found by VC++'s /analyze. Warning was: fpdfsdk\src\javascript\js_runtime.cpp(352) : warning C6276: Cast between semantically different string types: char * to wchar_t *. Use of invalid string can lead to undefined behavior. This mismatch has been there as far back as the history goes (to May of this year). It looks like a real bug to me. However I don't know the implications of this bug and why it would not have been noticed at run-time. The code has been this way as far back as the git history goes, but that is only to May 2014. Original patch from Bruce Dawson(brucedawson@chromium.org) BUG=427616 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/705503004
2014-11-03Do not Initialize v8 in fpdfsdk, since this has been done in xfaBo Xu
2014-11-03Merge XFA to PDFium master at 4dc95e7 on 10/28/2014Bo Xu