Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1541)

Unified Diff: test/inspector/debugger/async-promise-late-then.js

Issue 2578923002: [inspector] async stacks for Promise.then calls... (Closed)
Patch Set: avoid calling functions Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/inspector/debugger/async-promise-late-then.js
diff --git a/test/inspector/debugger/async-promise-late-then.js b/test/inspector/debugger/async-promise-late-then.js
new file mode 100644
index 0000000000000000000000000000000000000000..c0b588a9ccd2e39273143372edbb32c3c333e33a
--- /dev/null
+++ b/test/inspector/debugger/async-promise-late-then.js
@@ -0,0 +1,48 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Flags: --expose-gc
+
+print('Checks async stack for late .then handlers with gc');
+
+InspectorTest.addScript(`
+function foo1() {
+ gc();
+ debugger;
+}
+
+function test() {
+ var resolve1;
+ var p1 = new Promise(resolve => resolve1 = resolve);
+ gc();
+ var p2 = p1.then(foo1);
+ gc();
+ resolve1();
+ gc();
+ var p3 = p1.then(foo1);
+ gc();
+ var p4 = p1.then(foo1);
+ gc();
+ return Promise.all([p2,p3,p4]);
+}
+//# sourceURL=test.js`, 8, 26);
+
+InspectorTest.setupScriptMap();
+Protocol.Debugger.onPaused(message => {
+ InspectorTest.logCallFrames(message.params.callFrames);
+ var asyncStackTrace = message.params.asyncStackTrace;
+ while (asyncStackTrace) {
+ InspectorTest.log(`-- ${asyncStackTrace.description} --`);
+ InspectorTest.logCallFrames(asyncStackTrace.callFrames);
+ asyncStackTrace = asyncStackTrace.parent;
+ }
+ InspectorTest.log('');
+ Protocol.Debugger.resume();
+});
+
+Protocol.Debugger.enable();
+Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 });
+Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js',
+ awaitPromise: true })
+ .then(() => Protocol.Runtime.evaluate({ expression: 'gc()'}))
+ .then(InspectorTest.completeTest);

Powered by Google App Engine
This is Rietveld 408576698