commit f37efeb9fd346125bfc98d132ae0dea48a1e2584
parent adc6752ca16cba356b00fe9fcac8a80620c83f74
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Tue, 16 Dec 2025 15:45:43 +0000
Bug 2004247 - [devtools] Turn devtools/client/webconsole/panel.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D276547
Diffstat:
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/devtools/client/webconsole/panel.js b/devtools/client/webconsole/panel.js
@@ -9,25 +9,21 @@ loader.lazyRequireGetter(
"WebConsole",
"resource://devtools/client/webconsole/webconsole.js"
);
-loader.lazyGetter(this, "EventEmitter", () =>
- require("resource://devtools/shared/event-emitter.js")
-);
+const EventEmitter = require("resource://devtools/shared/event-emitter.js");
/**
* A DevToolPanel that controls the Web Console.
*/
-function WebConsolePanel(iframeWindow, toolbox, commands) {
- this._frameWindow = iframeWindow;
- this._toolbox = toolbox;
- this._commands = commands;
- EventEmitter.decorate(this);
-}
-
-exports.WebConsolePanel = WebConsolePanel;
+class WebConsolePanel extends EventEmitter {
+ constructor(iframeWindow, toolbox, commands) {
+ super();
-WebConsolePanel.prototype = {
- hud: null,
+ this._frameWindow = iframeWindow;
+ this._toolbox = toolbox;
+ this._commands = commands;
+ }
+ hud = null;
/**
* Called by the WebConsole's onkey command handler.
* If the WebConsole is opened, check if the JSTerm's input line has focus.
@@ -35,7 +31,7 @@ WebConsolePanel.prototype = {
*/
focusInput() {
this.hud.jsterm.focus();
- },
+ }
/**
* Open is effectively an asynchronous constructor.
@@ -86,11 +82,11 @@ WebConsolePanel.prototype = {
}
return this;
- },
+ }
get currentTarget() {
return this._toolbox.target;
- },
+ }
destroy() {
if (!this._toolbox) {
@@ -101,5 +97,7 @@ WebConsolePanel.prototype = {
this._frameWindow = null;
this._toolbox = null;
this.emit("destroyed");
- },
-};
+ }
+}
+
+exports.WebConsolePanel = WebConsolePanel;