browser_dbg-javascript-tracer-values.js (1231B)
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 // Tests tracing argument values 6 7 "use strict"; 8 add_task(async function testTracingValues() { 9 // Cover tracing function argument values 10 const jsCode = `function foo() { bar(1, ["array"], { attribute: 3 }, BigInt(4), Infinity, Symbol("6"), "7"); }; function bar(a, b, c) {}`; 11 const dbg = await initDebuggerWithAbsoluteURL( 12 "data:text/html," + encodeURIComponent(`<script>${jsCode}</script>`) 13 ); 14 15 // This test covers the Web Console, whereas it is no longer the default output 16 await toggleJsTracerMenuItem(dbg, "#jstracer-menu-item-console"); 17 18 await toggleJsTracerMenuItem(dbg, "#jstracer-menu-item-log-values"); 19 20 await toggleJsTracer(dbg.toolbox); 21 22 invokeInTab("foo"); 23 24 await hasConsoleMessage(dbg, "λ foo()"); 25 await hasConsoleMessage(dbg, "λ bar"); 26 const { value } = await findConsoleMessage(dbg, "λ bar"); 27 is( 28 value, 29 `⟶ interpreter λ bar(1, \nArray [ "array" ]\n, \nObject { attribute: 3 }\n, 4n, Infinity, Symbol("6"), "7")`, 30 "The argument were printed for bar()" 31 ); 32 });