diff options
Diffstat (limited to 'deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js')
-rw-r--r-- | deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js index 072af732c4..3718312c45 100644 --- a/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js +++ b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js @@ -40,11 +40,14 @@ let {session, contextGroup, Protocol} = InspectorTest.start('Tests how async pro function runWithAsyncChainPromise(len, source) { InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); - let then = '.then(() => 1)'; - let pause = `.then(() => { ${source} })`; - Protocol.Runtime.evaluate({ - expression: `Promise.resolve()${then.repeat(len - 1)}${pause}` - }); + let asyncCall = `(function asyncCall(num) { + if (num === 0) { + ${source}; + return; + } + Promise.resolve().then(() => asyncCall(num - 1)); + })(${len})`; + Protocol.Runtime.evaluate({expression: asyncCall}); } async function setMaxAsyncTaskStacks(max) { |