Making sure on_progress is a function before setting on xhr or FileTransfer objects