summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/app.cpp
AgeCommit message (Collapse)Author
2015-11-05Fix all relative includes to third_party.chromium/2560chromium/2559chromium/2558chromium/2557Lei Zhang
- In non-standalone builds, use the provided jpeg library. - Run gn format over all the GN files. - Also roll DEPS for buildtools to c2f2598. BUG=541704 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425153006 .
2015-10-14Next round of master changes to match XFATom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1401423004 .
2015-10-09Pass IJS_Runtime, not IJS_Context, to native object constructors.Tom Sepez
This better separates the two IJS_ classes, with the IJS_Context taking on its proper role of describing an event. There's no need for the event details for object creation, so this gets much cleaner. Move some JS error reporting code from CJS_Context to CJS_Runtime. Make InitInstance() and ExitInstance() voids, they always return TRUE and we never check the result anyways. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1389163007 .
2015-10-08Wean CJS_Value off of v8::Isolate.Tom Sepez
CJS_Values should belong to CJS_Runtimes so that we may eventually cram much of the v8 dependencies down into fxjs. This is a first step; the remaining split in this code between isolate and CJS_Runtime goes away when fxjs provides a CFXJS_Runtime object, and the CJS_Runtime is-a/has-a CFXJS_Runtime. But that can't happen until this is resolved. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394103002 .
2015-10-07Rename IFXJS_Runtime and IFXJS_Context to IJS_.Tom Sepez
Nothing but sed. FXJS is a layer that makes it easier to define objects in V8, but has no knowledge of PDF-specific native objects. It could in theory be used to implement other sets of native objects. JS is the layer that implements PDF-specific native objects on top of FXJS. Therefore, the classes used to interface to JS should be named using IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1386173002 .
2015-10-06Store object definition ID in each js_class.Tom Sepez
Avoids doing a lookup via FXJS_V8 for something already known in CJS layer. Also: Consolidate repeated code in JS macros. Remove knowledge that Document is global from FXJS layer R=thestig@chromium.org Review URL: https://codereview.chromium.org/1382263002 .
2015-10-06Make the vast majority of JS headers private to src/javascript.Tom Sepez
The fpdfsdk/include/javascript/IJavascript.h is the sole API. This required moving a creaton method to it from JS_Runtime. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1389783002 .
2015-10-05Remove JavaScript.hTom Sepez
It merely includes a bunch of other .h files which are handled better since we fixed IWYU. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1385983002 .
2015-10-04Remove pointless CPDFSDK_PageView usage in CJS_Object / CJS_EmbedObj.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1374723004 .
2015-10-04CJS_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 .
2015-09-16Ensure functions in FXJS_V8 are prefixed by FXJS_.Tom Sepez
Currently, its hard to tell which functions come from the JS_ layer at fpdfsdk/include/javascript vs. which functions come from the FXJS_V8 layer at fpdfsdk/include/jsapi. Until we take up the task of using namespaces, at least make the prefix consistent. Move objects out of FXJS_V8 that are really part of JS_. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1347833002 .
2015-09-10Remove some abstractions in fxjs_v8.h.Tom Sepez
It's too hard to keep mapping between v8 and fx abstractions; the lack of transparency prevents those skilled in v8 only from working on this code. Apparently, the original intention was to confine v8 types to fpdfsdk/{include,src}/jsapi, but fpdfsdk/{include,src}/javascript is already well-polluted with v8 types. Also remove no-op JS_SetThisObj(). Also remove unused ParserParams() [noticed because it was incorrectly passing handles as pointers]. Also remove cast operator from CJS_Runtime and call GetIsolate() explicitly. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1332973002 .
2015-09-08Beef up app_props.in and tidy app.cpp.Tom Sepez
Some of the values returned are dubious; capture the current state of affairs. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1317393003 .
2015-09-08Change the JS app.viewerType() return value to "pdfium"Lei Zhang
BUG=pdfium:181 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1331633002 .
2015-08-14Use override in more classes in fpdfsdk/Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287193005 .
2015-08-13Remove if checks after new.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287863002 .
2015-08-06clang-format all pdfium code, again.Nico Weber
Also add a presubmit that checks for this so I don't have to keep doing it. No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i BUG=none R=thestig@chromium.org Review URL: https://codereview.chromium.org/1272653005 .
2015-08-04clang-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' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
2015-07-27Revert "FX Bool considered harmful, part 3"Tom Sepez
This reverts commit ff46aaf499edcf153ee2f57c7016587aa96dcfa0. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255293002 .
2015-07-27FX Bool considered harmful, part 3Tom Sepez
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
2015-07-23Revert "FX_BOOL considered harmful, part 2."Tom Sepez
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
2015-07-23FX_BOOL considered harmful, part 2.Tom Sepez
Fully automatic change, execpt for cleanup in fx_system.h R=thestig@chromium.org Review URL: https://codereview.chromium.org/1254703002 .
2015-07-16Tidy up CPDFDOC_Environment.Tom Sepez
- untabify as encountered. - Only put single-statement method in .h file, move more complex methods to .cpp (counting an if without braces as a single statement, killing braces as needed). - Move invariant arguments to constructor and make corresponding members const. - Make all members private and add accessor methods. - Make existing accessor methods const where possible. - Kill meaningless asserts. - Add helper functions in place of duplicate code. - Rename GetCurrentDoc() to GetSDKDocument(), since the class has two document members, one of CPDF_Document and one of CPDFSDK_Document, making it clear which one you get. - Simplify some logic with early returns. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1235393002 .
2015-06-22Cleanup: Remove more checks for new returning NULL.Lei Zhang
R=jam@chromium.org Review URL: https://codereview.chromium.org/1198903002.
2015-06-19Cleanup: Do not check pointers before deleting them.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004.
2015-05-19Replace v8::Handle with v8::Local and v8::Persistent with v8::GlobalJochen Eisinger
those types are just aliases, and we should consistently use the new version R=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/1138823004
2015-04-27Reduce usage of operator LPCWSTR from CFX_WideString().Tom Sepez
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. There are still some platform-specific code that needs the operator. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
2015-04-27Revert "Kill operator LPCWSTR from CFX_WideString()."Tom Sepez
This reverts commit 15a62973b9b89c3e229cc0ab501c45967f91b325. Reason for revert: broke build on windows, mac. I must have missed some platform-specific conversions. TBR=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1108883002
2015-04-27Kill operator LPCWSTR from CFX_WideString().Tom Sepez
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
2015-04-23Remove unused nParamNum values from JS method tables.Tom Sepez
The code to validate the number of parameters happens inside each particular method, rather than prior to method dispatch. As such, there's no point in having this number take up space in the table. Add some test to cover at least some of the per-method validations, and update error messages to be more useful. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1084183008
2015-04-23Kill overloaded cast operators in CJS_Value.Tom Sepez
The red-flag here is the explicit invocation of things like params[1].operator CFX_WideString() rather than static_cast<CFX_WideString>(params[1]) to invoke the conversion. Turns out the above won't compile due to ambiguity given the number of implicit constructors for widestrings. CJS_Value has both constructors and assignment operators for the primitive types, which means that conversions can take place unexpectedly in both directions, a second red flag. We don't want the compiler invoking these at will since it may hide bugs. In fact, when they are removed, three such places were discovered. Also rename ToJSValue to ToV8Value to match the other ToV8xxxxx functions added. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1096813008
2015-03-02Kill off JS_ErrorString type.Tom Sepez
This provides no benefit, and reduces transparency. Along the way: Kill off some unused/commented-out code. Return void where a bool return doesn't make sense. Remove a pointless template type. Remove now unused constants and types. R=thestig@chromium.org Review URL: https://codereview.chromium.org/971033002
2015-02-17Tidy up JS_Defines.hTom Sepez
This is a purely mechanical change, no new functionality. - Expand some macros which were merely a short-cut to save typing but reduced transparency. - Put GET_VALUE_TYPE() implementation into a .cpp file. This is a portion of the patch from issue 908033002 at patchset 40001 (http://crrev.com/908033002#ps40001) R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/927263003
2015-02-05Merge to master: Kill off some dodgy JS callbacksTom Sepez
Note that this work was done opposite the usual branch order, because I didn't want to kill things in master that turned out to be in use in XFA. Original Review URL: https://codereview.chromium.org/883393007 TBR=jam@chromium.org Review URL: https://codereview.chromium.org/903893002
2014-12-12Simplify PDFium by removing code that's not used in the open source repo.John Abd-El-Malek
-remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused R=tsepez@chromium.org Review URL: https://codereview.chromium.org/801913002
2014-12-08Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this.Bruce Dawson
Since casts to FX_LPCWSTR have been shown to hide bugs I tried removing more of them, targeting those places where a cast was used to force a conversion from CFX_WideString to FX_LPCWSTR, replacing these casts with calls to the newly added .c_str() function. This revealed two places where the cast was hiding a bug -- where ->c_str() was required instead! This removes ~33 FX_LPCWSTR casts and there are ~31 left, many of which will go away in some future change. Also includes this change: Removing unnecessary casts from wchar_t* to wchar_t*, by various names. Original patch from Bruce Dawson(brucedawson@chromium.org) R=bo_xu@foxitsoftware.com, tsepez@chromium.org Review URL: https://codereview.chromium.org/733693003
2014-11-14Remove FX_LPCWSTR cast to wchar_t* literalsBo Xu
BUG=https://code.google.com/p/pdfium/issues/detail?id=78 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/726143002
2014-08-22Fix confusion between length in bytes and length in characters in ↵Tom Sepez
app::response(). I also clean up the code while we are here, rewriting a strange switch statement and tidying whitespace. BUG=406142 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/498773004
2014-07-30Remove a few unused variables, functions, and member variables.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/426763003
2014-07-29Tidy up app::response().Tom Sepez
Follow-up from https://codereview.chromium.org/424883002/ - Remove some stray whitespace. - Fix "else after return". - Remove unused swResponse local. - Treat unexpectedly large responses as errors. BUG= R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/423953002
2014-07-14Fix an out-of-boundary issue for wide stringBo Xu
BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002
2014-05-23Convert all line endings to LF.John Abd-El-Malek
2014-05-17Initial commit.John Abd-El-Malek