summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/Promise-resolve-with-itself.html
blob: c7a3190f4c8ab81198c0fa1df0a9f30470bd7da5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise.');

window.jsTestIsAsync = true;

var resolve;
var promise = new Promise(function(r) { resolve = r; });

promise.then(function () {
  testFailed('fulfilled');
}, function (error) {
  testPassed('rejected');
  window.result = error.toString();
  shouldBeEqualToString('result', 'TypeError: Resolve a promise with itself');
}).then(finishJSTest, finishJSTest);

resolve(promise);

</script>
</body>
</html>