TXFAJavaScriptSession

Unit: HPDFXFAEventScript

Declaration

TXFAJavaScriptSession= class

Behavior

Owns an independent QuickJS engine and a bounded journal of committed virtual evaluations

Preserves script-object lexical variables, functions, object values and nested closures across events; rollback reconstructs the engine by replaying committed evaluations

Records Date and Math.random inputs for reproducible replay; replay executes only virtual form operations and does not publish document mutations

Event support code is compiled once for each 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 every 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 remain inside the existing elapsed-time and engine limits

Default journal bounds are 64 MiB for scripts plus returned results and 8192 evaluations, including identity bindings; 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 serialized into XDP and a new runtime starts fresh

The class is single-threaded and must not be shared by concurrent callers

Related APIs

TXFAJavaScriptSession, HPDFXFAExecuteJavaScriptEvent and Interactive Dynamic XFA Widget Runtime