Skip to content

Commit cf7123a

Browse files
committed
Properly clean up also the HAR collector
1 parent 3083a7a commit cf7123a

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

lib/trigger-toolbox-overlay.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ const TriggerToolboxOverlay = Class(
7272

7373
Trace.sysout("TriggerToolboxOverlay.onReady;", options);
7474

75+
// Platform support is needed here.
76+
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1184889
77+
if (typeof getHarOverlay != "function") {
78+
Cu.reportError("Platform support needed, see Bug: " +
79+
"https://bugzilla.mozilla.org/show_bug.cgi?id=1184889");
80+
return;
81+
}
82+
7583
let autoExportToFile = Services.prefs.getBoolPref(
7684
"devtools.netmonitor.har.enableAutoExportToFile");
7785

@@ -150,21 +158,7 @@ const TriggerToolboxOverlay = Class(
150158
triggerExport: function(data) {
151159
Trace.sysout("TriggerToolboxOverlay.triggerExport;", data);
152160

153-
// Platform support is needed here.
154-
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1184889
155-
if (typeof getHarOverlay != "function") {
156-
Cu.reportError("Platform support needed, see Bug: " +
157-
"https://bugzilla.mozilla.org/show_bug.cgi?id=1184889");
158-
return;
159-
}
160-
161161
var harOverlay = getHarOverlay(this.toolbox);
162-
if (!harOverlay) {
163-
Trace.sysout("TriggerToolboxOverlay.triggerExport; ERROR " +
164-
"no HAR overlay!", data);
165-
return;
166-
}
167-
168162
if (!harOverlay.automation) {
169163
let pref1 = "devtools.netmonitor.har.enableAutoExportToFile";
170164
let pref2 = "extensions.netmonitor.har.enableAutomation";
@@ -208,7 +202,12 @@ const TriggerToolboxOverlay = Class(
208202
clear: function() {
209203
let panel = this.toolbox.getPanel("netmonitor");
210204

211-
// Clear the Network panel content if it exists.
205+
// Clean up also the HAR collector.
206+
var harOverlay = getHarOverlay(this.toolbox);
207+
harOverlay.automation.resetCollector();
208+
209+
// Clear the Network panel content. The panel doesn't
210+
// have to exist if the user doesn't select it yet.
212211
if (panel) {
213212
let view = panel.panelWin.NetMonitorView;
214213
view.RequestsMenu.clear();

0 commit comments

Comments
 (0)