It seems to be impossible to properly clear the action. Neither doc.setAction(cTrigger, null) nor doc.setAction(cTrigger, '') seem to properly clear it, although Document Properties > Actions shows the trigger cleared, there will still be a javascript warning when that action happens.
To reproduce:
Make a new document.
Run the following two lines in console:
Code: Select all
this.setAction('WillClose',"app.alert('annoy')");
this.setAction('WillClose','');
Confusingly, the action will show as "<Empty>" under document properties > Actions.
Make sure that Preferences > Javascript is set to alert for document javascript. Then close the document.