```
  constructor(x) {
    super(x);
    Object.defineProperties(this, { then: { value: this.then }});
    Object.freeze(this);
    if (this.constructor==DefensivePromise && this.then ===
DefensivePromise.prototype.then) {
      goodPromises.add(this);
    }
  }
```
Getting closer, I hope!


> I also like the point implicit in your attack that I also need the
> invariant that
>
> DefensivePromise.resolve(anything).then(anycallback)
>
> should all callback at most once.
>

I believe this is already taken care of by the ES6 spec once you make it
into `NewPromiseCapability`.  At least I wrote tests for `es6-shim` once
upon a time purporting to show this.
  --scott
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to