test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js (1693B)
1 "use strict"; 2 3 const SOURCE_URL = getFileUrl( 4 "setBreakpoint-on-line-with-no-offsets-in-gcd-script.js" 5 ); 6 7 add_task( 8 threadFrontTest( 9 async ({ threadFront, debuggee, targetFront }) => { 10 const promise = waitForNewSource(threadFront, SOURCE_URL); 11 loadSubScriptWithOptions(SOURCE_URL, { 12 target: debuggee, 13 ignoreCache: true, 14 }); 15 Cu.forceGC(); 16 Cu.forceGC(); 17 Cu.forceGC(); 18 19 const { source } = await promise; 20 const sourceFront = threadFront.source(source); 21 22 const location = { line: 7 }; 23 let [packet, breakpointClient] = await setBreakpoint( 24 sourceFront, 25 location 26 ); 27 Assert.ok(packet.isPending); 28 Assert.equal(false, "actualLocation" in packet); 29 30 packet = await executeOnNextTickAndWaitForPause(function () { 31 reload(targetFront).then(function () { 32 loadSubScriptWithOptions(SOURCE_URL, { 33 target: debuggee, 34 ignoreCache: true, 35 }); 36 }); 37 }, threadFront); 38 const environment = await packet.frame.getEnvironment(); 39 Assert.equal(packet.type, "paused"); 40 const why = packet.why; 41 Assert.equal(why.type, "breakpoint"); 42 Assert.equal(why.actors.length, 1); 43 Assert.equal(why.actors[0], breakpointClient.actor); 44 const frame = packet.frame; 45 const where = frame.where; 46 Assert.equal(where.actor, source.actor); 47 Assert.equal(where.line, 8); 48 const variables = environment.bindings.variables; 49 Assert.equal(variables.a.value, 1); 50 Assert.equal(variables.c.value.type, "undefined"); 51 52 await resume(threadFront); 53 }, 54 { doNotRunWorker: true } 55 ) 56 );