Pass errorCode to cancel function (bug 1050544)

r? @kumar303 
you could change all references of this to ``this.errorCode``