@@ -72,9 +72,23 @@ const TriggerToolboxOverlay = Class(
7272
7373 Trace . sysout ( "TriggerToolboxOverlay.onReady;" , options ) ;
7474
75+ let autoExportToFile = Services . prefs . getBoolPref (
76+ "devtools.netmonitor.har.enableAutoExportToFile" ) ;
77+
7578 // Call make remote to make sure the target.client exists.
7679 let target = this . toolbox . target ;
7780 target . makeRemote ( ) . then ( ( ) => {
81+ // The 'devtools.netmonitor.har.enableAutoExportToFile' option doesn't
82+ // have to be set if users don't want to auto export to file after
83+ // every page load.
84+ // But, if users want to use HAR content API to trigger HAR export
85+ // when needed, HAR automation needs to be activated. Let's do it now
86+ // if 'extensions.netmonitor.har.enableAutomation' preference is true.
87+ if ( prefs . enableAutomation && ! autoExportToFile ) {
88+ let harOverlay = getHarOverlay ( this . toolbox ) ;
89+ harOverlay . initAutomation ( ) ;
90+ }
91+
7892 this . attach ( ) . then ( front => {
7993 Trace . sysout ( "TriggerToolboxOverlay.onReady; HAR driver ready!" ) ;
8094 } ) ;
@@ -166,8 +180,9 @@ const TriggerToolboxOverlay = Class(
166180 return ;
167181 }
168182
169- // Trigger HAR export now!
170- harOverlay . automation . triggerExport ( data ) . then ( jsonString => {
183+ // Trigger HAR export now! Use executeExport() not triggerExport()
184+ // since we don't want to have the default name automatically provided.
185+ harOverlay . automation . executeExport ( data ) . then ( jsonString => {
171186 Trace . sysout ( "TriggerToolboxOverlay.triggerExport; DONE" , jsonString ) ;
172187
173188 // Send event back to the backend notifying that it has
0 commit comments