browser_dbg-sourcemaps-disabled.js (1540B)
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 loading and pretty printing bundles with sourcemaps disabled 6 7 "use strict"; 8 9 requestLongerTimeout(2); 10 11 add_task(async function () { 12 await pushPref("devtools.source-map.client-service.enabled", false); 13 const dbg = await initDebugger("doc-sourcemaps.html"); 14 15 await waitForSources(dbg, "bundle.js"); 16 const bundleSrc = findSource(dbg, "bundle.js"); 17 18 info("Pretty print the bundle"); 19 await selectSource(dbg, bundleSrc); 20 21 const footerButton = findElement(dbg, "sourceMapFooterButton"); 22 is( 23 footerButton.textContent, 24 "Source Maps disabled", 25 "The source map button reports the disabling" 26 ); 27 ok( 28 footerButton.classList.contains("disabled"), 29 "The source map button is disabled" 30 ); 31 32 await togglePrettyPrint(dbg); 33 ok(true, "Pretty printed source shown"); 34 35 const toggled = waitForDispatch(dbg.store, "TOGGLE_SOURCE_MAPS_ENABLED"); 36 await clickOnSourceMapMenuItem(dbg, ".debugger-source-map-enabled"); 37 await toggled; 38 ok(true, "Toggled the Source map setting"); 39 40 is( 41 footerButton.textContent, 42 "bundle file", 43 "The source map button now reports the pretty printed file as bundle file (as we don't support toggling source map before reloading the page)" 44 ); 45 ok( 46 !footerButton.classList.contains("disabled"), 47 "The source map button is no longer disabled" 48 ); 49 });