commit 47c0f0177cf347b315dc8c0acaaa5a92ee56555c
parent 4d16e06cfed8046bd749186d379a95865a54a5a6
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Thu, 11 Dec 2025 07:19:37 +0000
Bug 2004244 - [devtools] Turn devtools/server/actors/webconsole/listeners/console-file-activity.js into an ES class. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D275891
Diffstat:
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/devtools/server/actors/webconsole/listeners/console-file-activity.js b/devtools/server/actors/webconsole/listeners/console-file-activity.js
@@ -6,35 +6,34 @@
/**
* A WebProgressListener that listens for file loads.
- *
- * @constructor
- * @param object window
- * The window for which we need to track file loads.
- * @param object owner
- * The listener owner which needs to implement:
- * - onFileActivity(aFileURI)
*/
-function ConsoleFileActivityListener(window, owner) {
- this.window = window;
- this.owner = owner;
-}
-exports.ConsoleFileActivityListener = ConsoleFileActivityListener;
+class ConsoleFileActivityListener {
+ /**
+ * @param {object} window
+ * The window for which we need to track file loads.
+ * @param {object} owner
+ * The listener owner which needs to implement:
+ * - onFileActivity(aFileURI)
+ */
+ constructor(window, owner) {
+ this.window = window;
+ this.owner = owner;
+ }
-ConsoleFileActivityListener.prototype = {
/**
* Tells if the console progress listener is initialized or not.
*
* @private
* @type boolean
*/
- _initialized: false,
+ _initialized = false;
- _webProgress: null,
+ _webProgress = null;
- QueryInterface: ChromeUtils.generateQI([
+ QueryInterface = ChromeUtils.generateQI([
"nsIWebProgressListener",
"nsISupportsWeakReference",
- ]),
+ ]);
/**
* Initialize the ConsoleFileActivityListener.
@@ -53,7 +52,7 @@ ConsoleFileActivityListener.prototype = {
);
this._initialized = true;
- },
+ }
/**
* Start a monitor/tracker related to the current nsIWebProgressListener
@@ -61,14 +60,14 @@ ConsoleFileActivityListener.prototype = {
*/
startMonitor() {
this._init();
- },
+ }
/**
* Stop monitoring.
*/
stopMonitor() {
this.destroy();
- },
+ }
onStateChange(progress, request, state, status) {
if (!this.owner) {
@@ -76,7 +75,7 @@ ConsoleFileActivityListener.prototype = {
}
this._checkFileActivity(progress, request, state, status);
- },
+ }
/**
* Check if there is any file load, given the arguments of
@@ -104,7 +103,7 @@ ConsoleFileActivityListener.prototype = {
}
this.owner.onFileActivity(uri.spec);
- },
+ }
/**
* Destroy the ConsoleFileActivityListener.
@@ -125,5 +124,7 @@ ConsoleFileActivityListener.prototype = {
this._webProgress = null;
this.window = null;
this.owner = null;
- },
-};
+ }
+}
+
+exports.ConsoleFileActivityListener = ConsoleFileActivityListener;