test_blackboxing-08.js (1583B)
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 blackbox ranges 8 */ 9 10 async function testFinish({ threadFront, devToolsClient }) { 11 await threadFront.resume(); 12 await close(devToolsClient); 13 14 do_test_finished(); 15 } 16 17 async function invokeAndPause({ global, threadFront }, expression) { 18 return executeOnNextTickAndWaitForPause( 19 () => global.eval(expression), 20 threadFront 21 ); 22 } 23 24 function run_test() { 25 return (async function () { 26 const dbg = await setupTestFromUrl("stepping.js"); 27 const { threadFront } = dbg; 28 29 await invokeAndPause(dbg, `chaining()`); 30 31 const { sources } = await getSources(threadFront); 32 const sourceFront = threadFront.source(sources[0]); 33 34 await setBreakpoint(threadFront, { sourceUrl: sourceFront.url, line: 7 }); 35 await setBreakpoint(threadFront, { sourceUrl: sourceFront.url, line: 11 }); 36 37 // 1. lets blackbox function a, and assert that we pause in b 38 const range = { start: { line: 6, column: 0 }, end: { line: 8, colum: 1 } }; 39 blackBox(sourceFront, range); 40 const paused = await resumeAndWaitForPause(threadFront); 41 equal(paused.frame.where.line, 11, "paused inside of b"); 42 await threadFront.resume(); 43 44 // 2. lets unblackbox function a, and assert that we pause in a 45 unBlackBox(sourceFront, range); 46 await invokeAndPause(dbg, `chaining()`); 47 const paused2 = await resumeAndWaitForPause(threadFront); 48 equal(paused2.frame.where.line, 7, "paused inside of a"); 49 50 await testFinish(dbg); 51 })(); 52 }