aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/async-stack-traces.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/async-stack-traces.js')
-rw-r--r--deps/v8/test/mjsunit/async-stack-traces.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/async-stack-traces.js b/deps/v8/test/mjsunit/async-stack-traces.js
index 05cf8a095f..c945f4e37b 100644
--- a/deps/v8/test/mjsunit/async-stack-traces.js
+++ b/deps/v8/test/mjsunit/async-stack-traces.js
@@ -268,3 +268,34 @@
await test(one);
})());
})();
+
+// Basic test to check that we also follow initial
+// promise chains created via Promise#then().
+(function() {
+ async function one(p) {
+ return await p.then(two);
+ }
+
+ function two() {
+ throw new Error();
+ }
+
+ async function test(f) {
+ try {
+ await f(Promise.resolve());
+ assertUnreachable();
+ } catch (e) {
+ assertInstanceof(e, Error);
+ assertMatches(/Error.+at two.+at async one.+at async test/ms, e.stack);
+ }
+ }
+
+ assertPromiseResult((async () => {
+ await test(one);
+ await test(one);
+ %OptimizeFunctionOnNextCall(two);
+ await test(one);
+ %OptimizeFunctionOnNextCall(one);
+ await test(one);
+ })());
+})();