Files
sousa-gecko/devtools/client/shared/thread-utils.js
T
Yury Delendik 60d9e1adc3 Bug 2002637 - Remove Debugger asm.js hook, gdb tooling, devtools integration, and stale comments. r=devtools-reviewers,ochameau
Drop the now-no-op Debugger.allowUnobservedAsmJS accessor and the
matching Debugger.Object.createSource forceEnableAsmJS option, along
with all devtools plumbing that fed them (ThreadActor.observeAsmJS,
make-debugger's dbg.allowUnobservedAsmJS init, the
thread-utils/thread-configuration defaults, and the matching xpcshell
config). Delete the browser_dbg-features-asm.js integration test
and its doc-asm.html/asm.js fixtures, and the orphan
Debugger-allowUnobservedAsmJS-01.js jit-test.

Rename js/src/gdb/mozilla/asmjs.py to wasm_trap.py (its content has
only handled WasmTrapHandler SIGSEGV passthrough for some time) and
drop the obsolete test-asmjs.py.

Regenerate dom/base/use_counter_metrics.yaml to drop the js_asmjs and
js_use_asm Glean metrics following the earlier UseCounters.conf edit,
and scrub remaining asm.js mentions from js/src/doc, js/src/tests/lib,
js/xpconnect memory reporter strings, devtools docs, dom/script, and
several jit-tests.

Depends on D300556

Differential Revision: https://phabricator.services.mozilla.com/D300557
2026-06-29 15:35:41 +00:00

95 lines
3.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const asyncStoreHelper = require("resource://devtools/client/shared/async-store-helper.js");
const { validateBreakpointLocation } = ChromeUtils.importESModule(
"resource://devtools/shared/validate-breakpoint.sys.mjs",
{ global: "contextual" }
);
const asyncStore = asyncStoreHelper("debugger", {
pendingBreakpoints: ["pending-breakpoints", {}],
openedURLs: ["openedURLs", []],
prettyPrintedURLs: ["pretty-printed-urls", []],
xhrBreakpoints: ["xhr-breakpoints", []],
eventListenerBreakpoints: ["event-listener-breakpoints", undefined],
blackboxedRanges: ["blackboxedRanges", {}],
directoryRoots: ["directory-roots", {}],
});
exports.asyncStore = asyncStore;
exports.getThreadOptions = async function () {
return {
shouldPauseOnDebuggerStatement: Services.prefs.getBoolPref(
"devtools.debugger.pause-on-debugger-statement"
),
pauseOnExceptions: Services.prefs.getBoolPref(
"devtools.debugger.pause-on-exceptions"
),
ignoreCaughtExceptions: Services.prefs.getBoolPref(
"devtools.debugger.ignore-caught-exceptions"
),
shouldIncludeSavedFrames: Services.prefs.getBoolPref(
"devtools.debugger.features.async-captured-stacks"
),
shouldIncludeAsyncLiveFrames: Services.prefs.getBoolPref(
"devtools.debugger.features.async-live-stacks"
),
skipBreakpoints: Services.prefs.getBoolPref(
"devtools.debugger.skip-pausing"
),
logEventBreakpoints: Services.prefs.getBoolPref(
"devtools.debugger.log-event-breakpoints"
),
// @backward-compat { version 151 } asm.js was removed in Fx152; this is
// sent to old servers to disable ahead-of-time asm.js compilation for
// debugging. Can be removed when Fx151 is no longer a remote debugging target.
observeAsmJS: true,
breakpoints: sanitizeBreakpoints(await asyncStore.pendingBreakpoints),
// XXX: `event-listener-breakpoints` is a copy of the event-listeners state
// of the debugger panel. The `active` property is therefore linked to
// the `active` property of the state.
// See devtools/client/debugger/src/reducers/event-listeners.js
eventBreakpoints:
((await asyncStore.eventListenerBreakpoints) || {}).active || [],
};
};
/**
* Bug 1720512 - We used to store invalid breakpoints, leading to blank debugger.
* Filter out only the one that look invalid.
*/
function sanitizeBreakpoints(breakpoints) {
if (typeof breakpoints != "object") {
return {};
}
// We are not doing any assertion against keys,
// as it looks like we are never using them anywhere in frontend, nor backend.
const validBreakpoints = {};
for (const key in breakpoints) {
const bp = breakpoints[key];
try {
if (!bp) {
throw new Error("Undefined breakpoint");
}
// Debugger's main.js's `syncBreakpoints` will only use generatedLocation
// when restoring breakpoints.
validateBreakpointLocation(bp.generatedLocation);
// But Toolbox will still pass location to thread actor's reconfigure
// for target that don't support watcher+BreakpointListActor
validateBreakpointLocation(bp.location);
validBreakpoints[key] = bp;
} catch (e) {
console.error(
"Ignore invalid breakpoint from debugger store",
bp,
e.message
);
}
}
return validBreakpoints;
}
exports.sanitizeBreakpoints = sanitizeBreakpoints;