mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 21:11:52 +00:00
A FormCalc script under a time limit is watched twice: the caller waits `timeout` for it, and the interpreter reads its own deadline, set to the same `timeout`, every 256 steps. Which one notices first is down to the scheduler, and the two reported different things: the caller's outcome is abandoned with no changes (the form's scripts go off), while the interpreter's kept every change the script made before the deadline. For a click script that loops on addInstance, that difference is 1000 rows (the most one run may add). Since repeating subforms lay out up to 1000 rows instead of 50 (#4608, landed with #6716), keeping them means laying out a 1000-row form again, twice, which takes most of a minute in the test build. The engine test hostile_formcalc_scripts_cannot_hang_or_bloat_the_document took 3.0 s when the caller noticed first and 46-61 s when the script did, so it failed its 60 s bound at random. Now a run stopped by its own clock reports what an abandoned run does: the same error, no changes, abandoned. XfaSession treats that outcome like a wait that ran out (the session is dead after it). Limits other than time (steps, loops, depth) keep their changes as before. Co-authored-by: FredApps <FredApps@users.noreply.github.com>