Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 print('Check that setScriptSource completes correctly when an exception is throw n.'); | |
| 6 | |
| 7 Protocol.Debugger.enable(); | |
| 8 Protocol.Debugger.onScriptParsed(message => {runTests(message.params.scriptId)}) ; | |
|
kozy
2017/01/25 23:35:07
Protocol.Debugger.onceScriptParsed().then(message
luoe
2017/01/25 23:48:54
Done.
| |
| 9 InspectorTest.addScript(`function foo() {}`); | |
|
kozy
2017/01/25 23:35:07
No reason to use `` for single line source, please
luoe
2017/01/25 23:48:54
Done.
| |
| 10 | |
| 11 function runTests(scriptId) { | |
|
kozy
2017/01/25 23:35:07
Let's rewrite it a little:
InspectorTest.runTestS
luoe
2017/01/25 23:48:54
Done.
| |
| 12 Protocol.Debugger.setScriptSource({scriptId: scriptId, scriptSource: 'a # b'}) | |
| 13 .then(logExceptionOrError) | |
| 14 .then(() => Protocol.Debugger.setScriptSource({scriptId: '-1', scriptSourc e: '0'})) | |
| 15 .then(logExceptionOrError) | |
| 16 .then(InspectorTest.completeTest); | |
| 17 } | |
| 18 | |
| 19 function logExceptionOrError(message) { | |
| 20 if (message.result && message.result.exceptionDetails) { | |
|
kozy
2017/01/25 23:35:07
Since it's protocol test we prefer to just dump pr
luoe
2017/01/25 23:48:54
Done.
| |
| 21 InspectorTest.log('Error with exception:'); | |
| 22 InspectorTest.logMessage(message.result.exceptionDetails); | |
| 23 } else if (message.error) { | |
| 24 InspectorTest.log('Error with message:', message.error.message); | |
| 25 } | |
| 26 } | |
| OLD | NEW |