| Index: LayoutTests/fast/js/Promise-catch.html
|
| diff --git a/LayoutTests/fast/js/Promise-catch.html b/LayoutTests/fast/js/Promise-catch.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c6129cc547f1de5d92f17820c5e00b56879a2633
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/js/Promise-catch.html
|
| @@ -0,0 +1,48 @@
|
| +<!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 resolver;
|
| +
|
| +var firstPromise = new Promise(function(newResolver) {
|
| + window.thisInInit = this;
|
| + resolver = newResolver;
|
| +});
|
| +
|
| +var secondPromise = firstPromise.catch(function(result) {
|
| + window.thisInFulfillCallback = this;
|
| + shouldBeFalse('thisInFulfillCallback === firstPromise');
|
| + shouldBeTrue('thisInFulfillCallback === secondPromise');
|
| + window.result = result;
|
| + shouldBeEqualToString('result', 'hello');
|
| + return 'bye';
|
| +});
|
| +
|
| +secondPromise.then(function(result) {
|
| + window.result = result;
|
| + shouldBeEqualToString('result', 'bye');
|
| + testPassed('fulfilled');
|
| + finishJSTest();
|
| +}, function() {
|
| + testFailed('rejected');
|
| + finishJSTest();
|
| +}, function() {
|
| +});
|
| +
|
| +shouldBeTrue('thisInInit === firstPromise');
|
| +shouldBeTrue('firstPromise instanceof Promise');
|
| +shouldBeTrue('secondPromise instanceof Promise');
|
| +
|
| +resolver.reject('hello');
|
| +</script>
|
| +<script src="resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|