Index: LayoutTests/fast/js/Promise-exception.html |
diff --git a/LayoutTests/fast/js/Promise-exception.html b/LayoutTests/fast/js/Promise-exception.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9f1707a8805244605e68595d3edbc7cedd2350f8 |
--- /dev/null |
+++ b/LayoutTests/fast/js/Promise-exception.html |
@@ -0,0 +1,36 @@ |
+<!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 firstPromise = new Promise(function(resolver) { |
+ window.thisInInit = this; |
+ resolver.fulfill('hello'); |
+}); |
+ |
+var secondPromise = firstPromise.then(function(result) { |
+ throw 'foobar'; |
+}); |
+ |
+var thirdPromise = secondPromise.then(function(result) { |
+ fail('Unexpected invocation of fulfillCallback'); |
+}, function(result) { |
+ window.thisInThenCallback = this; |
+ shouldBeTrue('thisInThenCallback === thirdPromise'); |
+ window.result = result; |
+ shouldBeEqualToString('result', 'foobar'); |
+ finishJSTest(); |
+}); |
+ |
+</script> |
+<script src="resources/js-test-post.js"></script> |
+</body> |
+</html> |