`window.alert` in a UXP plugin crashes InDesign

When using window.alert('...') in an InDesign UXP plugin, it sporadically works, at other times, crashes InDesign.

The “crashing” behavior resulted in varying results:

  • InDesign crashed (showing a popup asking if I want to submit a crash report, which I did)
  • InDesign crashed without even the “send crash report” popup showing up
  • InDesign froze entirely and couldn’t be closed without killing the process manually
  • InDesign didn’t freeze, but the plugin stopped doing anything (the UI wasn’t frozen, though), as if stuck in a loop. InDesign wouldn’t close without manually killing the process

Tested on

Edition Windows 11 Pro
Version 22H2
Installed on ‎9/‎23/‎2022
OS build 22621.1992
Experience Windows Feature Experience Pack 1000.22644.1000.0
Processor AMD Ryzen 7 5800X 8-Core Processor 3.80 GHz
Installed RAM 32.0 GB
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display

Code to reproduce

(cf. the README.md for installation instructions)

Workaround (for now) using a <dialog> instead:

The engineering manager says that alert isn’t supported yet :flushed:


Fair enough (thank you for looking into this!), but in that case, I would suggest that it shouldn’t crash InDesign but immediately abort with an error message in the console instead. I remember that it was mentioned during office hours at some point that this is an essential piece of functionality, especially for existing InDesign devs (who might try to use it and, with the intermittent behavior, maybe not notice that it doesn’t work consistently)…