I am writing a command line script that opens a web page that may
contain javascript. Page may display a Javascript prompt (like alert
()) and I would like to be notified about this in my Firefox Extension
so that I can close it.. Is there a way to listen to any modal dialog
open events (even for chrome dialogs like slow running script etc.) ?

It would be better if I could just disable all dialogs with a
preference or something.