summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
AgeCommit message (Collapse)Author
2016-09-08Remove unused context parameter from JSGetStringFromIDtsepez
Clean up before using IDS_STRING_JSBADOBJECT in nearly all JS callbacks, which will happen in the next CL when we watch C-side object destruction. Add a "no permission" message as well. Review-Url: https://codereview.chromium.org/2319543003
2016-09-08Replace CJS_Runtime::Observer with CFX_Runtime<CJS_Runtime>::Observertsepez
Previously, the observer set a flag which conditionalized a null pointer return. Now, we just clear the pointer. Destruction order matters, so add a method to trigger notifications. Review-Url: https://codereview.chromium.org/2322743002
2016-08-19Introduce pdfium::FakeUniquePtr for keys to sets of unique ptrs.tsepez
Review-Url: https://codereview.chromium.org/2262473002
2016-08-18Use a map for app::m_Timersdsinclair
Currently the timers is a vector. When we cancel a timer we have an O(n) operation to remove the timer. If there are a lot of timers (which this test has > 16k) this can take a long time. The impact is a lot lower in Release, but the test is very slow in Debug. From Linux on waterfall: [ RUN ] FPDFFormFillEmbeddertest.BUG_634716 [ OK ] FPDFFormFillEmbeddertest.BUG_634716 (7855 ms) From Linux try bot: [ RUN ] FPDFFormFillEmbeddertest.BUG_634716 [ OK ] FPDFFormFillEmbeddertest.BUG_634716 (431 ms) From Linux XFA Rel GYP on waterfall: [ RUN ] FPDFFormFillEmbeddertest.BUG_634716 [ OK ] FPDFFormFillEmbeddertest.BUG_634716 (185 ms) From Linux XFA Rel GYP try bot: [ RUN ] FPDFFormFillEmbeddertest.BUG_634716 [ OK ] FPDFFormFillEmbeddertest.BUG_634716 (72 ms) Review-Url: https://codereview.chromium.org/2251333002
2016-08-17Split fpdfsdk/fsdk_baseform.h into individual classes.jaepark
This CL moves classes in fsdk_baseform.h to their own files. Classes include CPDFSDK_Widget, CBA_AnnotIterator, CPDFSDK_XFAWidget, PDFSDK_FieldAction, and CPDFSDK_Interform. Review-Url: https://codereview.chromium.org/2252723002
2016-08-15Push v8::Isolate into CFXJS_Engine classchromium/2831tsepez
Nearly all the "loose" functions in FXJS become methods on the CFJXS_Engine. This is the "missing link" wrt some layering violatons that have been around forever. We can stop passing &m_ variables from CJS_ down into FXJS Initialization as a result. Review-Url: https://codereview.chromium.org/2245863002
2016-08-10Remove backpointer to CJS_Runtime from CJS_Valuetsepez
Review-Url: https://codereview.chromium.org/2227673005
2016-08-08Remove MsgBox()/Alert() from CJS_EmbedObj.tsepez
They're only related to the |app| object, not all embed's. Alert() itself unused. Review-Url: https://codereview.chromium.org/2224073002
2016-08-08Rename CJS_Timer to GlobalTimer and make private to app.cpptsepez
The CJS_Timer is fairly far removed from JS itself, the wrapper objects are CJS_TimerObj and TimerObj. Make it sound less like them. Having moved the code to app.cpp, the GlobalTimer can now refer directly to the app, rather than its superclass of CJS_EmbedObj. Hence we can pull some app-only timer related methods out of the superclass. Review-Url: https://codereview.chromium.org/2222043002
2016-08-08Remove backpointer to runtime from CJS_Array.tsepez
This is always available elsewhere, so save the bytes and ease removal of CJS_Array since it now only contains a single v8 local. Review-Url: https://codereview.chromium.org/2217253002
2016-08-05Remove another potential stale CJS_Timer usagetsepez
Fix memory ownership model for PDFium timers. The |app| class owns the CJS_Timer as part of its vector<unique_ptr> to them. The CJS_Timer "owns" its slot in the global ID to timer map, and removes itself when it is destroyed. Nothing else deletes from the global map. Deleting from the global map is accompanied by a callback to the embedder to clear its resources. Next, the proper way to remove a CJS_Timer is by going through the app, and having the app erase its unique ptr, which then deletes the CJS_Timer, which in turn cleans up the global map. Provide a CJS_Timer::Cancel static method to do this conveniently. There is a alternate path to the CJS_timer via JS and its CJS_TimerObj. CJS_TimerObj owns a TimerObj that currently points to the CJS_Timer. If the timer fires, and cleans itself up, this can go stale. Make the TimerObj maintain a weak reference via global timer ID rather than a direct pointer to the CJS_Timer, so that if the timer fires and is destroyed, future attempts to cancel find nothing. There is another path, where if the JS timer object is GC'd, then we just clean up its CJS_TimerObj without touching the actual CJS_Timers. We could make this match the spec by calling into the new cancel routine as described above, but it seems weird to have a timer depend on whether a gc happened or not. A subsequent CL will rename these objects to more closely match the conventions used by the other JS wrappers. BUG=634716 Review-Url: https://codereview.chromium.org/2221513002
2016-07-15Remove type info from CJS_Value, interrogate v8 insteadtsepez
Review-Url: https://codereview.chromium.org/2154503002
2016-03-31Move the fpdfsdk/include/javascript folderdsinclair
This CL splits the IJavaScript.h file into the two inner classes and puts them in the fpdfsdk/javascript folder. Review URL: https://codereview.chromium.org/1847583004
2016-03-28use std::vector in more places in JavaScript bindings code.tsepez
use unique_ptrs for app:m_Timers. BUG= Review URL: https://codereview.chromium.org/1834203002
2016-03-25Remove FX_DWORD from fpdfsdk/ and testingtsepez
BUG= Review URL: https://codereview.chromium.org/1835693002
2016-03-14Move fpdfsdk/src up to fpdfsdk/.Dan Sinclair
This CL moves the files in fpdfsdk/src/ up one level to fpdfsdk/ and fixes up the include paths, include guards and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1799773002 .