commit 0eda506bb8b06788ec88a2fd880672cef950728f
parent 1432c0f4decb87666b8610cf2c78190d3a87f9ff
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 15 Dec 2025 14:18:13 +0000
Bug 2004248 - [devtools] Turn devtools/client/styleeditor/panel.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D276401
Diffstat:
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/devtools/client/styleeditor/panel.js b/devtools/client/styleeditor/panel.js
@@ -13,23 +13,20 @@ var { getString } = ChromeUtils.importESModule(
"resource://devtools/client/styleeditor/StyleEditorUtil.sys.mjs"
);
-var StyleEditorPanel = function StyleEditorPanel(panelWin, toolbox, commands) {
- EventEmitter.decorate(this);
+class StyleEditorPanel extends EventEmitter {
+ constructor(panelWin, toolbox, commands) {
+ super();
- this._toolbox = toolbox;
- this._commands = commands;
- this._panelWin = panelWin;
- this._panelDoc = panelWin.document;
+ this._toolbox = toolbox;
+ this._commands = commands;
+ this._panelWin = panelWin;
+ this._panelDoc = panelWin.document;
- this._showError = this._showError.bind(this);
-};
-
-exports.StyleEditorPanel = StyleEditorPanel;
-
-StyleEditorPanel.prototype = {
+ this._showError = this._showError.bind(this);
+ }
get panelWindow() {
return this._panelWin;
- },
+ }
/**
* open is effectively an asynchronous constructor
@@ -51,7 +48,7 @@ StyleEditorPanel.prototype = {
await this.UI.initialize(options);
return this;
- },
+ }
/**
* Show an error message from the style editor in the toolbox
@@ -90,7 +87,7 @@ StyleEditorPanel.prototype = {
level
);
}
- },
+ }
/**
* Select a stylesheet.
@@ -111,7 +108,7 @@ StyleEditorPanel.prototype = {
}
return this.UI.selectStyleSheet(stylesheet, line - 1, col ? col - 1 : 0);
- },
+ }
/**
* Given a location in an original file, open that file in the editor.
@@ -133,7 +130,7 @@ StyleEditorPanel.prototype = {
const originalSheet = this.UI.getOriginalSourceSheet(originalId);
return this.UI.selectStyleSheet(originalSheet, line - 1, col ? col - 1 : 0);
- },
+ }
getStylesheetResourceForGeneratedURL(url) {
if (!this.UI) {
@@ -141,7 +138,7 @@ StyleEditorPanel.prototype = {
}
return this.UI.getStylesheetResourceForGeneratedURL(url);
- },
+ }
/**
* Destroy the style editor.
@@ -158,8 +155,10 @@ StyleEditorPanel.prototype = {
this.UI.destroy();
this.UI = null;
- },
-};
+ }
+}
+
+exports.StyleEditorPanel = StyleEditorPanel;
ChromeUtils.defineLazyGetter(
StyleEditorPanel.prototype,