Re: [fetch] Aborting a fetch (#27)

@WebReflection Thanks for doing this.

```js
var p1 = new Promise(function (resolve, reject, ifCanceled) {
  var internal = setTimeout(resolve.bind(null, 123), 1000);
  ifCanceled(function () {
    console.log('been cancelled');
  });
});

var p2 = p1.then(function (val) {
  console.log('done1 ' + val);
}, function (err) {
  console.log('error1');
});

var p3 = p2.cancel().then(function () {
  console.log('post-cancel resolve');
}, function() {
  console.log('post-cancel reject');
});

var p4 = p1.then(function(val) {
  console.log('done2 ' + val);
}, function() {
  console.log('error2');
});
```

Logs: ([live example](https://jsbin.com/hebipi/edit?js,console))

```
"been cancelled"
"post-cancel resolve"
"done2 undefined"
```

It feels weird to me that `p2.cancel()` would result in the original `p1` promise cancelling, affecting other children that didn't cancel and were unable to observe that cancellation. I can't really work out why neither `'done1 ' + val` or `'error1'` is logged, but `'done2 ' + val` is logged, and has resolved with `undefined`.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-87632086

Received on Monday, 30 March 2015 10:45:24 UTC