Chromium Code Reviews| Index: test/inspector/debugger/set-script-source-exception.js |
| diff --git a/test/inspector/debugger/set-script-source-exception.js b/test/inspector/debugger/set-script-source-exception.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b4c09f451d0325ec0db81a53cc8a888578f9039b |
| --- /dev/null |
| +++ b/test/inspector/debugger/set-script-source-exception.js |
| @@ -0,0 +1,26 @@ |
| +// Copyright 2017 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +print('Check that setScriptSource completes correctly when an exception is thrown.'); |
| + |
| +Protocol.Debugger.enable(); |
| +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.
|
| +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.
|
| + |
| +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.
|
| + Protocol.Debugger.setScriptSource({scriptId: scriptId, scriptSource: 'a # b'}) |
| + .then(logExceptionOrError) |
| + .then(() => Protocol.Debugger.setScriptSource({scriptId: '-1', scriptSource: '0'})) |
| + .then(logExceptionOrError) |
| + .then(InspectorTest.completeTest); |
| +} |
| + |
| +function logExceptionOrError(message) { |
| + 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.
|
| + InspectorTest.log('Error with exception:'); |
| + InspectorTest.logMessage(message.result.exceptionDetails); |
| + } else if (message.error) { |
| + InspectorTest.log('Error with message:', message.error.message); |
| + } |
| +} |