set-script-source-exception.js 914 Bytes
Newer Older
1 2 3 4
// 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.

5 6 7
let {session, contextGroup, Protocol} = InspectorTest.start(
    'Check that setScriptSource completes correctly when an exception is' +
    ' thrown.');
8 9 10

Protocol.Debugger.enable();

11 12 13 14
InspectorTest.runAsyncTestSuite([
  async function testIncorrectScriptId() {
    InspectorTest.logMessage(await Protocol.Debugger.setScriptSource(
        {scriptId: '-1', scriptSource: '0'}));
15 16
  },

17
  async function testSourceWithSyntaxError() {
18
    contextGroup.addScript('function foo() {}');
19 20 21 22 23 24
    const {params} = await Protocol.Debugger.onceScriptParsed();
    const msg = await Protocol.Debugger.setScriptSource({
      scriptId: params.scriptId,
      scriptSource: 'function foo() {\n  return a # b;\n}'
    });
    InspectorTest.logMessage(msg);
25 26
  }
]);