Checks if invokeCallback is defined before triggering it. Issue #525

Reviewed By: Sergey Golod <sgolod@rim.com>
Tested By: Tracy Li <tli@rim.com>