test_objectgrips-15.js (1336B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Test out of scope objects with async functions. 8 */ 9 10 var gDebuggee; 11 var gThreadFront; 12 13 add_task( 14 threadFrontTest(async ({ threadFront, debuggee }) => { 15 gThreadFront = threadFront; 16 gDebuggee = debuggee; 17 await testObjectGroup(); 18 }) 19 ); 20 21 function evalCode() { 22 evalCallback(gDebuggee, function runTest() { 23 const ugh = []; 24 let i = 0; 25 26 function foo() { 27 ugh.push(i++); 28 debugger; 29 } 30 31 Promise.resolve().then(foo).then(foo); 32 }); 33 } 34 35 const testObjectGroup = async function () { 36 let packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront); 37 38 const environment = await packet.frame.getEnvironment(); 39 const ugh = environment.parent.bindings.variables.ugh; 40 const ughClient = await gThreadFront.pauseGrip(ugh.value); 41 42 packet = await getPrototypeAndProperties(ughClient); 43 44 packet = await resumeAndWaitForPause(gThreadFront); 45 const environment2 = await packet.frame.getEnvironment(); 46 const ugh2 = environment2.parent.bindings.variables.ugh; 47 const ugh2Client = gThreadFront.pauseGrip(ugh2.value); 48 49 packet = await getPrototypeAndProperties(ugh2Client); 50 Assert.equal(packet.ownProperties.length.value, 2); 51 52 await resume(gThreadFront); 53 };