commit 41ac6522ff08f93a2de46495a673d7fa22e24520
parent 0dd5c768d05ff2b05d20ef3702d853f72dfb4e0f
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 15 Dec 2025 13:02:10 +0000
Bug 2004249 - [devtools] Turn devtools/client/styleeditor/original-source.js into an ES class. r=devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D276400
Diffstat:
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/devtools/client/styleeditor/original-source.js b/devtools/client/styleeditor/original-source.js
@@ -8,37 +8,37 @@
* An object of this type represents an original source for the style
* editor. An "original" source is one that is mentioned in a source
* map.
- *
- * @param {string} url
- * The URL of the original source.
- * @param {string} sourceID
- * The source ID of the original source, as used by the source
- * map service.
- * @param {SourceMapLoader} sourceMapLoader
- * The source map loader; @see Toolbox.sourceMapLoader
*/
-function OriginalSource(url, sourceId, sourceMapLoader) {
- this.isOriginalSource = true;
-
- this._url = url;
- this._sourceId = sourceId;
- this._sourceMapLoader = sourceMapLoader;
-}
+class OriginalSource {
+ /**
+ * @param {string} url
+ * The URL of the original source.
+ * @param {string} sourceID
+ * The source ID of the original source, as used by the source
+ * map service.
+ * @param {SourceMapLoader} sourceMapLoader
+ * The source map loader; @see Toolbox.sourceMapLoader
+ */
+ constructor(url, sourceId, sourceMapLoader) {
+ this.isOriginalSource = true;
-OriginalSource.prototype = {
+ this._url = url;
+ this._sourceId = sourceId;
+ this._sourceMapLoader = sourceMapLoader;
+ }
get sourceId() {
return this._sourceId;
- },
+ }
/** Get the original source's URL. */
get url() {
return this._url;
- },
+ }
/** Get the original source's URL. */
get href() {
return this._url;
- },
+ }
/**
* Return a promise that will resolve to the original source's full
@@ -59,7 +59,7 @@ OriginalSource.prototype = {
});
}
return this._sourcePromise;
- },
+ }
/**
* Given a source-mapped, generated style sheet, a line, and a
@@ -93,11 +93,11 @@ OriginalSource.prototype = {
location.styleSheet = relatedSheet;
return location;
});
- },
+ }
// Dummy implementations, as we never emit an event.
- on() {},
- off() {},
-};
+ on() {}
+ off() {}
+}
exports.OriginalSource = OriginalSource;