browser_dbg-sourcemapped-toggle.js (2190B)
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 "use strict"; 6 7 // Tests for preview through Babel's compile output. 8 requestLongerTimeout(5); 9 10 // Test pausing with mapScopes enabled and disabled 11 add_task(async function () { 12 await pushPref("devtools.debugger.map-scopes-enabled", true); 13 const dbg = await initDebugger("doc-sourcemapped.html"); 14 15 info("1. Pause on line 20"); 16 const url = "webpack3-babel6://./esmodules-cjs/input.js"; 17 await waitForSources(dbg, url); 18 19 const source = findSource(dbg, url); 20 await selectSource(dbg, source); 21 await addBreakpoint(dbg, source, 20, 3); 22 23 invokeInTab("webpack3Babel6EsmodulesCjs"); 24 await waitForPaused(dbg); 25 26 Assert.notEqual(getOriginalScope(dbg), null, "Scopes are now mapped"); 27 28 ok(!findFooterNotificationMessage(dbg), "No footer notification message"); 29 await assertPreviewTextValue(dbg, 20, 20, { 30 result: '"a-default"', 31 expression: "aDefault", 32 }); 33 34 info("3. Disable original variable mapping"); 35 await toggleMapScopes(dbg); 36 37 const notificationMessage = DEBUGGER_L10N.getFormatStr( 38 "editorNotificationFooter.noOriginalScopes", 39 DEBUGGER_L10N.getStr("scopes.showOriginalScopes") 40 ); 41 42 info( 43 "Assert that previews are disabled and the footer notification is visible" 44 ); 45 await hoverAtPos(dbg, { line: 20, column: 17 }); 46 await assertNoTooltip(dbg); 47 is( 48 findFooterNotificationMessage(dbg), 49 notificationMessage, 50 "The Original variable mapping warning is displayed" 51 ); 52 53 info("4. StepOver with mapScopes disabled"); 54 await stepOver(dbg, { shouldWaitForLoadedScopes: false }); 55 56 info( 57 "Assert that previews are still disabled and the footer notification is visible" 58 ); 59 await hoverAtPos(dbg, { line: 20, column: 17 }); 60 await assertNoTooltip(dbg); 61 62 is( 63 findFooterNotificationMessage(dbg), 64 notificationMessage, 65 "The Original variable mapping warning is displayed" 66 ); 67 }); 68 69 function getOriginalScope(dbg) { 70 return dbg.selectors.getSelectedOriginalScope( 71 dbg.selectors.getCurrentThread() 72 ); 73 }