OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 // Flags: --allow-natives-syntax |
4 | 5 |
5 print('Checks that breaks in framework code correctly processed.'); | 6 print('Checks that breaks in framework code correctly processed.'); |
6 | 7 |
7 InspectorTest.addScript( | 8 InspectorTest.addScript(` |
8 ` | |
9 function frameworkAssert() { | 9 function frameworkAssert() { |
10 console.assert(false); | 10 console.assert(false); |
11 } | 11 } |
12 | 12 |
13 function throwCaughtError() { | 13 function throwCaughtError() { |
14 try { | 14 try { |
15 throw new Error(); | 15 throw new Error(); |
16 } catch (e) { | 16 } catch (e) { |
17 } | 17 } |
18 } | 18 } |
(...skipping 25 matching lines...) Expand all Loading... |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 function throwFromJSONParse() { | 47 function throwFromJSONParse() { |
48 try { | 48 try { |
49 JSON.parse('ping'); | 49 JSON.parse('ping'); |
50 } catch (e) { | 50 } catch (e) { |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 //# sourceURL=framework.js`, | 54 function throwInlinedUncaughtError() { |
55 7, 26); | 55 function inlinedWrapper() { |
| 56 throwUserException(); |
| 57 } |
| 58 %OptimizeFunctionOnNextCall(inlinedWrapper); |
| 59 inlinedWrapper(); |
| 60 } |
| 61 |
| 62 //# sourceURL=framework.js`, 8, 26); |
| 63 |
| 64 InspectorTest.addScript(` |
| 65 function throwUserException() { |
| 66 throw new Error(); |
| 67 } |
| 68 //# sourceURL=user.js`, 64, 26) |
56 | 69 |
57 InspectorTest.setupScriptMap(); | 70 InspectorTest.setupScriptMap(); |
58 Protocol.Debugger.onPaused(message => { | 71 Protocol.Debugger.onPaused(message => { |
59 InspectorTest.logCallFrames(message.params.callFrames); | 72 InspectorTest.logCallFrames(message.params.callFrames); |
60 InspectorTest.log(''); | 73 InspectorTest.log(''); |
61 Protocol.Debugger.resume(); | 74 Protocol.Debugger.resume(); |
62 }); | 75 }); |
63 | 76 |
64 Protocol.Debugger.enable(); | 77 Protocol.Debugger.enable(); |
65 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); | 78 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); |
(...skipping 25 matching lines...) Expand all Loading... |
91 {expression: 'throwCaughtError()//# sourceURL=user.js'})) | 104 {expression: 'throwCaughtError()//# sourceURL=user.js'})) |
92 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) | 105 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) |
93 .then(next); | 106 .then(next); |
94 }, | 107 }, |
95 | 108 |
96 function testUncaughtException(next) { | 109 function testUncaughtException(next) { |
97 Protocol.Debugger.setPauseOnExceptions({state: 'all'}) | 110 Protocol.Debugger.setPauseOnExceptions({state: 'all'}) |
98 .then(() => InspectorTest.log('> all frames in framework:')) | 111 .then(() => InspectorTest.log('> all frames in framework:')) |
99 .then( | 112 .then( |
100 () => Protocol.Runtime.evaluate( | 113 () => Protocol.Runtime.evaluate( |
101 {expression: 'throwUncaughtError()//# sourceURL=framework.js'})) | 114 {expression: 'setTimeout(\'throwUncaughtError()//# sourceURL=fra
mework.js\', 0)//# sourceURL=framework.js'})) |
| 115 .then(() => Protocol.Runtime.evaluate({ expression: "new Promise(resolve
=> setTimeout(resolve, 0))", awaitPromise: true})) |
102 .then(() => InspectorTest.log('> mixed, top frame in framework:')) | 116 .then(() => InspectorTest.log('> mixed, top frame in framework:')) |
103 .then( | 117 .then( |
104 () => Protocol.Runtime.evaluate( | 118 () => Protocol.Runtime.evaluate( |
105 {expression: 'throwUncaughtError()//# sourceURL=user.js'})) | 119 {expression: 'setTimeout(\'throwUncaughtError()//# sourceURL=use
r.js\', 0)'})) |
| 120 .then(() => Protocol.Runtime.evaluate({ expression: "new Promise(resolve
=> setTimeout(resolve, 0))", awaitPromise: true})) |
106 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) | 121 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) |
107 .then(next); | 122 .then(next); |
108 }, | 123 }, |
109 | 124 |
| 125 function testUncaughtExceptionWithInlinedFrame(next) { |
| 126 Protocol.Debugger.setPauseOnExceptions({state: 'all'}) |
| 127 .then(() => InspectorTest.log('> mixed top frame in framework:')) |
| 128 .then( |
| 129 () => Protocol.Runtime.evaluate( |
| 130 {expression: 'setTimeout(\'throwInlinedUncaughtError()//# source
URL=framework.js\', 0)//# sourceURL=framework.js'})) |
| 131 .then(() => Protocol.Runtime.evaluate({ expression: "new Promise(resolve
=> setTimeout(resolve, 0))", awaitPromise: true})) |
| 132 .then(next); |
| 133 }, |
| 134 |
110 function testBreakpoint(next) { | 135 function testBreakpoint(next) { |
111 Protocol.Debugger.setBreakpointByUrl({lineNumber: 24, url: 'framework.js'}) | 136 Protocol.Debugger.setBreakpointByUrl({lineNumber: 25, url: 'framework.js'}) |
112 .then(() => InspectorTest.log('> all frames in framework:')) | 137 .then(() => InspectorTest.log('> all frames in framework:')) |
113 .then( | 138 .then( |
114 () => Protocol.Runtime.evaluate( | 139 () => Protocol.Runtime.evaluate( |
115 {expression: 'breakpoint()//# sourceURL=framework.js'})) | 140 {expression: 'breakpoint()//# sourceURL=framework.js'})) |
116 .then(() => InspectorTest.log('> mixed, top frame in framework:')) | 141 .then(() => InspectorTest.log('> mixed, top frame in framework:')) |
117 .then( | 142 .then( |
118 () => Protocol.Runtime.evaluate( | 143 () => Protocol.Runtime.evaluate( |
119 {expression: 'breakpoint()//# sourceURL=user.js'})) | 144 {expression: 'breakpoint()//# sourceURL=user.js'})) |
120 .then(next); | 145 .then(next); |
121 }, | 146 }, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 () => Protocol.Runtime.evaluate( | 205 () => Protocol.Runtime.evaluate( |
181 {expression: 'throwFromJSONParse()//# sourceURL=framework.js'})) | 206 {expression: 'throwFromJSONParse()//# sourceURL=framework.js'})) |
182 .then(() => InspectorTest.log('> mixed, top frame in framework:')) | 207 .then(() => InspectorTest.log('> mixed, top frame in framework:')) |
183 .then( | 208 .then( |
184 () => Protocol.Runtime.evaluate( | 209 () => Protocol.Runtime.evaluate( |
185 {expression: 'throwFromJSONParse()//# sourceURL=user.js'})) | 210 {expression: 'throwFromJSONParse()//# sourceURL=user.js'})) |
186 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) | 211 .then(() => Protocol.Debugger.setPauseOnExceptions({state: 'none'})) |
187 .then(next); | 212 .then(next); |
188 } | 213 } |
189 ]); | 214 ]); |
OLD | NEW |