TXFAJavaScriptSession
Unit: HPDFXFAEventScript
Declaration
TXFAJavaScriptSession= class
Behaviour
Owns an independent QuickJS engine plus a bounded journal of committed virtual evaluations
Preserves script-object lexical variables, functions, object values and nested closures across events; rollback rebuilds the engine by replaying committed evaluations
Records Date and Math.random inputs for reproducible replay; replay carries out only virtual form operations and does not publish document mutations
Event support code is compiled once per owned engine; each evaluation supplies a fresh form and data context, script body, limits and recorded response vectors
Rollback reinstalls that support code and replays the committed dynamic evaluations, preserving independent lexical and closure state without reparsing the support library for each journal entry
The shared support source is charged once against the journal byte limit, together with committed dynamic evaluations and returned results; rebuilding and replay stay inside the existing elapsed-time and engine limits
Default journal bounds are 64 MiB for scripts plus returned results and 8192 evaluations, identity bindings included; engine memory, stack, operation, interrupt and elapsed-time limits also apply
TXFAWidgetRuntime owns one session automatically when using the shipped general engine; session state is not serialised into XDP and a new runtime starts fresh
The class is single-threaded and must not be shared amongst concurrent callers
Related APIs
TXFAJavaScriptSession, HPDFXFAExecuteJavaScriptEvent and Interactive Dynamic XFA Widget Runtime