Commit 277eb5ea authored by Stefan Penner's avatar Stefan Penner

3.3.1: If `promise` and `x` refer to the same object, reject `promise`

with a `TypeError' as the reason.
parent 5119ff77
...@@ -138,6 +138,10 @@ function handleThenable(promise, value) { ...@@ -138,6 +138,10 @@ function handleThenable(promise, value) {
resolved; resolved;
try { try {
if (promise === value) {
throw new TypeError("A promises callback cannot return that same promise.");
}
if (objectOrFunction(value)) { if (objectOrFunction(value)) {
then = value.then; then = value.then;
......
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