| 1 |
// Copyright 2014 Cubane Canada, Inc. All rights reserved. |
| 2 |
// See LICENSE for details. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
Promise throws TypeError when 'this' is resolved promise |
| 7 |
es6id: S25.4.3.1_A2.3_T1 |
| 8 |
author: Sam Mikes |
| 9 |
description: Promise.call(resolved Promise) throws TypeError |
| 10 |
flags: [async] |
| 11 |
---*/ |
| 12 |
|
| 13 |
var p = new Promise(function(resolve) { |
| 14 |
resolve(1); |
| 15 |
}); |
| 16 |
|
| 17 |
p.then(function() { |
| 18 |
Promise.call(p, function() {}); |
| 19 |
}).then(function() { |
| 20 |
$ERROR("Unexpected resolution - expected TypeError"); |
| 21 |
}, function(err) { |
| 22 |
if (!(err instanceof TypeError)) { |
| 23 |
$ERROR("Expected TypeError, got " + err); |
| 24 |
} |
| 25 |
}).then($DONE, $DONE); |