An argument for returning an error might also be that this hopefully speeds up any script processing we have on the stack while this happens (throwing an exception) rather than trying to do something meaningful with the never set result of a modal dialog. FWIW: Also in the C++ case seen in the wild we come from JS on the stack.
Bug 1699041 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
An argument for always returning an error might also be that this hopefully speeds up any script processing we have on the stack while this happens (throwing an exception) rather than trying to do something meaningful with the never set result of a modal dialog. FWIW: Also in the C++ case seen in the wild we come from JS on the stack.