| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function timeoutPromise(value, ms) | 7 function timeoutPromise(value, ms) |
| 8 { | 8 { |
| 9 return new Promise(function promiseCallback(resolve, reject) { | 9 return new Promise(function promiseCallback(resolve, reject) { |
| 10 function resolvePromise() | 10 function resolvePromise() |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return new Promise(resolveCallback); | 38 return new Promise(resolveCallback); |
| 39 } | 39 } |
| 40 | 40 |
| 41 function testFunction() | 41 function testFunction() |
| 42 { | 42 { |
| 43 setTimeout(testFunctionTimeout, 0); | 43 setTimeout(testFunctionTimeout, 0); |
| 44 } | 44 } |
| 45 | 45 |
| 46 function testFunctionTimeout() | 46 function testFunctionTimeout() |
| 47 { | 47 { |
| 48 var functions = [doTestPromiseConstructor, doTestSettledPromisesResolved, do
TestSettledPromisesRejected, doTestChainedPromises, doTestChainedPromisesJSON]; | 48 var functions = [doTestPromiseConstructor, doTestSettledPromisesResolved, do
TestSettledPromisesRejected]; |
| 49 for (var i = 0; i < functions.length; ++i) | 49 for (var i = 0; i < functions.length; ++i) |
| 50 functions[i](); | 50 functions[i](); |
| 51 } | 51 } |
| 52 | 52 |
| 53 function thenCallback(value) | 53 function thenCallback(value) |
| 54 { | 54 { |
| 55 debugger; | 55 debugger; |
| 56 } | 56 } |
| 57 | 57 |
| 58 function errorCallback(error) | 58 function errorCallback(error) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 async function doTestSettledPromisesRejected() | 86 async function doTestSettledPromisesRejected() |
| 87 { | 87 { |
| 88 try { | 88 try { |
| 89 let value = await settledPromise(new Error("rejected")); | 89 let value = await settledPromise(new Error("rejected")); |
| 90 thenCallback(value); | 90 thenCallback(value); |
| 91 } catch (e) { | 91 } catch (e) { |
| 92 errorCallback(e); | 92 errorCallback(e); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 async function doTestChainedPromises() | |
| 97 { | |
| 98 try { | |
| 99 await timeoutPromise(1); | |
| 100 debugger; | |
| 101 await timeoutPromise(2); | |
| 102 debugger; | |
| 103 await 3; | |
| 104 debugger; | |
| 105 await settledPromise(4); | |
| 106 debugger; | |
| 107 thenCallback(await timeoutPromise(5)); | |
| 108 } catch (e) { | |
| 109 errorCallback(e); | |
| 110 } | |
| 111 } | |
| 112 | |
| 113 async function doTestChainedPromisesJSON() | |
| 114 { | |
| 115 try { | |
| 116 let one = await timeoutPromise(1); | |
| 117 let stringify = await JSON.stringify(one); | |
| 118 let parse = await JSON.parse(stringify); | |
| 119 thenCallback(parse); | |
| 120 } catch (e) { | |
| 121 errorCallback(e); | |
| 122 } | |
| 123 } | |
| 124 | |
| 125 var test = function() | 96 var test = function() |
| 126 { | 97 { |
| 127 var totalDebuggerStatements = 10; | 98 var totalDebuggerStatements = 4; |
| 128 var maxAsyncCallStackDepth = 5; | 99 var maxAsyncCallStackDepth = 5; |
| 129 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); | 100 InspectorTest.runAsyncCallStacksTest(totalDebuggerStatements, maxAsyncCallSt
ackDepth); |
| 130 } | 101 } |
| 131 | 102 |
| 132 </script> | 103 </script> |
| 133 </head> | 104 </head> |
| 134 | 105 |
| 135 <body onload="runTest()"> | 106 <body onload="runTest()"> |
| 136 <p> | 107 <p> |
| 137 Tests asynchronous call stacks for async functions. | 108 Tests asynchronous call stacks for async functions. |
| 138 </p> | 109 </p> |
| 139 | 110 |
| 140 </body> | 111 </body> |
| 141 </html> | 112 </html> |
| OLD | NEW |