Closed kpreisser closed 4 years ago
//cc @jcdickinson
I started looking into this, but I found a bunch more issues. I'll keep working on it.
@paulbartrum let me know if you want me to pick this up.
I've checked in a fix for this issue, let me know if you notice anything wrong with it.
Run the following code in Jurassic:
Actual output:
Expected output: (can be seen when running in browsers)
According to MDN,
Promise.then
returns a newPromise
instance whose state will depend on the handler function.In this case, the
onRejected
handler added to the firstPromise
returns value1
, so thePromise
returned bythen
should be a new instance that will be resolved with the value1
.However, it seems
then
as implemented in Jurassic (by #156) incorrectly returns the currentPromise
instance instead of creating a new one: https://github.com/paulbartrum/jurassic/blob/0438d0f98e52731e4a1e62f20d66144d59824925/Jurassic/Library/Promise/PromiseInstance.cs#L333-L355