Commit 910eba7f authored by James Burke's avatar James Burke

Fixes #3507: canceled deferreds get an error object with dojoType property of cancel.

git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@9411 560b804f-0ae3-0310-86f3-f6aa0a117693
parent e1ac091f
......@@ -282,7 +282,9 @@ dojo.extend(dojo.Deferred, {
this.silentlyCancelled = true;
}
if(this.fired == -1){
this.errback(new Error("Deferred Cancelled"));
var err = new Error("Deferred Cancelled");
err.dojoType = "cancel";
this.errback(err);
}
}else if( (this.fired == 0) &&
(this.results[0] instanceof dojo.Deferred)
......
......@@ -257,7 +257,24 @@
}
});
return d;
}
},
function xhrCancel(t){
var d = new doh.Deferred();
var td = dojo.xhrPost({
url: "xhr.html", // self
handle: function(res, ioArgs){
if(res instanceof Error && res.dojoType == "cancel"){
d.callback(true);
}else{
d.errback(false);
}
}
});
td.cancel();
// t.t(td instanceof dojo.Deferred);
return d;
},
// FIXME: need to add tests for rawPost
// FIXME: need to add tests for wrapForm
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment