summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
AgeCommit message (Collapse)Author
2015-11-16Reland "Cleanup some numeric code.""chromium/2567Dan Sinclair
This reverts commit 0569ab0b11b723d9bca4ddd642b0cf8828c4bdd1. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1449873003 .
2015-11-12Remove relative includes.Lei Zhang
That refer to parent directories. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 .
2015-11-11Replace CJS_Parameters with std::vector<CJS_Value>.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1437713003 .
2015-11-11Cleanup CPDF_ApSettings and CJS_Parameters.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1432863004 .
2015-11-10Keep "static" objects per-context rather than per isolate.Tom Sepez
Every time we initialize a new v8::Context, we make a new set of pre-existing native objects, and overwrite the v8::Global handles to those in the previous set. Thus, we may be theoretically releasing some v8::Globals early. R=jochen@chromium.org Review URL: https://codereview.chromium.org/1424933013 .
2015-11-10Revert x4 "Cleanup some numeric code."dan sinclair
This reverts commit b27902b8995bb3e003daed6b0811ed746763c68d. Cleanup some numeric code. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1432973003 .
2015-11-10Revert "Revert "Revert "Revert "Cleanup some numeric code.""""dan sinclair
This reverts commit da06e60fb5a095a91c9a4f509466667878624cb3. Cleanup some numeric code. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1433513002 .
2015-11-09Remove CFX_PtrArray usage in fpdfsdk.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1430213002 .
2015-11-06Fix all relative includes to core.Lei Zhang
Do some IWYU to fix build errors due to files that have no #includes but just happened to work previously because the #includes were in the right order. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1407423004 .
2015-11-06Remove FXJS_GetRuntimeTom Sepez
Its pointless to have a function that gets the isolate given a v8::object, since v8 gives us that directly. Also remove some CreationContext() calls, since they are only used to get the isolate, and we can do so directly. R=jochen@chromium.org Review URL: https://codereview.chromium.org/1413733004 .
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-11-04Cleanup: Remove some NULL checks in fpdfsdk.Lei Zhang
And simplify code. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1411663013 .
2015-11-04Make JS app.setTimeOut() work again.Lei Zhang
This regressed in commit 794c9b6. BUG=551248 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1424743006 .
2015-11-04Make JS_Define.h match XFATom Sepez
Renames one local variable. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1424713005 .
2015-11-03Revert "Revert "Revert "Cleanup some numeric code."""Dan Sinclair
This reverts commit e0e922db5fb77df9a5a9cc802096f484ed21da1c. Broke Windows build. FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_gcc.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_gcc.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(75) : see reference to function template instantiation 'T FXSYS_StrToInt<int32_t,const FX_WCHAR*>(STR_T)' being compiled with [ T=int32_t , STR_T=const FX_WCHAR * ] e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_gcc.cpp(28) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text.cpp(439) : error C2039: 'isdigit' : is not a member of 'std' FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj.rsp /c ..\..\core\src\fxcrt\fx_basic_wstring.cpp /Foobj\core\src\fxcrt\fxcrt.fx_basic_wstring.obj /Fdobj\fxcrt.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : error C2220: warning treated as error - no 'object' file generated e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(973) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data e:\b\build\slave\windows\build\pdfium\core\src\fxcrt\fx_basic_wstring.cpp(981) : warning C4244: 'argument' : conversion from 'const FX_WCHAR' to 'char', possible loss of data FAILED: ninja -t msvc -e environment.x86 -- "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\core\src\fpdftext\fpdftext.fpdf_text_int.obj.rsp /c ..\..\core\src\fpdftext\fpdf_text_int.cpp /Foobj\core\src\fpdftext\fpdftext.fpdf_text_int.obj /Fdobj\fpdftext.cc.pdb e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2436) : error C2039: 'isdigit' : is not a member of 'std' e:\b\build\slave\windows\build\pdfium\core\src\fpdftext\fpdf_text_int.cpp(2440) : error C2039: 'isdigit' : is not a member of 'std' ninja: build stopped: subcommand failed. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1431683008 .
2015-11-03Revert "Revert "Cleanup some numeric code.""Dan Sinclair
This reverts commit 23d576f0b498bd4f37ef2175916223a2e5ea0324. Cleanup some numeric code. This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405253007 .
2015-10-29Revert "Cleanup some numeric code."dan sinclair
This reverts commit 589f7e0a57675efce9810c15a3e9b7c49bf0bc90. Broke the build on Mac, unable to find std::isdigit. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1428853002 .
2015-10-29Cleanup some numeric code.Dan Sinclair
This changes the various comparisons of char >= '0' && char <= '9' and char < '0' || char > '9' to use std::isdigit checks. It also cleans up a handful of hex to digit conversions to call one common method. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1415933005 .
2015-10-21More master side changes for convergence with XFA.Tom Sepez
- Add new CPDFSDK_Document::GetPDFDocument() - FPDFDocumentFromCPDFDocument() to match XFA - rename some JS variables to be consistent with XFA - remove unused param from CJS_GlobalData(). - kill dead code used XFA only. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1413883005 .
2015-10-21Add type cast definitions for CPDF_Name.Dan Sinclair
This Cl adds ToName, CPDF_Object::AsName and CPDF_Object::IsName and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1417823005 .
2015-10-21Add type cast definitions for CPDF_String.Dan Sinclair
This Cl adds ToString, CPDF_Object::AsString and CPDF_Object::IsString and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1417933002 .
2015-10-21Add type cast definitions for CPDF_Number.Dan Sinclair
This Cl adds ToNumber, CPDF_Object::AsNumber and CPDF_Object::IsNumber and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1410673005 .
2015-10-20Add type cast definitions for CPDF_Boolean.Dan Sinclair
This CL adds ToBoolean, CPDF_Object::AsBoolean and CPDF_Object::IsBoolean and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417623005 .
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-09Allow compiling PDFium without V8.Tom Sepez
Original patch from issue 1391843004 at patchset 1 (http://crrev.com/1391843004#ps1) Introduce a pdf_enable_v8 GYP variable, which controls a corresponding PDF_ENABLE_V8 #define, and bring in the real JS library when set. Otherwise, link against a stub JS runtime. BUG=pdfium:211 R=dml@google.com, jochen@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1395733006 .
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-06Remove unused global argument from FXJS_CONSTRUCTOR.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1389003003 .
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-04Only call DefineJSObjects() once for the global V8 isolate.Lei Zhang
BUG=539106 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1386823002 .
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-10-02Pass v8::Isolate to PDFium at init time.Tom Sepez
Move the external isolate and embedder slot from the IPDF_JSPlatforms struct supplied at the FPDFDOC_InitFormFillEnvironment() call time to arguments to the FPDF_InitLibraryWithConfig() call. This has several benefits: -- Avoids the crash that could happen if multiple FPDFDOC_InitFormFillEnvironmen() calls should happen to be made by an embedder with different slot values. -- Down the road, for XFA, there may be XFA but no FormFill environment. We support both forms for the time being, until the chrome side catches up, at which point we will deprecate the old way. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1367033002 .
2015-10-01Revert "Leak per-isolate data in pdfium"Raymes Khoury
This reverts commit 3e144b8c23d7c52ed36329e87f0cb01f38ec1ed7. This may be causing the failures seen in crbug.com/537799. BUG=537799 Review URL: https://codereview.chromium.org/1382433003 .
2015-09-30Leak per-isolate data in pdfiumchromium/2525chromium/2524Raymes Khoury
Right now we're freeing per-isolate data everytime a document is destroyed even though it may be in use by other documents. For now we leak the per-isolate data until crbug.com/531339 is fixed. BUG=531339 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1372353002 . Patch from Raymes Khoury <raymes@chromium.org>.
2015-09-22Use std::set<> to track active event handlers.Tom Sepez
This avoids some custom linked-list code. Also note that we use a local copy to be sure we removed the same thing that was added no matter how our callees may muck with the handler. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1352393003 .
2015-09-21Remove CJS_RuntimeFactorychromium/2519chromium/2518chromium/2517Tom Sepez
The Factory Design Pattern isn't buying us anything here over just new'ing the object we want. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1360523004 .
2015-09-21More tidy of CJS_Object, kill implicit cast operatorTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1349423006 .
2015-09-17Don't pass null isolates to FXJS_ when we have a real isolate.Tom Sepez
Kill some now unused functions as a result. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1350703003 .
2015-09-16Fix build broken at 506df426d5d6.Tom Sepez
Move header file includes when usage moved. Windows-only section missing a ")". TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1349783003 .
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-15Refactor fxjs_v8 and add embeddertests for it.Tom Sepez
This forces the layer defined by fxjs_v8.h to be (more) self-contained, so that it can be tested apart from the CJS_* objects (in fpdfsdk/{src,include}/javascript. This implies the array buffer allocator must be part of fxjs_v8. One wrinkle is that we'd like to be able to test an isolate upon which no native objects have been added, so some initialization that would have occurred as part of object definition must be made explicit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1338073002 .
2015-09-14Get CJS_RuntimeFactory out of the CJS_GlobalData management business.Tom Sepez
First part of getting rid of CJS_RuntimeFactory. The factory design pattern isn't appropriate here since we only ever make one kind of object. CJS_GlobalData is now perfectly capable of managing itself through internal ref counts. I'm philosophically opposed to keeping ref-counts outside the object (do you hear me std::shared_ptr, you're bad!) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1338993005 .
2015-09-11Fix strings, remove stringify macros, void return types for Consts.h.Tom Sepez
Replace multiple #defines of the same strings with externs. Fix strings mangled by interaction of # and clang-format. Remove macros as possible. Make more JS_ functions void and simplify. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1342433002 .
2015-09-11Rename Init methods to more accurately describe purposeTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1335763002 .
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-10Resolve bad cast to CJS_EventHandlerfoxit
At line 2026 in pdfsdk/src/javascript/PublicMethods.cpp, the writer wants to perform type cast like line 2027 but he made a mistake to make type conversion on m_pValue. Even at line 2027, it's redundant to make type conversion. The returned type of pContext->GetEventHandler() is CJS_EventHandler*. BUG=529310 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1325753007 .