Skip to content

Commit ef6691d

Browse files
committed
copy har options
1 parent 5f0e4ef commit ef6691d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

playwright/src/main/java/com/microsoft/playwright/impl/BrowserImpl.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,14 @@ private BrowserContextImpl newContextImpl(NewContextOptions options) {
124124
// Make a copy so that we can nullify some fields below.
125125
options = convertType(options, NewContextOptions.class);
126126
}
127-
Object recordHarUrlFilter = options.recordHarUrlFilter;
127+
128+
NewContextOptions harOptions = Utils.clone(options);
129+
options.recordHarContent = null;
130+
options.recordHarMode = null;
131+
options.recordHarPath = null;
132+
options.recordHarOmitContent = null;
128133
options.recordHarUrlFilter = null;
134+
129135
if (options.storageStatePath != null) {
130136
try {
131137
byte[] bytes = Files.readAllBytes(options.storageStatePath);
@@ -179,8 +185,7 @@ private BrowserContextImpl newContextImpl(NewContextOptions options) {
179185
if (options.baseURL != null) {
180186
context.setBaseUrl(options.baseURL);
181187
}
182-
options.recordHarUrlFilter = recordHarUrlFilter;
183-
context.initializeHarFromOptions(options);
188+
context.initializeHarFromOptions(harOptions);
184189
return context;
185190
}
186191

0 commit comments

Comments
 (0)