(The following applies to St 55. May be true of St 52 too, but I haven't tested.)
I don't know if this was ever answered in this thread, but it seems to work with pref dom.max_script_run_time (default 20). Basically if a script runs for over 20 (or whatever other value you set) seconds, a yellow banner pops up at the top of the window, giving you the option to cancel the script. There's also an option to dismiss the banner, but it'll come back in another 20 seconds if the script still isn't finished. The banner will go away on its own anyway, if the script finishes.
If dom.ipc.processHangMonitor is set to false, a dialog box pops up instead of the yellow banner, with the same options. There's also a "don't show this again" checkbox on the dialog box, but it doesn't seem to do anything; the dialog will come back even if you check the box. Doesn't seem to make sense, but that's been my experience.
I find both true and false settings annoying, so instead I set dom.max_script_run_time to 0. This seems to be the only way to fully disable it and let long-running scripts finish without interruption. You could instead set it to a larger value, such as 120, instead of 0, depending on your patience for letting long-running scripts finish.
Edit: Tried this with Serpent 52, and I had to set both dom.ipc.processHangMonitor to false and dom.max_script_run_time to 0 to let long-running scripts finish. Apparently the latter time limit only applies to the dialog box that comes up if the former is set to false, at least on Serpent 52.