| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Section 25.4.1.4.2 |
| 7 |
es6id: S25.4.4.5_A3.1_T1 |
| 8 |
author: Sam Mikes |
| 9 |
description: self-resolved Promise throws TypeError |
| 10 |
flags: [async] |
| 11 |
---*/ |
| 12 |
|
| 13 |
var resolveP, |
| 14 |
p = new Promise(function(resolve) { |
| 15 |
resolveP = resolve; |
| 16 |
}); |
| 17 |
|
| 18 |
resolveP(p); |
| 19 |
|
| 20 |
p.then(function() { |
| 21 |
$ERROR("Should not fulfill: should reject with TypeError."); |
| 22 |
}, function(err) { |
| 23 |
if (!(err instanceof TypeError)) { |
| 24 |
$ERROR("Expected TypeError, got " + err); |
| 25 |
} |
| 26 |
}).then($DONE, $DONE); |