| 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 InspectorTest.log('Checks createContext().'); | 5 InspectorTest.log('Checks createContext().'); |
| 6 | 6 |
| 7 InspectorTest.setupScriptMap(); | |
| 8 Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage); | |
| 9 Protocol.Debugger.onPaused((message) => { | |
| 10 InspectorTest.logSourceLocation(message.params.callFrames[0].location); | |
| 11 Protocol.Debugger.stepOut(); | |
| 12 }); | |
| 13 var executionContextIds = new Set(); | 7 var executionContextIds = new Set(); |
| 14 Protocol.Debugger.onScriptParsed(message => executionContextIds.add(message.para
ms.executionContextId)); | 8 var contextGroup = InspectorTest.createContextGroup(); |
| 15 var contextGroupId; | 9 var session = InspectorTest.createSession(contextGroup); |
| 10 setup(InspectorTest.session); |
| 11 setup(session); |
| 12 |
| 16 Protocol.Runtime.enable() | 13 Protocol.Runtime.enable() |
| 17 .then(() => contextGroupId = utils.createContextGroup()) | 14 .then(() => session.Protocol.Runtime.enable({})) |
| 18 .then(() => Protocol.Runtime.enable({}, contextGroupId)) | |
| 19 .then(() => Protocol.Debugger.enable()) | 15 .then(() => Protocol.Debugger.enable()) |
| 20 .then(() => Protocol.Debugger.enable({}, contextGroupId)) | 16 .then(() => session.Protocol.Debugger.enable({})) |
| 21 .then(InspectorTest.logMessage) | 17 .then(InspectorTest.logMessage) |
| 22 .then(() => { | 18 .then(() => { |
| 23 Protocol.Runtime.evaluate({ expression: 'debugger;' }) | 19 Protocol.Runtime.evaluate({ expression: 'debugger;' }); |
| 24 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' }, conte
xtGroupId); | 20 session.Protocol.Runtime.evaluate({expression: 'setTimeout(x => x * 2, 0)'})
; |
| 25 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); | 21 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); |
| 26 }) | 22 }) |
| 27 .then(() => InspectorTest.waitPendingTasks()) | 23 .then(() => InspectorTest.waitPendingTasks()) |
| 28 .then(() => { | 24 .then(() => { |
| 29 InspectorTest.log(`Reported script's execution id: ${executionContextIds.siz
e}`); | 25 InspectorTest.log(`Reported script's execution id: ${executionContextIds.siz
e}`); |
| 30 executionContextIds.clear(); | 26 executionContextIds.clear(); |
| 31 }) | 27 }) |
| 32 .then(() => utils.reconnect()) | 28 .then(() => InspectorTest.session.reconnect()) |
| 29 .then(() => session.reconnect()) |
| 33 .then(() => { | 30 .then(() => { |
| 34 Protocol.Runtime.evaluate({ expression: 'debugger;' }) | 31 Protocol.Runtime.evaluate({ expression: 'debugger;' }) |
| 35 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' }, conte
xtGroupId); | 32 session.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)'
}); |
| 36 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); | 33 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); |
| 37 }) | 34 }) |
| 38 .then(() => InspectorTest.waitPendingTasks()) | 35 .then(() => InspectorTest.waitPendingTasks()) |
| 39 .then(() => Protocol.Debugger.disable({}, contextGroupId)) | 36 .then(() => session.Protocol.Debugger.disable({})) |
| 40 .then(() => Protocol.Debugger.disable({})) | 37 .then(() => Protocol.Debugger.disable({})) |
| 41 .then(() => InspectorTest.log(`Reported script's execution id: ${executionCont
extIds.size}`)) | 38 .then(() => InspectorTest.log(`Reported script's execution id: ${executionCont
extIds.size}`)) |
| 42 .then(InspectorTest.completeTest); | 39 .then(InspectorTest.completeTest); |
| 40 |
| 41 function setup(session) { |
| 42 session.Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage); |
| 43 InspectorTest.setupScriptMap(session); |
| 44 session.Protocol.Debugger.onPaused((message) => { |
| 45 InspectorTest.logSourceLocation(message.params.callFrames[0].location, sessi
on); |
| 46 session.Protocol.Debugger.stepOut(); |
| 47 }); |
| 48 session.Protocol.Debugger.onScriptParsed(message => executionContextIds.add(me
ssage.params.executionContextId)); |
| 49 } |
| OLD | NEW |