summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/Promise-onFulfilled-deep.html
blob: de8b26e5e1282d001730561b73d114f4400d6fca (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
30
31
<!DOCTYPE html>
<html>
<head>
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise.');

window.jsTestIsAsync = true;

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

for (var i = 0; i < 5000; ++i)
  promise = promise.then(function (value) { return value; }, function () { testFailed('rejected'); });

promise.then(function (value) {
    window.result = value;
    shouldBe('result', '42');
}).then(finishJSTest, finishJSTest);

shouldBe('result', 'undefined');
resolve(42);

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