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..bfde20ac00990ea3583d3b69f8896489abf92539 |
--- /dev/null |
+++ b/LayoutTests/fast/js/Promise-exception.html |
@@ -0,0 +1,40 @@ |
+<!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(value) { |
+ throw "foobar"; |
+ }); |
+ |
+var thirdPromise = secondPromise.then( |
+ function(value) { |
+ fail("Unexpected invocation of fulfillCallback"); |
+ }, |
+ function(value) { |
+ window.thisInThenCallback = this; |
+ shouldBeTrue("thisInThenCallback === thirdPromise"); |
+ window.value = value; |
+ shouldBeEqualToString("value", "foobar"); |
+ finishJSTest(); |
+ }); |
+ |
+</script> |
+<script src="resources/js-test-post.js"></script> |
+</body> |
+</html> |