@@ -22,7 +22,6 @@ public class HarCaptureManager {
2222
2323 private final AddonsManagerClient addonsManagerClient ;
2424 private final MitmProxyProcessManager mitmProxyManager ;
25- private Har lastHar = new Har ();
2625 private EnumSet <CaptureType > lastCaptureTypes = EnumSet .noneOf (CaptureType .class );
2726
2827 public HarCaptureManager (AddonsManagerClient addonsManagerClient , MitmProxyProcessManager mitmProxyManager ) {
@@ -35,11 +34,7 @@ public Har getHar() {
3534 }
3635
3736 public Har getHar (Boolean cleanHar ) {
38- if (!mitmProxyManager .isRunning ()) return lastHar ;
39-
40- if (cleanHar ) {
41- this .lastHar = null ;
42- }
37+ if (!mitmProxyManager .isRunning ()) return null ;
4338
4439 HarResponse response = addonsManagerClient .
4540 getRequestToAddonsManager (
@@ -62,7 +57,7 @@ public Har newHar(String pageRef) {
6257 }
6358
6459 public Har newHar (String pageRef , String pageTitle ) {
65- if (!mitmProxyManager .isRunning ()) return lastHar ;
60+ if (!mitmProxyManager .isRunning ()) return null ;
6661
6762 HarResponse response = addonsManagerClient .
6863 getRequestToAddonsManager (
@@ -77,7 +72,7 @@ public Har newHar(String pageRef, String pageTitle) {
7772 }
7873
7974 public Har endHar () {
80- if (!mitmProxyManager .isRunning ()) return lastHar ;
75+ if (!mitmProxyManager .isRunning ()) return null ;
8176
8277 HarResponse response = addonsManagerClient .
8378 getRequestToAddonsManager (
@@ -97,7 +92,7 @@ public Har newPage(String pageRef) {
9792 }
9893
9994 public Har newPage (String pageRef , String pageTitle ) {
100- if (!mitmProxyManager .isRunning ()) return lastHar ;
95+ if (!mitmProxyManager .isRunning ()) return null ;
10196
10297 HarResponse response = addonsManagerClient .
10398 getRequestToAddonsManager (
@@ -131,7 +126,6 @@ private Har parseHar(String filePath) {
131126 } catch (IOException e ) {
132127 throw new RuntimeException ("Couldn't read HAR file: " + harFile .getAbsolutePath (), e );
133128 }
134- lastHar = har ;
135129 return har ;
136130 }
137131
0 commit comments