summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
AgeCommit message (Collapse)Author
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 .
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-31CJS_Context::compile unusedTom Sepez
This, in turn, allows us to get rid of the DoJob method and its clumsy mode parameter conditional. Add explicit and consts, and remove pointless asserts along the way. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1318543012 .
2015-08-31Fix two issues shown by bug 489995Tom Sepez
- Handle NULL in buffer operator<< under JS mailForm() calls. - Ensure correct type in JS addIcon() calls. BUG=489995 R=brucedawson@chromium.org, thestig@chromium.org Review URL: https://codereview.chromium.org/1327473002 .
2015-08-19Extern in .cpp files is a code smell.Tom Sepez
Part 1. Move to headers so compiler can type check against the definitions. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1299963002 .
2015-08-17CFX_MapByteStringToPtr considered harmful.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1297723002 .
2015-08-17Fix more sign comparison errors.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1290383003 .
2015-08-17js_global_data and global_alternate violate naming rules.Tom Sepez
They look too much like locals; use JSGlobalData and JSGlobalAlternate instead. Kill some commented out code. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1289903004 .
2015-08-14Use override in more classes in fpdfsdk/Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287193005 .
2015-08-13Tidy up JS_Object.h and JS_Object.cpp.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1293673003 .
2015-08-13Kill JS_TIMER_MAPARRAYTom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1286383004 .
2015-08-13Remove if checks after new.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287863002 .
2015-08-11Fix some sign comparison warnings.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1279493003 .
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-05Don't dispose the isolate if its provided by the embedderchromium/2474Jochen Eisinger
BUG=chromium:515718 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1269783005 .
2015-08-04Remove stringify macro (#) from JS_STATIC_CONST_ENTRY_*.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1256283005 .
2015-08-04Quick fix in Consts.cpp to make tests pass after the clang-format CL.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1269223002 .
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-23document.delay and document.external are boolean properties.Tom Sepez
This is the javascript test failure at 320b2313d198. The spec says they are booleans, not ints, so correct the behaviour now. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1242263010 .
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-23Fix FX_BOOL type mismatches.Tom Sepez
Extracted from https://codereview.chromium.org/1252613002/ R=thestig@chromium.org Review URL: https://codereview.chromium.org/1253603002 .
2015-07-22Re-land else-after-returnsTom Sepez
Revert "Revert "Fix else-after-returns throughout pdfium."" This reverts commit 4eb4d7f6c707cc2c23c806aa540d055c8832b55d. Fix one naming conflict. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1243953004 .
2015-07-22Revert "Fix else-after-returns throughout pdfium."Tom Sepez
This reverts commit 7cc97521db1e52d5927f5605de5f9a7102f8af40.
2015-07-22Fix else-after-returns throughout pdfium.Tom Sepez
Driven by CS search for pcre:yes file:third_party/pdfium/ -file:pdfium/third_party/ \breturn\b[^;]*;\s*\n*\s*\}*\s*\n*\r*else Note: Care is required to ensure the preceding block is not an else-if. As usual, removed any tabs I saw. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1243883003 .
2015-07-22Remove dead code found by Scythe.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1249643003 .
2015-07-16Cleanup: Do not check pointers before deleting them, part 2.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1195363002 .
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-07-16Make v8 embedder data slot configurablechromium/2460chromium/2459chromium/2458Jochen Eisinger
Chrome already uses 0 and 1. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1235303003 .
2015-07-15Add missing reinterpret_cast from void to v8::Isolate*Jochen Eisinger
BUG=none TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1241863003 .
2015-07-15Plumb in an externally created v8::IsolateJochen Eisinger
In Chrome, all Isolates must be created by gin R=tsepez@chromium.org, ulan@chromium.org BUG= Review URL: https://codereview.chromium.org/1234053003 .
2015-07-01Fix some clang warnings with -Wmissing-braces in pdfium.Nico Weber
Clang warns if there are missing braces around a subobject initializer. The most common idiom that triggers this is: STRUCT s = {0}; if the first field of STRUCT is itself a struct. This can be more simply written as: STRUCT s = {}; which also prevents the warning from firing. Other instances of the warning have been fixed by adding braces where appropriate. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1213523004.
2015-06-22Fix Javascript tests after commit f55771af6429.chromium/2445chromium/2444chromium/2443chromium/2442chromium/2441chromium/2440Lei Zhang
- Return true instead of false. All the other unsupported JS functions return true. - Adjust test expectations accordingly. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1196163006.
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-22Delete dead code for deleting pages and icons.Lei Zhang
1) Document::deletePages() 2) CPDFSDK_Document::DeletePages() 3) Document::removeIcon() 4) IconTree::DeleteIconElement() Originally (1) called (2), but only when FOXIT_CHROME_BUILD was not defined. Since it was always defined for PDFium, this was effectively dead code the whole time. Ditto for (3) and (4). The functions were deemed unsafe in https://crbug.com/67100 R=jam@chromium.org Review URL: https://codereview.chromium.org/1193323002.
2015-06-19Cleanup: Do not check pointers before deleting them.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1192743004.
2015-06-15Do some IWYU cleanups.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1176333002.