THPDFQuickJS.Eval

Unit: HPDFQuickJS

Declaration

function Eval(const Script: string): THPDFQuickJSResult; overload;
function Eval(const Script: string; TimeoutMs: Cardinal;
  MaxInterruptChecks: NativeUInt): THPDFQuickJSResult; overload;

Behaviour

Runs JavaScript in the engine context and returns success, value, error text and status

The original overload uses the constructor limits; the additional overload supplies per-evaluation timeout and interrupt bounds whilst retaining memory, stack and script-size limits

A zero timeout or interrupt limit disables that corresponding evaluation bound; callers enforcing a transaction deadline pass the remaining time rather than restarting a full timeout

The XFA session uses this overload so that one elapsed budget is shared across replay and current execution

Delphi results and diagnostics use Unicode strings; Free Pascal preserves the bridge UTF-8 bytes and tags the managed string as UTF-8, so conversion through the system ANSI code page is avoided

JavaScript arithmetic follows IEEE behaviour for NaN, Infinity, overflow and underflow even when the calling application enables native floating-point traps

The engine temporarily masks floating-point exceptions during initialisation and evaluation, clears flags produced by the engine, and restores the calling thread's original exception mask before returning or propagating an exception; application callbacks invoked after XFA request suspension run with the restored native mask

Related APIs

TXFAJavaScriptSession, HPDFXFAExecuteJavaScriptEvent and Interactive Dynamic XFA Widget Runtime