blob: 8b9e1c71878c5ea7f4e6d4964050253c16363ef0 [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 resolve;
var firstPromise = new Promise(function(newResolve) {
window.thisInInit = this;
resolve = newResolve;
});
var secondPromise = firstPromise.then(function(result) {
window.thisInFulfillCallback = this;
shouldBeFalse('thisInFulfillCallback === secondPromise');
shouldBeTrue('thisInFulfillCallback === window');
window.result = result;
shouldBeEqualToString('result', 'hello');
finishJSTest();
});
shouldBeFalse('thisInInit === firstPromise');
shouldBeTrue('thisInInit === window');
resolve('hello');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>