| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --harmony-async-iteration | 5 // Flags: --harmony-async-iteration |
| 6 | 6 |
| 7 InspectorTest.log('Checks that async chains for for-await-of are correct.'); | 7 InspectorTest.log('Checks that async chains for for-await-of are correct.'); |
| 8 | 8 |
| 9 InspectorTest.addScript(` | 9 InspectorTest.addScript(` |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 next(v) { return it.next(v); }, | 43 next(v) { return it.next(v); }, |
| 44 return(v) { return Reject(new Error("boop")); } | 44 return(v) { return Reject(new Error("boop")); } |
| 45 }; | 45 }; |
| 46 } | 46 } |
| 47 | 47 |
| 48 async function Basic() { | 48 async function Basic() { |
| 49 for await (let x of ["a"]) { | 49 for await (let x of ["a"]) { |
| 50 Debugger(); | 50 Debugger(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 // TODO(kozyatinskiy): this stack trace is suspicious. |
| 54 async function UncaughtReject() { | 54 async function UncaughtReject() { |
| 55 async function loop() { | 55 async function loop() { |
| 56 for await (let x of [Reject(new Error("boop"))]) { | 56 for await (let x of [Reject(new Error("boop"))]) { |
| 57 Debugger(); | 57 Debugger(); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 return loop().catch(Debugger); | 60 return loop().catch(Debugger); |
| 61 } | 61 } |
| 62 | 62 // TODO(kozyatinskiy): this stack trace is suspicious. |
| 63 async function UncaughtThrow() { | 63 async function UncaughtThrow() { |
| 64 async function loop() { | 64 async function loop() { |
| 65 for await (let x of [Throw(new Error("boop"))]) { | 65 for await (let x of [Throw(new Error("boop"))]) { |
| 66 Debugger(); | 66 Debugger(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 return loop().catch(Debugger); | 69 return loop().catch(Debugger); |
| 70 } | 70 } |
| 71 | 71 |
| 72 async function CaughtReject() { | 72 async function CaughtReject() { |
| 73 try { | 73 try { |
| 74 for await (let x of [Reject(new Error("boop"))]) { | 74 for await (let x of [Reject(new Error("boop"))]) { |
| 75 Debugger(x); | 75 Debugger(x); |
| 76 } | 76 } |
| 77 } catch (e) { | 77 } catch (e) { |
| 78 Debugger(e); | 78 Debugger(e); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 async function CaughtThrow() { | 82 async function CaughtThrow() { |
| 83 try { | 83 try { |
| 84 for await (let x of [Throw(new Error("boop"))]) { | 84 for await (let x of [Throw(new Error("boop"))]) { |
| 85 Debugger(x); | 85 Debugger(x); |
| 86 } | 86 } |
| 87 } catch (e) { | 87 } catch (e) { |
| 88 Debugger(e); | 88 Debugger(e); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 // TODO(kozyatinskiy): this stack trace is suspicious. |
| 92 async function UncaughtRejectOnBreak() { | 92 async function UncaughtRejectOnBreak() { |
| 93 async function loop() { | 93 async function loop() { |
| 94 for await (let x of RejectOnReturn(["0", "1"])) { | 94 for await (let x of RejectOnReturn(["0", "1"])) { |
| 95 break; | 95 break; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 return loop().catch(Debugger); | 98 return loop().catch(Debugger); |
| 99 } | 99 } |
| 100 | 100 // TODO(kozyatinskiy): this stack trace is suspicious. |
| 101 async function UncaughtThrowOnBreak() { | 101 async function UncaughtThrowOnBreak() { |
| 102 async function loop() { | 102 async function loop() { |
| 103 for await (let x of ThrowOnReturn(["0", "1"])) { | 103 for await (let x of ThrowOnReturn(["0", "1"])) { |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 return loop().catch(Debugger); | 107 return loop().catch(Debugger); |
| 108 } | 108 } |
| 109 | 109 // TODO(kozyatinskiy): this stack trace is suspicious. |
| 110 async function CaughtRejectOnBreak() { | 110 async function CaughtRejectOnBreak() { |
| 111 try { | 111 try { |
| 112 for await (let x of RejectOnReturn(["0", "1"])) { | 112 for await (let x of RejectOnReturn(["0", "1"])) { |
| 113 break; | 113 break; |
| 114 } | 114 } |
| 115 } catch (e) { | 115 } catch (e) { |
| 116 Debugger(e); | 116 Debugger(e); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 async function CaughtThrowOnBreak() { | 120 async function CaughtThrowOnBreak() { |
| 121 try { | 121 try { |
| 122 for await (let x of ThrowOnReturn(["0", "1"])) { | 122 for await (let x of ThrowOnReturn(["0", "1"])) { |
| 123 break; | 123 break; |
| 124 } | 124 } |
| 125 } catch (e) { | 125 } catch (e) { |
| 126 Debugger(e); | 126 Debugger(e); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 //# sourceURL=test.js`, 7, 129); | 129 //# sourceURL=test.js`, 9, 26); |
| 130 | 130 |
| 131 InspectorTest.setupScriptMap(); | 131 InspectorTest.setupScriptMap(); |
| 132 Protocol.Debugger.onPaused(message => { | 132 Protocol.Debugger.onPaused(message => { |
| 133 InspectorTest.logCallFrames(message.params.callFrames); | 133 InspectorTest.logCallFrames(message.params.callFrames); |
| 134 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); | 134 InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); |
| 135 InspectorTest.log(''); | 135 InspectorTest.log(''); |
| 136 Protocol.Debugger.resume(); | 136 Protocol.Debugger.resume(); |
| 137 }); | 137 }); |
| 138 | 138 |
| 139 Protocol.Debugger.enable(); | 139 Protocol.Debugger.enable(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 Protocol.Runtime.evaluate({ expression: \`${name}() | 155 Protocol.Runtime.evaluate({ expression: \`${name}() |
| 156 //# sourceURL=test${capitalize(name)}.js\`, awaitPromise: true}) | 156 //# sourceURL=test${capitalize(name)}.js\`, awaitPromise: true}) |
| 157 .then(next); | 157 .then(next); |
| 158 }) | 158 }) |
| 159 `); | 159 `); |
| 160 })); | 160 })); |
| 161 | 161 |
| 162 function capitalize(string) { | 162 function capitalize(string) { |
| 163 return string.charAt(0).toUpperCase() + string.slice(1); | 163 return string.charAt(0).toUpperCase() + string.slice(1); |
| 164 } | 164 } |
| OLD | NEW |