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 | 4 |
5 print('Checks that Debugger.setScriptSource doesn\'t crash with modules'); | 5 InspectorTest.log('Checks that Debugger.setScriptSource doesn\'t crash with modu
les'); |
6 | 6 |
7 var module1 = ` | 7 var module1 = ` |
8 export function foo() { | 8 export function foo() { |
9 return 42; | 9 return 42; |
10 }`; | 10 }`; |
11 | 11 |
12 var editedModule1 = ` | 12 var editedModule1 = ` |
13 export function foo() { | 13 export function foo() { |
14 return 239; | 14 return 239; |
15 }`; | 15 }`; |
16 | 16 |
17 var module2 = ` | 17 var module2 = ` |
18 import { foo } from 'module1'; | 18 import { foo } from 'module1'; |
19 console.log(foo()); | 19 console.log(foo()); |
20 `; | 20 `; |
21 | 21 |
22 var module1Id; | 22 var module1Id; |
23 Protocol.Debugger.onScriptParsed(message => { | 23 Protocol.Debugger.onScriptParsed(message => { |
24 if (message.params.url === 'module1') | 24 if (message.params.url === 'module1') |
25 module1Id = message.params.scriptId; | 25 module1Id = message.params.scriptId; |
26 }); | 26 }); |
27 Protocol.Debugger.enable() | 27 Protocol.Debugger.enable() |
28 .then(() => InspectorTest.addModule(module1, 'module1')) | 28 .then(() => InspectorTest.addModule(module1, 'module1')) |
29 .then(() => InspectorTest.addModule(module2, 'module2')) | 29 .then(() => InspectorTest.addModule(module2, 'module2')) |
30 .then(() => InspectorTest.waitPendingTasks()) | 30 .then(() => InspectorTest.waitPendingTasks()) |
31 .then(() => Protocol.Debugger.setScriptSource({ scriptId: module1Id, scriptSou
rce: editedModule1 })) | 31 .then(() => Protocol.Debugger.setScriptSource({ scriptId: module1Id, scriptSou
rce: editedModule1 })) |
32 .then(InspectorTest.logMessage) | 32 .then(InspectorTest.logMessage) |
33 .then(InspectorTest.completeTest); | 33 .then(InspectorTest.completeTest); |
OLD | NEW |