Fix JS errors when closing the "Add File" dialog.
Review Request #11254 — Created Oct. 29, 2020 and submitted
DialogView subclasses (such as "Add File") could sometimes cause JS
errors when they were closing. The issue here was a race between
multiple event handlers. Inside the
modalBoximplementation (which is
all our own jQuery-UI based code), a generic handler for clicks in the
button area would cause the modal box to self-destruct. This could then
conflict with the higher-level DialogView code which would additionally
try to call destroy. In previous versions of jQuery-UI this didn't
matter, but the version we're using now will error out when calling
methods on elements which are not widgets.
This change adds a check to make sure we don't try to destroy the
modalBox widget after it's already self-destructed.
- Manually tested the "Add File" dialog.
- Ran js-tests without any modalBox-related errors.