test_nesting-03.js (1419B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that we can detect nested event loops in tabs with the same URL. 7 8 add_task(async function () { 9 const GLOBAL_NAME = "test-nesting1"; 10 11 initTestDevToolsServer(); 12 addTestGlobal(GLOBAL_NAME); 13 addTestGlobal(GLOBAL_NAME); 14 15 // Connect two thread actors, debugging the same debuggee, and both being paused. 16 const firstClient = new DevToolsClient(DevToolsServer.connectPipe()); 17 await firstClient.connect(); 18 const { threadFront: firstThreadFront } = await attachTestThread( 19 firstClient, 20 GLOBAL_NAME 21 ); 22 await firstThreadFront.interrupt(); 23 24 const secondClient = new DevToolsClient(DevToolsServer.connectPipe()); 25 await secondClient.connect(); 26 const { threadFront: secondThreadFront } = await attachTestThread( 27 secondClient, 28 GLOBAL_NAME 29 ); 30 await secondThreadFront.interrupt(); 31 32 // Then check how concurrent resume work 33 let result; 34 try { 35 result = await firstThreadFront.resume(); 36 } catch (e) { 37 Assert.ok(e.includes("wrongOrder"), "rejects with the wrong order"); 38 } 39 Assert.ok(!result, "no response"); 40 41 result = await secondThreadFront.resume(); 42 Assert.ok(true, "resumed as expected"); 43 44 await firstThreadFront.resume(); 45 46 Assert.ok(true, "resumed as expected"); 47 await firstClient.close(); 48 49 await finishClient(secondClient); 50 });