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/. */
7 const { Actor } = require("resource://devtools/shared/protocol.js");
9 threadConfigurationSpec,
10 } = require("resource://devtools/shared/specs/thread-configuration.js");
14 } = require("resource://devtools/server/actors/watcher/SessionDataHelpers.jsm");
16 SUPPORTED_DATA: { THREAD_CONFIGURATION },
17 } = SessionDataHelpers;
19 // List of options supported by this thread configuration actor.
20 const SUPPORTED_OPTIONS = {
21 // Controls pausing on debugger statement.
22 // (This is enabled by default if omitted)
23 shouldPauseOnDebuggerStatement: true,
24 // Enable pausing on exceptions.
25 pauseOnExceptions: true,
26 // Disable pausing on caught exceptions.
27 ignoreCaughtExceptions: true,
28 // Include previously saved stack frames when paused.
29 shouldIncludeSavedFrames: true,
30 // Include async stack frames when paused.
31 shouldIncludeAsyncLiveFrames: true,
32 // Stop pausing on breakpoints.
33 skipBreakpoints: true,
34 // Log the event break points.
35 logEventBreakpoints: true,
36 // Enable debugging asm & wasm.
37 // See https://searchfox.org/mozilla-central/source/js/src/doc/Debugger/Debugger.md#16-26
40 // Should pause all the workers untill thread has attached.
41 pauseWorkersUntilAttach: true,
45 * This actor manages the configuration options which apply to thread actor for all the targets.
47 * Configuration options should be applied to all concerned targets when the
48 * configuration is updated, and new targets should also be able to read the
49 * flags when they are created. The flags will be forwarded to the WatcherActor
50 * and stored as THREAD_CONFIGURATION data entries.
55 class ThreadConfigurationActor extends Actor {
56 constructor(watcherActor) {
57 super(watcherActor.conn, threadConfigurationSpec);
58 this.watcherActor = watcherActor;
61 async updateConfiguration(configuration) {
62 const configArray = Object.keys(configuration)
64 if (!SUPPORTED_OPTIONS[key]) {
65 console.warn(`Unsupported option for ThreadConfiguration: ${key}`);
70 .map(key => ({ key, value: configuration[key] }));
72 await this.watcherActor.addOrSetDataEntry(
80 exports.ThreadConfigurationActor = ThreadConfigurationActor;