tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 28433ae60ee5056174b347e4ad9a6338237b14d0
parent 96e2aa51411081ea22782a69955b9a5a7863259d
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Thu, 11 Dec 2025 08:22:32 +0000

Bug 2004293 - [devtools] Turn devtools/client/framework/toolbox.js into an ES class. r=devtools-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D275893

Diffstat:
Mdevtools/client/framework/toolbox.js | 750++++++++++++++++++++++++++++++++++++++++---------------------------------------
1 file changed, 376 insertions(+), 374 deletions(-)

diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js @@ -254,192 +254,192 @@ exports.BOOLEAN_CONFIGURATION_PREFS = BOOLEAN_CONFIGURATION_PREFS; * A "Toolbox" is the component that holds all the tools for one specific * target. Visually, it's a document that includes the tools tabs and all * the iframes where the tool panels will be living in. - * - * @param {object} options - * @param {object} options.commands - * The context to inspect identified by this commands. - * @param {string} options.selectedTool - * Tool to select initially - * @param {object} options.selectedToolOptions - * Object that will be passed to the panel init function - * @param {Toolbox.HostType} options.hostType - * Type of host that will host the toolbox (e.g. sidebar, window) - * @param {DOMWindow} options.contentWindow - * The window object of the toolbox document - * @param {string} options.frameId - * A unique identifier to differentiate toolbox documents from the - * chrome codebase when passing DOM messages */ -function Toolbox({ - commands, - selectedTool, - selectedToolOptions, - hostType, - contentWindow, - frameId, -}) { - this._win = contentWindow; - this.frameId = frameId; - this.selection = new Selection(); - this.telemetry = new Telemetry({ useSessionId: true }); - // This attribute helps identify one particular toolbox instance. - this.sessionId = this.telemetry.sessionId; - - // This attribute is meant to be a public attribute on the Toolbox object - // It exposes commands modules listed in devtools/shared/commands/index.js - // which are an abstraction on top of RDP methods. - // See devtools/shared/commands/README.md - this.commands = commands; - this._descriptorFront = commands.descriptorFront; - - // Map of the available DevTools WebExtensions: - // Map<extensionUUID, extensionName> - this._webExtensions = new Map(); - - this._toolPanels = new Map(); - this._inspectorExtensionSidebars = new Map(); - - this._netMonitorAPI = null; - - // Map of frames (id => frame-info) and currently selected frame id. - this.frameMap = new Map(); - this.selectedFrameId = null; - - // Number of targets currently paused - this._pausedTargets = new Set(); - - /** - * KeyShortcuts instance specific to WINDOW host type. - * This is the key shortcuts that are only register when the toolbox - * is loaded in its own window. Otherwise, these shortcuts are typically - * registered by devtools-startup.js module. - */ - this._windowHostShortcuts = null; - - // List of currently displayed panel's iframes - this._visibleIframes = new Set(); - - this._toolRegistered = this._toolRegistered.bind(this); - this._toolUnregistered = this._toolUnregistered.bind(this); - this._refreshHostTitle = this._refreshHostTitle.bind(this); - this.toggleNoAutohide = this.toggleNoAutohide.bind(this); - this.toggleAlwaysOnTop = this.toggleAlwaysOnTop.bind(this); - this.disablePseudoLocale = () => this.changePseudoLocale("none"); - this.enableAccentedPseudoLocale = () => this.changePseudoLocale("accented"); - this.enableBidiPseudoLocale = () => this.changePseudoLocale("bidi"); - this._updateFrames = this._updateFrames.bind(this); - this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this); - this.closeToolbox = this.closeToolbox.bind(this); - this.destroy = this.destroy.bind(this); - this._saveSplitConsoleHeight = this._saveSplitConsoleHeight.bind(this); - this._onFocus = this._onFocus.bind(this); - this._onBlur = this._onBlur.bind(this); - this._onBrowserMessage = this._onBrowserMessage.bind(this); - this._onTabsOrderUpdated = this._onTabsOrderUpdated.bind(this); - this._onToolbarFocus = this._onToolbarFocus.bind(this); - this._onToolbarArrowKeypress = this._onToolbarArrowKeypress.bind(this); - this._onPickerClick = this._onPickerClick.bind(this); - this._onPickerKeypress = this._onPickerKeypress.bind(this); - this._onPickerStarting = this._onPickerStarting.bind(this); - this._onPickerStarted = this._onPickerStarted.bind(this); - this._onPickerStopped = this._onPickerStopped.bind(this); - this._onPickerCanceled = this._onPickerCanceled.bind(this); - this._onPickerPicked = this._onPickerPicked.bind(this); - this._onPickerPreviewed = this._onPickerPreviewed.bind(this); - this._onInspectObject = this._onInspectObject.bind(this); - this._onNewSelectedNodeFront = this._onNewSelectedNodeFront.bind(this); - this._onToolSelected = this._onToolSelected.bind(this); - this._onContextMenu = this._onContextMenu.bind(this); - this._onMouseDown = this._onMouseDown.bind(this); - this.updateToolboxButtonsVisibility = - this.updateToolboxButtonsVisibility.bind(this); - this.updateToolboxButtons = this.updateToolboxButtons.bind(this); - this.selectTool = this.selectTool.bind(this); - this._pingTelemetrySelectTool = this._pingTelemetrySelectTool.bind(this); - this.toggleSplitConsole = this.toggleSplitConsole.bind(this); - this.toggleOptions = this.toggleOptions.bind(this); - this._onTargetAvailable = this._onTargetAvailable.bind(this); - this._onTargetDestroyed = this._onTargetDestroyed.bind(this); - this._onTargetSelected = this._onTargetSelected.bind(this); - this._onResourceAvailable = this._onResourceAvailable.bind(this); - this._onResourceUpdated = this._onResourceUpdated.bind(this); - this._onToolSelectedStopPicker = this._onToolSelectedStopPicker.bind(this); - - // `component` might be null if the toolbox was destroying during the throttling - this._throttledSetToolboxButtons = throttle( - () => this.component?.setToolboxButtons(this.toolbarButtons), - 500, - this - ); +class Toolbox extends EventEmitter { + /** + * @param {object} options + * @param {object} options.commands + * The context to inspect identified by this commands. + * @param {string} options.selectedTool + * Tool to select initially + * @param {object} options.selectedToolOptions + * Object that will be passed to the panel init function + * @param {Toolbox.HostType} options.hostType + * Type of host that will host the toolbox (e.g. sidebar, window) + * @param {DOMWindow} options.contentWindow + * The window object of the toolbox document + * @param {string} options.frameId + * A unique identifier to differentiate toolbox documents from the + * chrome codebase when passing DOM messages + */ + constructor({ + commands, + selectedTool, + selectedToolOptions, + hostType, + contentWindow, + frameId, + }) { + super(); + + this._win = contentWindow; + this.frameId = frameId; + this.selection = new Selection(); + this.telemetry = new Telemetry({ useSessionId: true }); + // This attribute helps identify one particular toolbox instance. + this.sessionId = this.telemetry.sessionId; + + // This attribute is meant to be a public attribute on the Toolbox object + // It exposes commands modules listed in devtools/shared/commands/index.js + // which are an abstraction on top of RDP methods. + // See devtools/shared/commands/README.md + this.commands = commands; + this._descriptorFront = commands.descriptorFront; + + // Map of the available DevTools WebExtensions: + // Map<extensionUUID, extensionName> + this._webExtensions = new Map(); + + this._toolPanels = new Map(); + this._inspectorExtensionSidebars = new Map(); + + this._netMonitorAPI = null; + + // Map of frames (id => frame-info) and currently selected frame id. + this.frameMap = new Map(); + this.selectedFrameId = null; + + // Number of targets currently paused + this._pausedTargets = new Set(); - this._debounceUpdateFocusedState = debounce( - () => { - this.component?.setFocusedState(this._isToolboxFocused); - }, - 500, - this - ); + /** + * KeyShortcuts instance specific to WINDOW host type. + * This is the key shortcuts that are only register when the toolbox + * is loaded in its own window. Otherwise, these shortcuts are typically + * registered by devtools-startup.js module. + */ + this._windowHostShortcuts = null; + + // List of currently displayed panel's iframes + this._visibleIframes = new Set(); + + this._toolRegistered = this._toolRegistered.bind(this); + this._toolUnregistered = this._toolUnregistered.bind(this); + this._refreshHostTitle = this._refreshHostTitle.bind(this); + this.toggleNoAutohide = this.toggleNoAutohide.bind(this); + this.toggleAlwaysOnTop = this.toggleAlwaysOnTop.bind(this); + this.disablePseudoLocale = () => this.changePseudoLocale("none"); + this.enableAccentedPseudoLocale = () => this.changePseudoLocale("accented"); + this.enableBidiPseudoLocale = () => this.changePseudoLocale("bidi"); + this._updateFrames = this._updateFrames.bind(this); + this._splitConsoleOnKeypress = this._splitConsoleOnKeypress.bind(this); + this.closeToolbox = this.closeToolbox.bind(this); + this.destroy = this.destroy.bind(this); + this._saveSplitConsoleHeight = this._saveSplitConsoleHeight.bind(this); + this._onFocus = this._onFocus.bind(this); + this._onBlur = this._onBlur.bind(this); + this._onBrowserMessage = this._onBrowserMessage.bind(this); + this._onTabsOrderUpdated = this._onTabsOrderUpdated.bind(this); + this._onToolbarFocus = this._onToolbarFocus.bind(this); + this._onToolbarArrowKeypress = this._onToolbarArrowKeypress.bind(this); + this._onPickerClick = this._onPickerClick.bind(this); + this._onPickerKeypress = this._onPickerKeypress.bind(this); + this._onPickerStarting = this._onPickerStarting.bind(this); + this._onPickerStarted = this._onPickerStarted.bind(this); + this._onPickerStopped = this._onPickerStopped.bind(this); + this._onPickerCanceled = this._onPickerCanceled.bind(this); + this._onPickerPicked = this._onPickerPicked.bind(this); + this._onPickerPreviewed = this._onPickerPreviewed.bind(this); + this._onInspectObject = this._onInspectObject.bind(this); + this._onNewSelectedNodeFront = this._onNewSelectedNodeFront.bind(this); + this._onToolSelected = this._onToolSelected.bind(this); + this._onContextMenu = this._onContextMenu.bind(this); + this._onMouseDown = this._onMouseDown.bind(this); + this.updateToolboxButtonsVisibility = + this.updateToolboxButtonsVisibility.bind(this); + this.updateToolboxButtons = this.updateToolboxButtons.bind(this); + this.selectTool = this.selectTool.bind(this); + this._pingTelemetrySelectTool = this._pingTelemetrySelectTool.bind(this); + this.toggleSplitConsole = this.toggleSplitConsole.bind(this); + this.toggleOptions = this.toggleOptions.bind(this); + this._onTargetAvailable = this._onTargetAvailable.bind(this); + this._onTargetDestroyed = this._onTargetDestroyed.bind(this); + this._onTargetSelected = this._onTargetSelected.bind(this); + this._onResourceAvailable = this._onResourceAvailable.bind(this); + this._onResourceUpdated = this._onResourceUpdated.bind(this); + this._onToolSelectedStopPicker = this._onToolSelectedStopPicker.bind(this); + + // `component` might be null if the toolbox was destroying during the throttling + this._throttledSetToolboxButtons = throttle( + () => this.component?.setToolboxButtons(this.toolbarButtons), + 500, + this + ); - if (!selectedTool) { - selectedTool = Services.prefs.getCharPref(this._prefs.LAST_TOOL); - } - this._defaultToolId = selectedTool; - this._defaultToolOptions = selectedToolOptions; + this._debounceUpdateFocusedState = debounce( + () => { + this.component?.setFocusedState(this._isToolboxFocused); + }, + 500, + this + ); - this._hostType = hostType; + if (!selectedTool) { + selectedTool = Services.prefs.getCharPref(this._prefs.LAST_TOOL); + } + this._defaultToolId = selectedTool; + this._defaultToolOptions = selectedToolOptions; - this.isOpen = new Promise( - function (resolve) { - this._resolveIsOpen = resolve; - }.bind(this) - ); + this._hostType = hostType; - EventEmitter.decorate(this); + this.isOpen = new Promise( + function (resolve) { + this._resolveIsOpen = resolve; + }.bind(this) + ); - this.on("host-changed", this._refreshHostTitle); - this.on("select", this._onToolSelected); + this.on("host-changed", this._refreshHostTitle); + this.on("select", this._onToolSelected); - this.selection.on("new-node-front", this._onNewSelectedNodeFront); + this.selection.on("new-node-front", this._onNewSelectedNodeFront); - gDevTools.on("tool-registered", this._toolRegistered); - gDevTools.on("tool-unregistered", this._toolUnregistered); + gDevTools.on("tool-registered", this._toolRegistered); + gDevTools.on("tool-unregistered", this._toolUnregistered); - /** - * Get text direction for the current locale direction. - * - * `getComputedStyle` forces a synchronous reflow, so use a lazy getter in order to - * call it only once. - */ - loader.lazyGetter(this, "direction", () => { - const { documentElement } = this.doc; - const isRtl = - this.win.getComputedStyle(documentElement).direction === "rtl"; - return isRtl ? "rtl" : "ltr"; - }); -} -exports.Toolbox = Toolbox; + /** + * Get text direction for the current locale direction. + * + * `getComputedStyle` forces a synchronous reflow, so use a lazy getter in order to + * call it only once. + */ + loader.lazyGetter(this, "direction", () => { + const { documentElement } = this.doc; + const isRtl = + this.win.getComputedStyle(documentElement).direction === "rtl"; + return isRtl ? "rtl" : "ltr"; + }); + } -/** - * The toolbox can be 'hosted' either embedded in a browser window - * or in a separate window. - */ -Toolbox.HostType = { - BOTTOM: "bottom", - RIGHT: "right", - LEFT: "left", - WINDOW: "window", - BROWSERTOOLBOX: "browsertoolbox", - // This is typically used by `about:debugging`, when opening toolbox in a new tab, - // via `about:devtools-toolbox` URLs. - PAGE: "page", -}; + /** + * The toolbox can be 'hosted' either embedded in a browser window + * or in a separate window. + */ + static HostType = { + BOTTOM: "bottom", + RIGHT: "right", + LEFT: "left", + WINDOW: "window", + BROWSERTOOLBOX: "browsertoolbox", + // This is typically used by `about:debugging`, when opening toolbox in a new tab, + // via `about:devtools-toolbox` URLs. + PAGE: "page", + }; -Toolbox.prototype = { - _URL: "about:devtools-toolbox", + _URL = "about:devtools-toolbox"; - _prefs: { + _prefs = { LAST_TOOL: "devtools.toolbox.selectedTool", - }, + }; get nodePicker() { if (!this._nodePicker) { @@ -453,36 +453,36 @@ Toolbox.prototype = { } return this._nodePicker; - }, + } get store() { if (!this._store) { this._store = createToolboxStore(); } return this._store; - }, + } get currentToolId() { return this._currentToolId; - }, + } set currentToolId(id) { this._currentToolId = id; this.component.setCurrentToolId(id); - }, + } get defaultToolId() { return this._defaultToolId; - }, + } get panelDefinitions() { return this._panelDefinitions; - }, + } set panelDefinitions(definitions) { this._panelDefinitions = definitions; this._combineAndSortPanelDefinitions(); - }, + } get visibleAdditionalTools() { if (!this._visibleAdditionalTools) { @@ -490,14 +490,14 @@ Toolbox.prototype = { } return this._visibleAdditionalTools; - }, + } set visibleAdditionalTools(tools) { this._visibleAdditionalTools = tools; if (this.isReady) { this._combineAndSortPanelDefinitions(); } - }, + } /** * Combines the built-in panel definitions and the additional tool definitions that @@ -510,9 +510,9 @@ Toolbox.prototype = { ]; definitions = sortPanelDefinitions(definitions); this.component.setPanelDefinitions(definitions); - }, + } - lastUsedToolId: null, + lastUsedToolId = null; /** * Returns a *copy* of the _toolPanels collection. @@ -522,14 +522,14 @@ Toolbox.prototype = { */ getToolPanels() { return new Map(this._toolPanels); - }, + } /** * Access the panel for a given tool */ getPanel(id) { return this._toolPanels.get(id); - }, + } /** * Get the panel instance for a given tool once it is ready. @@ -555,7 +555,7 @@ Toolbox.prototype = { }); } }); - }, + } /** * This is a shortcut for getPanel(currentToolId) because it is much more @@ -564,7 +564,7 @@ Toolbox.prototype = { */ getCurrentPanel() { return this._toolPanels.get(this.currentToolId); - }, + } /** * Get the current top level target the toolbox is debugging. @@ -574,11 +574,11 @@ Toolbox.prototype = { */ get target() { return this.commands.targetCommand.targetFront; - }, + } get threadFront() { return this.commands.targetCommand.targetFront.threadFront; - }, + } /** * Get/alter the host of a Toolbox, i.e. is it in browser or in a separate @@ -586,14 +586,14 @@ Toolbox.prototype = { */ get hostType() { return this._hostType; - }, + } /** * Shortcut to the window containing the toolbox UI */ get win() { return this._win; - }, + } /** * When the toolbox is loaded in a frame with type="content", win.parent will not return @@ -602,25 +602,25 @@ Toolbox.prototype = { */ get topWindow() { return DevToolsUtils.getTopWindow(this.win); - }, + } get topDoc() { return this.topWindow.document; - }, + } /** * Shortcut to the document containing the toolbox UI */ get doc() { return this.win.document; - }, + } /** * Get the toggled state of the split console */ get splitConsole() { return this._splitConsole; - }, + } /** * Get the focused state of the split console @@ -635,7 +635,7 @@ Toolbox.prototype = { focusedWin === this.doc.querySelector("#toolbox-panel-iframe-webconsole").contentWindow ); - }, + } /** * Get the enabled split console setting, and if it's not set, set it with updateIsSplitConsoleEnabled @@ -648,15 +648,15 @@ Toolbox.prototype = { } return this._splitConsoleEnabled; - }, + } get isBrowserToolbox() { return this.hostType === Toolbox.HostType.BROWSERTOOLBOX; - }, + } get isMultiProcessBrowserToolbox() { return this.isBrowserToolbox; - }, + } /** * Set a given target as selected (which may impact the console evaluation context selector). @@ -669,7 +669,7 @@ Toolbox.prototype = { // So dispatch this action against that other store. this.commands.targetCommand.store.dispatch(selectTarget(targetActorID)); } - }, + } /** * @returns {ThreadFront|null} The selected thread front, or null if there is none. @@ -685,7 +685,7 @@ Toolbox.prototype = { } return this.commands.client.getFrontByID(selectedTarget.actorID); - }, + } /** * For now, the debugger isn't hooked to TargetCommand's store @@ -706,7 +706,7 @@ Toolbox.prototype = { dbg.selectThread(threadActorID); } - }, + } /** * Called on each new THREAD_STATE resource @@ -719,7 +719,7 @@ Toolbox.prototype = { } else if (resource.state == "resumed") { this._onTargetResumed(resource.targetFront); } - }, + } /** * This listener is called by TracerCommand, sooner than the JSTRACER_STATE resource. @@ -741,7 +741,7 @@ Toolbox.prototype = { const panel = await this.selectTool("jsdebugger"); panel.showTracerSidebar(); } - }, + } /** * Called on each new JSTRACER_STATE resource @@ -764,7 +764,7 @@ Toolbox.prototype = { profileCaptureResult, null ); - }, + } /** * Called whenever a given target got its execution paused. @@ -803,7 +803,7 @@ Toolbox.prototype = { this._pausedTargets.add(targetFront); this.emit("toolbox-paused"); } - }, + } /** * Called whenever a given target got its execution resumed. @@ -818,7 +818,7 @@ Toolbox.prototype = { this.unhighlightTool("jsdebugger"); } } - }, + } /** * This method will be called for the top-level target, as well as any potential @@ -876,13 +876,13 @@ Toolbox.prototype = { ) { await this.switchHostToTab(targetFront.targetForm.browsingContextID); } - }, + } async _onTargetSelected({ targetFront }) { this._updateFrames({ selected: targetFront.actorID }); this.selectTarget(targetFront.actorID); this._refreshHostTitle(); - }, + } _onTargetDestroyed({ targetFront }) { removeTarget(this.store, targetFront); @@ -921,7 +921,7 @@ Toolbox.prototype = { ], }); } - }, + } _onTargetThreadFrontResumeWrongOrder() { const box = this.getNotificationBox(); @@ -931,7 +931,7 @@ Toolbox.prototype = { "", box.PRIORITY_WARNING_HIGH ); - }, + } /** * Open the toolbox @@ -1179,7 +1179,7 @@ Toolbox.prototype = { // The exception was already logged to stdout. } } - }, + } /** * Retrieve the ChromeEventHandler associated to the toolbox frame. @@ -1192,7 +1192,7 @@ Toolbox.prototype = { return null; } return this.win.docShell.chromeEventHandler; - }, + } /** * Attach events on the chromeEventHandler for the current window. When loaded in a @@ -1229,7 +1229,7 @@ Toolbox.prototype = { this._onContextMenu ); this._chromeEventHandler.addEventListener("mousedown", this._onMouseDown); - }, + } _removeChromeEventHandlerEvents() { if (!this._chromeEventHandler) { @@ -1257,7 +1257,7 @@ Toolbox.prototype = { ); this._chromeEventHandler = null; - }, + } _addShortcuts() { // Create shortcuts instance for the toolbox @@ -1318,7 +1318,7 @@ Toolbox.prototype = { // zoom should be handled by the default browser shortcuts. ZoomKeys.register(this.win, this.shortcuts); } - }, + } /** * Reload the debugged context. @@ -1365,14 +1365,14 @@ Toolbox.prototype = { box.PRIORITY_CRITICAL_HIGH ); } - }, + } _removeShortcuts() { if (this.shortcuts) { this.shortcuts.destroy(); this.shortcuts = null; } - }, + } /** * Adds the keys and commands to the Toolbox Window in window mode. @@ -1433,14 +1433,14 @@ Toolbox.prototype = { } else { shortcuts.on(L10N.getStr("toolbox.toggleToolbox.key"), this.closeToolbox); } - }, + } _removeWindowHostShortcuts() { if (this._windowHostShortcuts) { this._windowHostShortcuts.destroy(); this._windowHostShortcuts = null; } - }, + } _onContextMenu(e) { // Handle context menu events in standard input elements: <input> and <textarea>. @@ -1470,7 +1470,7 @@ Toolbox.prototype = { if (isInInput) { this.openTextBoxContextMenu(e.screenX, e.screenY); } - }, + } _onMouseDown(e) { const isMiddleClick = e.button === 1; @@ -1481,7 +1481,7 @@ Toolbox.prototype = { // to catch and preventDefault() on those events. e.preventDefault(); } - }, + } _getDebugTargetData() { const url = new URL(this.win.location); @@ -1496,11 +1496,11 @@ Toolbox.prototype = { descriptorType: this._descriptorFront.descriptorType, descriptorName: this._descriptorFront.name, }; - }, + } isDebugTargetFenix() { return this._getDebugTargetData()?.runtimeInfo?.isFenix; - }, + } /** * loading React modules when needed (to avoid performance penalties @@ -1508,27 +1508,27 @@ Toolbox.prototype = { */ get React() { return this.browserRequire("devtools/client/shared/vendor/react"); - }, + } get ReactDOM() { return this.browserRequire("devtools/client/shared/vendor/react-dom"); - }, + } get ReactRedux() { return this.browserRequire("devtools/client/shared/vendor/react-redux"); - }, + } get ToolboxController() { return this.browserRequire( "devtools/client/framework/components/ToolboxController" ); - }, + } get AppErrorBoundary() { return this.browserRequire( "resource://devtools/client/shared/components/AppErrorBoundary.js" ); - }, + } /** * A common access point for the client-side mapping service for source maps that @@ -1541,7 +1541,7 @@ Toolbox.prototype = { } this._sourceMapLoader = new SourceMapLoader(this.commands.targetCommand); return this._sourceMapLoader; - }, + } /** * Expose the "Parser" debugger worker to both webconsole and debugger. @@ -1559,7 +1559,7 @@ Toolbox.prototype = { this._parserWorker = new ParserDispatcher(); return this._parserWorker; - }, + } /** * Clients wishing to use source maps but that want the toolbox to @@ -1577,7 +1577,7 @@ Toolbox.prototype = { this.sourceMapLoader ); return this._sourceMapURLService; - }, + } // Return HostType id for telemetry _getTelemetryHostId() { @@ -1597,7 +1597,7 @@ Toolbox.prototype = { default: return 9; } - }, + } // Return HostType string for telemetry _getTelemetryHostString() { @@ -1617,7 +1617,7 @@ Toolbox.prototype = { default: return "bottom"; } - }, + } _pingTelemetry() { Services.prefs.setBoolPref("devtools.everOpened", true); @@ -1649,7 +1649,7 @@ Toolbox.prototype = { "host", this._getTelemetryHostString() ); - }, + } /** * Create a simple object to store the state of a toolbox button. The checked state of @@ -1766,7 +1766,7 @@ Toolbox.prototype = { EventEmitter.decorate(button); return button; - }, + } _splitConsoleOnKeypress(e) { if (e.keyCode !== KeyCodes.DOM_VK_ESCAPE || !this.isSplitConsoleEnabled()) { @@ -1794,7 +1794,7 @@ Toolbox.prototype = { ) { e.preventDefault(); } - }, + } /** * Add a shortcut key that should work when a split console @@ -1815,12 +1815,12 @@ Toolbox.prototype = { event.preventDefault(); } }); - }, + } _addWindowListeners() { this.win.addEventListener("unload", this.destroy); this.win.addEventListener("message", this._onBrowserMessage, true); - }, + } _removeWindowListeners() { // The host iframe's contentDocument may already be gone. @@ -1828,7 +1828,7 @@ Toolbox.prototype = { this.win.removeEventListener("unload", this.destroy); this.win.removeEventListener("message", this._onBrowserMessage, true); } - }, + } // Called whenever the chrome send a message _onBrowserMessage(event) { @@ -1841,14 +1841,14 @@ Toolbox.prototype = { if (event.data?.name === "host-raised") { this.emit("host-raised"); } - }, + } _saveSplitConsoleHeight() { const height = parseInt(this.webconsolePanel.style.height, 10); if (!isNaN(height)) { Services.prefs.setIntPref(SPLITCONSOLE_HEIGHT_PREF, height); } - }, + } /** * Make sure that the console is showing up properly based on all the @@ -1887,7 +1887,7 @@ Toolbox.prototype = { this.webconsolePanel.style.height = openedConsolePanel ? "" : Services.prefs.getIntPref(SPLITCONSOLE_HEIGHT_PREF) + "px"; - }, + } /** * Handle any custom key events. Returns true if there was a custom key @@ -1906,7 +1906,7 @@ Toolbox.prototype = { ) { toolDefinition.onkey(this.getCurrentPanel(), this); } - }, + } /** * Build the notification box as soon as needed. @@ -1927,7 +1927,7 @@ Toolbox.prototype = { ); } return this._notificationBox; - }, + } /** * Build the options for changing hosts. Called every time @@ -1963,7 +1963,7 @@ Toolbox.prototype = { this.component.setCurrentHostType(this.hostType); this.component.setHostTypes(hostTypes); - }, + } postMessage(msg) { // We sometime try to send messages in middle of destroy(), where the @@ -1974,7 +1974,7 @@ Toolbox.prototype = { msg.frameId = this.frameId; this.topWindow.postMessage(msg, "*"); } - }, + } /** * This will fetch the panel definitions from the constants in definitions module @@ -1991,7 +1991,7 @@ Toolbox.prototype = { definition => definition.isToolSupported(this) && definition.id !== "options" ); - }, + } async _setInitialMeatballState() { let disableAutohide, pseudoLocale; @@ -2024,7 +2024,7 @@ Toolbox.prototype = { ); this.component.setAlwaysOnTop(alwaysOnTop); } - }, + } /** * Initiate toolbox React components and all it's properties. Do the initial render. @@ -2090,7 +2090,7 @@ Toolbox.prototype = { // Get the DOM element to mount the React components to. this._componentMount = this.doc.getElementById("toolbox-toolbar-mount"); this._appBoundary = this.ReactDOM.render(element, this._componentMount); - }, + } /** * Reset tabindex attributes across all focusable elements inside the toolbar. @@ -2101,7 +2101,7 @@ Toolbox.prototype = { */ _onToolbarFocus(id) { this.component.setFocusedButton(id); - }, + } /** * On left/right arrow press, attempt to move the focus inside the toolbar to @@ -2166,7 +2166,7 @@ Toolbox.prototype = { event.preventDefault(); event.stopPropagation(); - }, + } /** * Add buttons to the UI as specified in devtools/client/definitions.js @@ -2185,7 +2185,7 @@ Toolbox.prototype = { }); this.component.setToolboxButtons(this.toolbarButtons); - }, + } /** * Button to select a frame for the inspector to target. @@ -2205,7 +2205,7 @@ Toolbox.prototype = { }); return this.frameButton; - }, + } /** * Button to display the number of errors. @@ -2222,7 +2222,7 @@ Toolbox.prototype = { this.updateErrorCountButton(); return this.errorCountButton; - }, + } /** * Toggle the picker, but also decide whether or not the highlighter should @@ -2244,7 +2244,7 @@ Toolbox.prototype = { } else { this.nodePicker.togglePicker(focus); } - }, + } /** * If the picker is activated, then allow the Escape key to deactivate the @@ -2261,7 +2261,7 @@ Toolbox.prototype = { // Stop the console from toggling. event.stopImmediatePropagation(); } - }, + } async _onPickerStarting() { if (this.isDestroying()) { @@ -2273,11 +2273,11 @@ Toolbox.prototype = { // turn off color picker when node picker is starting this.getPanel("inspector").hideEyeDropper(); this.on("select", this._onToolSelectedStopPicker); - }, + } async _onPickerStarted() { this.doc.addEventListener("keypress", this._onPickerKeypress, true); - }, + } _onPickerStopped() { if (this.isDestroying()) { @@ -2287,11 +2287,11 @@ Toolbox.prototype = { this.off("select", this._onToolSelectedStopPicker); this.doc.removeEventListener("keypress", this._onPickerKeypress, true); this.pickerButton.isChecked = false; - }, + } _onToolSelectedStopPicker() { this.nodePicker.stop({ canceled: true }); - }, + } /** * When the picker is canceled, make sure the toolbox @@ -2301,15 +2301,15 @@ Toolbox.prototype = { if (this.hostType !== Toolbox.HostType.WINDOW) { this.win.focus(); } - }, + } _onPickerPicked(nodeFront) { this.selection.setNodeFront(nodeFront, { reason: "picker-node-picked" }); - }, + } _onPickerPreviewed(nodeFront) { this.selection.setNodeFront(nodeFront, { reason: "picker-node-previewed" }); - }, + } /** * RDM sometimes simulates touch events. For this to work correctly at all times, it @@ -2329,7 +2329,7 @@ Toolbox.prototype = { const ui = ResponsiveUIManager.getResponsiveUIForTab(localTab); await ui.setElementPickerState(state, pickerType); - }, + } /** * The element picker button enables the ability to select a DOM node by clicking @@ -2349,14 +2349,14 @@ Toolbox.prototype = { }); return this.pickerButton; - }, + } _getPickerAdditionalClassName() { if (this.isDebugTargetFenix()) { return "remote-fenix"; } return null; - }, + } /** * Get the tooltip for the element picker button. @@ -2385,7 +2385,7 @@ Toolbox.prototype = { return isMac ? L10N.getFormatStr(label, shortcut, shortcutMac) : L10N.getFormatStr(label, shortcut); - }, + } async _listenAndApplyConfigurationPref() { this._onBooleanConfigurationPrefChange = @@ -2426,7 +2426,7 @@ Toolbox.prototype = { await this.commands.threadConfigurationCommand.updateConfiguration( threadConfiguration ); - }, + } /** * Called whenever a preference registered in BOOLEAN_CONFIGURATION_PREFS @@ -2451,7 +2451,7 @@ Toolbox.prototype = { // This event is only emitted for tests in order to know when the setting has been applied by the backend. this.emitForTests("new-configuration-applied", prefName); - }, + } /** * Update the visibility of the buttons. @@ -2461,7 +2461,7 @@ Toolbox.prototype = { button.isVisible = this._commandIsVisible(button); }); this.component.setToolboxButtons(this.toolbarButtons); - }, + } /** * Update the buttons. @@ -2478,7 +2478,7 @@ Toolbox.prototype = { inspectorFront.destroyHighlighters(); this.component.setToolboxButtons(this.toolbarButtons); } - }, + } /** * Visually update picker button. @@ -2499,7 +2499,7 @@ Toolbox.prototype = { button.className = this._getPickerAdditionalClassName(); button.disabled = null; } - }, + } /** * Update the visual state of the Frame picker button. @@ -2540,13 +2540,13 @@ Toolbox.prototype = { if (isVisible) { this.frameButton.isChecked = !selectedFrame.isTopLevel; } - }, + } updateErrorCountButton() { this.errorCountButton.isVisible = this._commandIsVisible(this.errorCountButton) && this._errorCount > 0; this.errorCountButton.errorCount = this._errorCount; - }, + } /** * Setup the _splitConsoleEnabled, reflecting the enabled/disabled state of the Enable Split @@ -2561,7 +2561,7 @@ Toolbox.prototype = { if (!this._splitConsoleEnabled && this.splitConsole) { this.closeSplitConsole(); } - }, + } /** * Ensure the visibility of each toolbox button matches the preference value. @@ -2582,7 +2582,7 @@ Toolbox.prototype = { } return true; - }, + } /** * Build a panel for a tool definition. @@ -2614,7 +2614,7 @@ Toolbox.prototype = { } deck.appendChild(panel); - }, + } /** * Lazily created map of the additional tools registered to this toolbox. @@ -2630,7 +2630,7 @@ Toolbox.prototype = { } return this._additionalToolDefinitions; - }, + } /** * Retrieve the array of the additional tools registered to this toolbox. @@ -2643,7 +2643,7 @@ Toolbox.prototype = { return Array.from(this.additionalToolDefinitions.values()); } return []; - }, + } /** * Get the additional tools that have been registered and are visible. @@ -2655,7 +2655,7 @@ Toolbox.prototype = { return this.visibleAdditionalTools.map(toolId => this.additionalToolDefinitions.get(toolId) ); - }, + } /** * Test the existence of a additional tools registered to this toolbox by tool id. @@ -2667,7 +2667,7 @@ Toolbox.prototype = { */ hasAdditionalTool(toolId) { return this.additionalToolDefinitions.has(toolId); - }, + } /** * Register and load an additional tool on this particular toolbox. @@ -2697,7 +2697,7 @@ Toolbox.prototype = { } else { this.once("ready", buildPanel); } - }, + } /** * Retrieve the registered inspector extension sidebars @@ -2705,7 +2705,7 @@ Toolbox.prototype = { */ get inspectorExtensionSidebars() { return this._inspectorExtensionSidebars; - }, + } /** * Register an extension sidebar for the inspector panel. @@ -2732,7 +2732,7 @@ Toolbox.prototype = { } inspector.addExtensionSidebar(id, options); - }, + } /** * Unregister an extension sidebar for the inspector panel. @@ -2763,7 +2763,7 @@ Toolbox.prototype = { const inspector = this.getPanel("inspector"); inspector.removeExtensionSidebar(id); - }, + } /** * Unregister and unload an additional tool from this particular toolbox. @@ -2788,7 +2788,7 @@ Toolbox.prototype = { id => id !== toolId ); this.unloadTool(toolId); - }, + } /** * Ensure the tool with the given id is loaded. @@ -2917,7 +2917,7 @@ Toolbox.prototype = { iframe.addEventListener("DOMContentLoaded", callback); } }); - }, + } /** * Set the dir attribute on the content document element of the provided iframe. @@ -2936,7 +2936,7 @@ Toolbox.prototype = { // Set the dir attribute value only if dir is already present on the document. docEl.setAttribute("dir", this.direction); } - }, + } /** * Mark all in collection as unselected; and id as selected @@ -2970,7 +2970,7 @@ Toolbox.prototype = { this.setIframeVisible(iframe, visible); } }); - }, + } /** * Make a privileged iframe visible/hidden. @@ -3019,7 +3019,7 @@ Toolbox.prototype = { // Fake the 'visibilitychange' event doc.dispatchEvent(new win.Event("visibilitychange")); - }, + } /** * Switch to the tool with the given id @@ -3096,7 +3096,7 @@ Toolbox.prototype = { this.emit(id + "-selected", panel); return panel; }); - }, + } _pingTelemetrySelectTool(id, reason) { const width = Math.ceil(this.win.outerWidth / 50) * 50; @@ -3160,7 +3160,7 @@ Toolbox.prototype = { } this.telemetry.toolOpened(id, this); - }, + } /** * Focus a tool's panel by id @@ -3176,7 +3176,7 @@ Toolbox.prototype = { } else { iframe.blur(); } - }, + } /** * Focus split console's input line @@ -3186,7 +3186,7 @@ Toolbox.prototype = { if (consolePanel) { consolePanel.focusInput(); } - }, + } /** * Disable all network logs in the console @@ -3196,7 +3196,7 @@ Toolbox.prototype = { if (consolePanel) { consolePanel.hud.ui.disableAllNetworkMessages(); } - }, + } /** * If the console is split and we are focusing an element outside @@ -3218,27 +3218,27 @@ Toolbox.prototype = { } this._lastFocusedElement = originalTarget; - }, + } // Report if the toolbox is currently focused, // or the focus in elsewhere in the browser or another app. - _isToolboxFocused: false, + _isToolboxFocused = false; _onFocus({ originalTarget }) { this._isToolboxFocused = true; this._debounceUpdateFocusedState(); this._updateLastFocusedElementForSplitConsole(originalTarget); - }, + } _onBlur() { this._isToolboxFocused = false; this._debounceUpdateFocusedState(); - }, + } _onTabsOrderUpdated() { this._combineAndSortPanelDefinitions(); - }, + } /** * Opens the split console. @@ -3282,7 +3282,7 @@ Toolbox.prototype = { this.focusConsoleInput(); } }); - }, + } /** * Closes the split console. @@ -3309,7 +3309,7 @@ Toolbox.prototype = { this._lastFocusedElement.focus(); } return Promise.resolve(); - }, + } /** * Toggles the split state of the webconsole. If the webconsole panel @@ -3326,7 +3326,7 @@ Toolbox.prototype = { } return Promise.resolve(); - }, + } /** * Toggles the options panel. @@ -3347,7 +3347,7 @@ Toolbox.prototype = { // preventDefault will avoid a Linux only bug when the focus is on a text input // See Bug 1519087. event.preventDefault(); - }, + } /** * Loads the tool next to the currently selected tool. @@ -3360,7 +3360,7 @@ Toolbox.prototype = { ? definitions[0] : definitions[index + 1]; return this.selectTool(definition.id, "select_next_key"); - }, + } /** * Loads the tool just left to the currently selected tool. @@ -3373,7 +3373,7 @@ Toolbox.prototype = { ? definitions[definitions.length - 1] : definitions[index - 1]; return this.selectTool(definition.id, "select_prev_key"); - }, + } /** * Tells if the given tool is currently highlighted. @@ -3384,7 +3384,7 @@ Toolbox.prototype = { */ isHighlighted(id) { return this.component.state.highlightedTools.has(id); - }, + } /** * Highlights the tool's tab if it is not the currently selected tool. @@ -3397,7 +3397,7 @@ Toolbox.prototype = { await this.isOpen; } this.component.highlightTool(id); - }, + } /** * De-highlights the tool's tab. @@ -3410,7 +3410,7 @@ Toolbox.prototype = { await this.isOpen; } this.component.unhighlightTool(id); - }, + } /** * Raise the toolbox host. @@ -3419,7 +3419,7 @@ Toolbox.prototype = { this.postMessage({ name: "raise-host" }); return this.once("host-raised"); - }, + } /** * Fired when user just started navigating away to another web page. @@ -3468,7 +3468,7 @@ Toolbox.prototype = { } const delay = this.win.performance.now() - start; Glean.devtools.toolboxPageReloadDelay[toolId].accumulateSingleSample(delay); - }, + } /** * Refresh the host's title. @@ -3521,7 +3521,7 @@ Toolbox.prototype = { name: "set-host-title", title, }); - }, + } /** * For a given URL, return its pathname. @@ -3541,7 +3541,7 @@ Toolbox.prototype = { return url; } return parsedURL.pathname; - }, + } /** * Returns an instance of the preference actor. This is a lazily initialized root @@ -3556,7 +3556,7 @@ Toolbox.prototype = { this.commands.client.mainRoot.getFront("preference"); } return this._preferenceFrontRequest; - }, + } /** * See: https://firefox-source-docs.mozilla.org/l10n/fluent/tutorial.html#manually-testing-ui-with-pseudolocalization @@ -3573,7 +3573,7 @@ Toolbox.prototype = { } this.component.setPseudoLocale(pseudoLocale); this._pseudoLocaleChanged = true; - }, + } /** * Returns the pseudo-locale when the target is browser chrome, otherwise undefined. @@ -3595,7 +3595,7 @@ Toolbox.prototype = { default: return "none"; } - }, + } async toggleNoAutohide() { const front = await this.preferenceFront; @@ -3611,7 +3611,7 @@ Toolbox.prototype = { this.component.setDisableAutohide(toggledValue); } this._autohideHasBeenToggled = true; - }, + } /** * Toggling "always on top" behavior is a bit special. @@ -3630,7 +3630,7 @@ Toolbox.prototype = { const addonId = this._descriptorFront.id; await this.destroy(); gDevTools.showToolboxForWebExtension(addonId); - }, + } async _isDisableAutohideEnabled() { if ( @@ -3642,7 +3642,7 @@ Toolbox.prototype = { const prefFront = await this.preferenceFront; return prefFront.getBoolPref(DISABLE_AUTOHIDE_PREF); - }, + } async _listFrames() { if ( @@ -3660,7 +3660,7 @@ Toolbox.prototype = { } catch (e) { console.error("Error while listing frames", e); } - }, + } /** * Called by the iframe picker when the user selected a frame. @@ -3688,7 +3688,7 @@ Toolbox.prototype = { // that was selected by the user. This will trigger this._onTargetSelected which will // take care of updating the iframe picker state. this.commands.targetCommand.selectTarget(frameInfo.targetFront); - }, + } /** * Highlight a frame in the page @@ -3718,7 +3718,7 @@ Toolbox.prototype = { } const highlighter = this.getHighlighter(); return highlighter.highlight(nodeFront); - }, + } /** * Handles changes in document frames. @@ -3835,7 +3835,7 @@ Toolbox.prototype = { } else { updateUiElements(); } - }, + } /** * Returns whether a root frame (with no parent frame) is selected. @@ -3848,14 +3848,14 @@ Toolbox.prototype = { } return this.frameMap.get(this.selectedFrameId).isTopLevel; - }, + } /** * Switch to the last used host for the toolbox UI. */ switchToPreviousHost() { return this.switchHost("previous"); - }, + } /** * Switch to a new host for the toolbox UI. E.g. bottom, sidebar, window, @@ -3887,7 +3887,7 @@ Toolbox.prototype = { }); return this.once("host-changed"); - }, + } /** * Request to Firefox UI to move the toolbox to another tab. @@ -3906,7 +3906,7 @@ Toolbox.prototype = { }); return this.once("switched-host-to-tab"); - }, + } _onSwitchedHost({ hostType }) { this._hostType = hostType; @@ -3926,7 +3926,7 @@ Toolbox.prototype = { ); this.component.setCurrentHostType(hostType); - }, + } /** * Event handler fired when the toolbox was moved to another tab. @@ -3947,7 +3947,7 @@ Toolbox.prototype = { this.commands.targetCommand.selectTarget(target); this.emit("switched-host-to-tab"); - }, + } /** * Test the availability of a tool (both globally registered tools and @@ -3962,7 +3962,7 @@ Toolbox.prototype = { */ isToolRegistered(toolId) { return !!this.getToolDefinition(toolId); - }, + } /** * Return the tool definition registered globally or additional tools registered @@ -3980,7 +3980,7 @@ Toolbox.prototype = { gDevTools.getToolDefinition(toolId) || this.additionalToolDefinitions.get(toolId) ); - }, + } /** * Internal helper that removes a loaded tool from the toolbox, @@ -4041,7 +4041,7 @@ Toolbox.prototype = { key.remove(); } } - }, + } /** * Handler for the tool-registered event. @@ -4072,7 +4072,7 @@ Toolbox.prototype = { // instead of gDevTools. this.emit("tool-registered", toolId); } - }, + } /** * Handler for the tool-unregistered event. @@ -4086,7 +4086,7 @@ Toolbox.prototype = { // Emit the event so tools can listen to it from the toolbox level // instead of gDevTools this.emit("tool-unregistered", toolId); - }, + } /** * A helper function that returns an object containing methods to show and hide the @@ -4199,7 +4199,7 @@ Toolbox.prototype = { return _waitForHighlighterEvent("highlighter-hidden"); }), }; - }, + } /** * Shortcut to avoid throwing errors when an async method fails after toolbox @@ -4208,7 +4208,7 @@ Toolbox.prototype = { */ _safeAsyncAfterDestroy(fn) { return safeAsyncMethod(fn, () => !!this._destroyer); - }, + } async _onNewSelectedNodeFront() { // Emit a "selection-changed" event when the toolbox.selection has been set @@ -4220,7 +4220,7 @@ Toolbox.prototype = { if (targetFrontActorID) { this.selectTarget(targetFrontActorID); } - }, + } _onToolSelected() { this._refreshHostTitle(); @@ -4231,14 +4231,14 @@ Toolbox.prototype = { // Calling setToolboxButtons in case the visibility of a button changed. this.component.setToolboxButtons(this.toolbarButtons); - }, + } /** * Listener for "inspectObject" event on console top level target actor. */ _onInspectObject(packet) { this.inspectObjectActor(packet.objectActor, packet.inspectFromAnnotation); - }, + } async inspectObjectActor(objectActor, inspectFromAnnotation) { const objectGrip = objectActor?.getGrip @@ -4274,7 +4274,7 @@ Toolbox.prototype = { const panel = this.getPanel("webconsole"); panel.hud.ui.inspectObjectActor(objectActor); } - }, + } /** * Get the toolbox's notification component @@ -4283,18 +4283,18 @@ Toolbox.prototype = { */ getNotificationBox() { return this.notificationBox; - }, + } async closeToolbox() { await this.destroy(); - }, + } /** * Public API to check is the current toolbox is currently being destroyed. */ isDestroying() { return this._destroyer; - }, + } /** * Remove all UI elements, detach from target and clear up @@ -4313,7 +4313,7 @@ Toolbox.prototype = { this._destroyToolbox().then(destroyerResolve); return this._destroyer; - }, + } async _destroyToolbox() { this.emit("destroy"); @@ -4549,7 +4549,7 @@ Toolbox.prototype = { await onceDestroyed; Services.obs.removeObserver(leakCheckObserver, topic); - }, + } /** * Open the textbox context menu at given coordinates. @@ -4567,14 +4567,14 @@ Toolbox.prototype = { menu.once("close", () => this.emit("menu-close")); menu.popup(x, y, this.doc); - }, + } /** * Retrieve the current textbox context menu, if available. */ getTextBoxContextMenu() { return this.topDoc.getElementById("toolbox-menu"); - }, + } /** * Reset preferences set by the toolbox. @@ -4599,7 +4599,7 @@ Toolbox.prototype = { if (this._pseudoLocaleChanged) { await preferenceFront.clearUserPref(PSEUDO_LOCALE_PREF); } - }, + } // HAR Automation @@ -4611,19 +4611,19 @@ Toolbox.prototype = { this.harAutomation = new HarAutomation(); await this.harAutomation.initialize(this); } - }, + } destroyHarAutomation() { if (this.harAutomation) { this.harAutomation.destroy(); } - }, + } /** * Returns gViewSourceUtils for viewing source. */ get gViewSourceUtils() { return this.win.gViewSourceUtils; - }, + } /** * Open a CSS file when there is no line or column information available. @@ -4640,7 +4640,7 @@ Toolbox.prototype = { // sources, so we have no choice but to open whichever original file // corresponds to the first line of the generated file. return viewSource.viewSourceInStyleEditor(this, url, 1); - }, + } /** * Given a URL for a stylesheet (generated or original), open in the style @@ -4665,7 +4665,7 @@ Toolbox.prototype = { } return viewSource.viewSourceInStyleEditor(this, url, line, column); - }, + } /** * Opens source in style editor. Falls back to plain "view-source:". @@ -4694,7 +4694,7 @@ Toolbox.prototype = { line, column ); - }, + } async viewElementInInspector(objectGrip, reason) { // Open the inspector and select the DOM Element. @@ -4704,7 +4704,7 @@ Toolbox.prototype = { if (nodeFound) { await this.selectTool("inspector", reason); } - }, + } /** * Open a JS file when there is no line or column information available. @@ -4718,7 +4718,7 @@ Toolbox.prototype = { } return viewSource.viewSourceInDebugger(this, url, null, null, null, null); - }, + } /** * Opens source in debugger, the sourcemapped location will be selected in @@ -4758,7 +4758,7 @@ Toolbox.prototype = { sourceId, reason ); - }, + } /** * Opens source in plain "view-source:". @@ -4767,7 +4767,7 @@ Toolbox.prototype = { */ viewSource(sourceURL, sourceLine, sourceColumn) { return viewSource.viewSource(this, sourceURL, sourceLine, sourceColumn); - }, + } // Support for WebExtensions API (`devtools.network.*`) @@ -4793,7 +4793,7 @@ Toolbox.prototype = { await this._netMonitorAPI.connect(this); return this._netMonitorAPI; - }, + } /** * Returns data (HAR) collected by the Network panel. @@ -4808,7 +4808,7 @@ Toolbox.prototype = { // Return the log directly to be compatible with // Chrome WebExtension API. return har.log; - }, + } /** * Add listener for `onRequestFinished` events. @@ -4821,7 +4821,7 @@ Toolbox.prototype = { async addRequestFinishedListener(listener) { const netMonitor = await this.getNetMonitorAPI(); netMonitor.addRequestFinishedListener(listener); - }, + } async removeRequestFinishedListener(listener) { const netMonitor = await this.getNetMonitorAPI(); @@ -4838,7 +4838,7 @@ Toolbox.prototype = { this._netMonitorAPI.destroy(); this._netMonitorAPI = null; } - }, + } /** * Used to lazily fetch HTTP response content within @@ -4851,7 +4851,7 @@ Toolbox.prototype = { async fetchResponseContent(requestId) { const netMonitor = await this.getNetMonitorAPI(); return netMonitor.fetchResponseContent(requestId); - }, + } // Support management of installed WebExtensions that provide a devtools_page. @@ -4869,7 +4869,7 @@ Toolbox.prototype = { return Array.from(this._webExtensions).map(([uuid, { name, pref }]) => { return { uuid, name, pref }; }); - }, + } /** * Add a WebExtension to the list of the active extensions (given the extension UUID, @@ -4885,7 +4885,7 @@ Toolbox.prototype = { // (and refresh its name if it was already listed). this._webExtensions.set(extensionUUID, { name, pref }); this.emit("webextension-registered", extensionUUID); - }, + } /** * Remove an active WebExtension from the list of the active extensions (given the @@ -4900,7 +4900,7 @@ Toolbox.prototype = { // is going to be removed from the toolbox options. this._webExtensions.delete(extensionUUID); this.emit("webextension-unregistered", extensionUUID); - }, + } /** * A helper function which returns true if the extension with the given UUID is listed @@ -4912,7 +4912,7 @@ Toolbox.prototype = { isWebExtensionEnabled(extensionUUID) { const extInfo = this._webExtensions.get(extensionUUID); return extInfo && Services.prefs.getBoolPref(extInfo.pref, false); - }, + } /** * Returns a panel id in the case of built in panels or "other" in the case of @@ -4936,7 +4936,7 @@ Toolbox.prototype = { } return id; - }, + } /** * Sets basic information on the DebugTargetInfo component @@ -4953,7 +4953,7 @@ Toolbox.prototype = { // DebugTargetInfo requires this._debugTargetData to be populated this.component.setDebugTargetData(this._getDebugTargetData()); } - }, + } _onResourceAvailable(resources) { let errors = this._errorCount || 0; @@ -5039,7 +5039,7 @@ Toolbox.prototype = { } this.setErrorCount(errors); - }, + } _onResourceUpdated(resources) { let errors = this._errorCount || 0; @@ -5057,7 +5057,7 @@ Toolbox.prototype = { } this.setErrorCount(errors); - }, + } /** * Set the number of errors in the toolbar icon. @@ -5075,5 +5075,7 @@ Toolbox.prototype = { // Update button properties and trigger a render of the toolbox this.updateErrorCountButton(); this._throttledSetToolboxButtons(); - }, -}; + } +} + +exports.Toolbox = Toolbox;