commit a3e6405e2ff31550c5302dd2b1b013af863a7718
parent d74feb639f8b9fe0cc4b8ae9e4066c0969668775
Author: Lorenz A <me@lorenzackermann.xyz>
Date: Mon, 15 Dec 2025 13:41:51 +0000
Bug 2004267 - [devtools] Turn devtools/client/netmonitor/src/har/har-automation.js into an ES class. r=devtools-reviewers,bomsy
Differential Revision: https://phabricator.services.mozilla.com/D276316
Diffstat:
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/devtools/client/netmonitor/src/har/har-automation.js b/devtools/client/netmonitor/src/har/har-automation.js
@@ -38,9 +38,7 @@ const trace = {
* If the default log directory preference isn't set the following
* directory is used by default: <profile>/har/logs
*/
-function HarAutomation() {}
-
-HarAutomation.prototype = {
+class HarAutomation {
// Initialization
async initialize(toolbox) {
@@ -48,7 +46,7 @@ HarAutomation.prototype = {
this.commands = toolbox.commands;
await this.startMonitoring();
- },
+ }
destroy() {
if (this.collector) {
@@ -58,7 +56,7 @@ HarAutomation.prototype = {
if (this.tabWatcher) {
this.tabWatcher.disconnect();
}
- },
+ }
// Automation
@@ -86,11 +84,11 @@ HarAutomation.prototype = {
ignoreExistingResources: true,
}
);
- },
+ }
pageLoadBegin() {
this.resetCollector();
- },
+ }
resetCollector() {
if (this.collector) {
@@ -104,7 +102,7 @@ HarAutomation.prototype = {
});
this.collector.start();
- },
+ }
/**
* A page is done loading, export collected data. Note that
@@ -124,7 +122,7 @@ HarAutomation.prototype = {
return this.autoExport();
});
}
- },
+ }
autoExport() {
const autoExport = Services.prefs.getBoolPref(
@@ -142,7 +140,7 @@ HarAutomation.prototype = {
};
return this.executeExport(data);
- },
+ }
// Public API
@@ -157,14 +155,14 @@ HarAutomation.prototype = {
}
return this.executeExport(data);
- },
+ }
/**
* Clear currently collected data.
*/
clear() {
this.resetCollector();
- },
+ }
// HAR Export
@@ -210,7 +208,7 @@ HarAutomation.prototype = {
}
return jsonString;
- },
+ }
/**
* Fetches the full text of a string.
@@ -221,8 +219,8 @@ HarAutomation.prototype = {
stringGrip
);
return fullText;
- },
-};
+ }
+}
// Protocol Helpers