blob: f6b5dc673036ba41ab8673a5d85c8721a2710c34 [file] [log] [blame]
<!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 reject;
var promise = new Promise(function (_, r) { reject = r; });
for (var i = 0; i < 5000; ++i)
promise = promise.then(function (value) { testFailed('fulfilled'); throw value; }, function (value) { throw value; });
promise.catch(function (value) {
window.result = value;
shouldBe('result', '42');
}).then(finishJSTest, finishJSTest);
shouldBe('result', 'undefined');
reject(42);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>