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 InspectorTest.log('Tests that all sessions get exception notifications.'); |
| 6 |
| 7 function connect(contextGroup, num) { |
| 8 var session = contextGroup.connect(); |
| 9 var exceptionId; |
| 10 session.Protocol.Runtime.onExceptionThrown(message => { |
| 11 InspectorTest.log('From session ' + num); |
| 12 InspectorTest.logMessage(message); |
| 13 exceptionId = message.params.exceptionDetails.exceptionId; |
| 14 }); |
| 15 session.Protocol.Runtime.onExceptionRevoked(message => { |
| 16 InspectorTest.log('From session ' + num); |
| 17 InspectorTest.logMessage(message); |
| 18 InspectorTest.log('id matching: ' + (message.params.exceptionId === exceptio
nId)); |
| 19 }); |
| 20 return session; |
| 21 } |
| 22 |
| 23 (async function test() { |
| 24 var contextGroup = new InspectorTest.ContextGroup(); |
| 25 var session1 = connect(contextGroup, 1); |
| 26 var session2 = connect(contextGroup, 2); |
| 27 await session1.Protocol.Runtime.enable(); |
| 28 await session2.Protocol.Runtime.enable(); |
| 29 |
| 30 InspectorTest.log('Throwing in 2'); |
| 31 await session2.Protocol.Runtime.evaluate({expression: 'throw "error1";'}); |
| 32 |
| 33 InspectorTest.log('Throwing in 1'); |
| 34 await session1.Protocol.Runtime.evaluate({expression: 'throw "error2";'}); |
| 35 |
| 36 InspectorTest.log('Throwing in setTimeout 1'); |
| 37 await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { thro
w "error3"; }, 0)'}); |
| 38 await InspectorTest.waitForPendingTasks(); |
| 39 |
| 40 InspectorTest.log('Throwing in setTimeout 2'); |
| 41 await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { thro
w "error4"; }, 0)'}); |
| 42 await InspectorTest.waitForPendingTasks(); |
| 43 |
| 44 InspectorTest.log('Rejecting in 2'); |
| 45 await session2.Protocol.Runtime.evaluate({expression: 'var p2; setTimeout(() =
> { p2 = Promise.reject("error5") }, 0)'}); |
| 46 await InspectorTest.waitForPendingTasks(); |
| 47 InspectorTest.log('Revoking in 2'); |
| 48 await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p2.c
atch() }, 0);'}); |
| 49 await InspectorTest.waitForPendingTasks(); |
| 50 |
| 51 InspectorTest.log('Rejecting in 1'); |
| 52 await session1.Protocol.Runtime.evaluate({expression: 'var p1; setTimeout(() =
> { p1 = Promise.reject("error6")} , 0)'}); |
| 53 await InspectorTest.waitForPendingTasks(); |
| 54 InspectorTest.log('Revoking in 1'); |
| 55 await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p1.c
atch() }, 0);'}); |
| 56 await InspectorTest.waitForPendingTasks(); |
| 57 |
| 58 InspectorTest.completeTest(); |
| 59 })(); |
OLD | NEW |