browser_dbg-sourcemaps-ignorelist.js (2764B)
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 that sources on the sourcemaps ignore list are ignored on debugger load 6 // when the 'Ignore Known Third-party Scripts' setting is enabled. 7 8 "use strict"; 9 10 add_task(async function () { 11 const sources = [ 12 "bundle.js", 13 "original-1.js", 14 "original-2.js", 15 "original-3.js", 16 "original-4.js", 17 "original-5.js", 18 ]; 19 const dbg = await initDebugger("doc-sourcemaps-ignorelist.html", ...sources); 20 21 info("Click the settings menu to ignore the third party scripts"); 22 await toggleDebuggerSettingsMenuItem(dbg, { 23 className: ".debugger-settings-menu-item-enable-sourcemap-ignore-list", 24 isChecked: false, 25 }); 26 await waitForDispatch(dbg.store, "ENABLE_SOURCEMAP_IGNORELIST"); 27 28 info( 29 "Reload to hit breakpoints in the original-2.js and original-3.js files" 30 ); 31 const onReloaded = reload(dbg, ...sources); 32 await waitForPaused(dbg, null, { shouldWaitForLoadedScopes: false }); 33 34 info("Assert paused in original-2.js as original-1.js is ignored"); 35 const original2Source = findSource(dbg, "original-2.js"); 36 await assertPausedAtSourceAndLine(dbg, original2Source.id, 2); 37 38 await resume(dbg); 39 await waitForPaused(dbg, null, { shouldWaitForLoadedScopes: false }); 40 41 info("Assert paused in original-4.js as original-3.js is ignored"); 42 const original4Source = findSource(dbg, "original-4.js"); 43 await assertPausedAtSourceAndLine(dbg, original4Source.id, 2); 44 45 await resume(dbg); 46 await onReloaded; 47 48 info("Click the settings menu to stop ignoring the third party scripts"); 49 await toggleDebuggerSettingsMenuItem(dbg, { 50 className: ".debugger-settings-menu-item-enable-sourcemap-ignore-list", 51 isChecked: true, 52 }); 53 await waitForDispatch(dbg.store, "ENABLE_SOURCEMAP_IGNORELIST"); 54 55 info("Reload to hit breakpoints in all the original-[x].js files"); 56 const onReloaded2 = reload(dbg, "original-1.js"); 57 await waitForPaused(dbg, null, { shouldWaitForLoadedScopes: false }); 58 59 info("Assert paused in original-1.js as it is no longer ignored"); 60 const original1Source = findSource(dbg, "original-1.js"); 61 await assertPausedAtSourceAndLine(dbg, original1Source.id, 2); 62 63 const originalSources = ["original-2.js", "original-3.js", "original-4.js"]; 64 for (const fileName of originalSources) { 65 await resume(dbg); 66 await waitForPaused(dbg, null, { shouldWaitForLoadedScopes: false }); 67 68 const originalSource = findSource(dbg, fileName); 69 await assertPausedAtSourceAndLine(dbg, originalSource.id, 2); 70 } 71 await resume(dbg); 72 73 await onReloaded2; 74 await dbg.toolbox.closeToolbox(); 75 });