browser_dbg-log-point-mapping.js (1243B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 /* 6 * Tests that expressions in log points are source mapped. 7 */ 8 9 "use strict"; 10 11 add_task(async function () { 12 Services.prefs.setBoolPref("devtools.toolbox.splitconsole.open", true); 13 await pushPref("devtools.debugger.map-scopes-enabled", true); 14 15 const dbg = await initDebugger("doc-sourcemaps3.html", "test.js"); 16 17 const source = findSource(dbg, "test.js"); 18 await selectSource(dbg, "test.js"); 19 20 await getDebuggerSplitConsole(dbg); 21 22 await addBreakpoint(dbg, "test.js", 6); 23 await waitForBreakpoint(dbg, "test.js", 6); 24 25 await dbg.actions.addBreakpoint(createLocation({ line: 5, source }), { 26 logValue: "`value: ${JSON.stringify(test)}`", 27 requiresMapping: true, 28 }); 29 await waitForBreakpoint(dbg, "test.js", 5); 30 31 invokeInTab("test"); 32 33 await waitForPaused(dbg); 34 35 await hasConsoleMessage(dbg, "value:"); 36 const { value } = await findConsoleMessage(dbg, "value:"); 37 is( 38 value, 39 'value: ["b (30)","a","b (5)","z"]', 40 "Variables in logpoint expression should be mapped" 41 ); 42 await resume(dbg); 43 });