@@ -275,7 +275,7 @@ public CDPSession newCDPSession(Frame frame) {
275275
276276 @ Override
277277 public void close (CloseOptions options ) {
278- withLogging ( "BrowserContext.close" , () -> closeImpl (options ) );
278+ closeImpl (options );
279279 }
280280
281281 @ Override
@@ -320,28 +320,24 @@ private void closeImpl(CloseOptions options) {
320320
321321 @ Override
322322 public void addCookies (List <Cookie > cookies ) {
323- withLogging ("BrowserContext.addCookies" , () -> {
324- JsonObject params = new JsonObject ();
325- params .add ("cookies" , gson ().toJsonTree (cookies ));
326- sendMessage ("addCookies" , params );
327- });
323+ JsonObject params = new JsonObject ();
324+ params .add ("cookies" , gson ().toJsonTree (cookies ));
325+ sendMessage ("addCookies" , params );
328326 }
329327
330328 @ Override
331329 public void addInitScript (String script ) {
332- withLogging ( "BrowserContext.addInitScript" , () -> addInitScriptImpl (script ) );
330+ addInitScriptImpl (script );
333331 }
334332
335333 @ Override
336334 public void addInitScript (Path path ) {
337- withLogging ("BrowserContext.addInitScript" , () -> {
338- try {
339- byte [] bytes = readAllBytes (path );
340- addInitScriptImpl (new String (bytes , UTF_8 ));
341- } catch (IOException e ) {
342- throw new PlaywrightException ("Failed to read script from file" , e );
343- }
344- });
335+ try {
336+ byte [] bytes = readAllBytes (path );
337+ addInitScriptImpl (new String (bytes , UTF_8 ));
338+ } catch (IOException e ) {
339+ throw new PlaywrightException ("Failed to read script from file" , e );
340+ }
345341 }
346342
347343 @ Override
@@ -362,7 +358,7 @@ public BrowserImpl browser() {
362358
363359 @ Override
364360 public void clearCookies (ClearCookiesOptions options ) {
365- withLogging ( "BrowserContext.clearCookies" , () -> clearCookiesImpl (options ) );
361+ clearCookiesImpl (options );
366362 }
367363
368364 private void clearCookiesImpl (ClearCookiesOptions options ) {
@@ -388,12 +384,12 @@ private static void setStringOrRegex(JsonObject params, String name, Object valu
388384
389385 @ Override
390386 public void clearPermissions () {
391- withLogging ( "BrowserContext.clearPermissions" , () -> sendMessage ("clearPermissions" ) );
387+ sendMessage ("clearPermissions" );
392388 }
393389
394390 @ Override
395391 public List <Cookie > cookies (List <String > urls ) {
396- return withLogging ( "BrowserContext.cookies" , () -> cookiesImpl (urls ) );
392+ return cookiesImpl (urls );
397393 }
398394
399395 private List <Cookie > cookiesImpl (List <String > urls ) {
@@ -409,7 +405,7 @@ private List<Cookie> cookiesImpl(List<String> urls) {
409405
410406 @ Override
411407 public void exposeBinding (String name , BindingCallback playwrightBinding , ExposeBindingOptions options ) {
412- withLogging ( "BrowserContext.exposeBinding" , () -> exposeBindingImpl (name , playwrightBinding , options ) );
408+ exposeBindingImpl (name , playwrightBinding , options );
413409 }
414410
415411 private void exposeBindingImpl (String name , BindingCallback playwrightBinding , ExposeBindingOptions options ) {
@@ -433,13 +429,12 @@ private void exposeBindingImpl(String name, BindingCallback playwrightBinding, E
433429
434430 @ Override
435431 public void exposeFunction (String name , FunctionCallback playwrightFunction ) {
436- withLogging ("BrowserContext.exposeFunction" ,
437- () -> exposeBindingImpl (name , (BindingCallback .Source source , Object ... args ) -> playwrightFunction .call (args ), null ));
432+ exposeBindingImpl (name , (BindingCallback .Source source , Object ... args ) -> playwrightFunction .call (args ), null );
438433 }
439434
440435 @ Override
441436 public void grantPermissions (List <String > permissions , GrantPermissionsOptions options ) {
442- withLogging ( "BrowserContext.grantPermissions" , () -> grantPermissionsImpl (permissions , options ) );
437+ grantPermissionsImpl (permissions , options );
443438 }
444439
445440 private void grantPermissionsImpl (List <String > permissions , GrantPermissionsOptions options ) {
@@ -456,7 +451,7 @@ private void grantPermissionsImpl(List<String> permissions, GrantPermissionsOpti
456451
457452 @ Override
458453 public PageImpl newPage () {
459- return withLogging ( "BrowserContext.newPage" , () -> newPageImpl () );
454+ return newPageImpl ();
460455 }
461456
462457 private PageImpl newPageImpl () {
@@ -508,10 +503,8 @@ public void routeFromHAR(Path har, RouteFromHAROptions options) {
508503 }
509504
510505 private void route (UrlMatcher matcher , Consumer <Route > handler , RouteOptions options ) {
511- withLogging ("BrowserContext.route" , () -> {
512- routes .add (matcher , handler , options == null ? null : options .times );
513- updateInterceptionPatterns ();
514- });
506+ routes .add (matcher , handler , options == null ? null : options .times );
507+ updateInterceptionPatterns ();
515508 }
516509
517510 @ Override
@@ -530,10 +523,8 @@ public void routeWebSocket(Predicate<String> predicate, Consumer<WebSocketRoute>
530523 }
531524
532525 private void routeWebSocketImpl (UrlMatcher matcher , Consumer <WebSocketRoute > handler ) {
533- withLogging ("BrowserContext.routeWebSocket" , () -> {
534- webSocketRoutes .add (matcher , handler );
535- updateWebSocketInterceptionPatterns ();
536- });
526+ webSocketRoutes .add (matcher , handler );
527+ updateWebSocketInterceptionPatterns ();
537528 }
538529
539530 void recordIntoHar (PageImpl page , Path har , RouteFromHAROptions options , HarContentPolicy contentPolicy ) {
@@ -572,43 +563,37 @@ public void setDefaultTimeout(double timeout) {
572563
573564 @ Override
574565 public void setExtraHTTPHeaders (Map <String , String > headers ) {
575- withLogging ("BrowserContext.setExtraHTTPHeaders" , () -> {
576- JsonObject params = new JsonObject ();
577- JsonArray jsonHeaders = new JsonArray ();
578- for (Map .Entry <String , String > e : headers .entrySet ()) {
579- JsonObject header = new JsonObject ();
580- header .addProperty ("name" , e .getKey ());
581- header .addProperty ("value" , e .getValue ());
582- jsonHeaders .add (header );
583- }
584- params .add ("headers" , jsonHeaders );
585- sendMessage ("setExtraHTTPHeaders" , params );
586- });
566+ JsonObject params = new JsonObject ();
567+ JsonArray jsonHeaders = new JsonArray ();
568+ for (Map .Entry <String , String > e : headers .entrySet ()) {
569+ JsonObject header = new JsonObject ();
570+ header .addProperty ("name" , e .getKey ());
571+ header .addProperty ("value" , e .getValue ());
572+ jsonHeaders .add (header );
573+ }
574+ params .add ("headers" , jsonHeaders );
575+ sendMessage ("setExtraHTTPHeaders" , params );
587576 }
588577
589578 @ Override
590579 public void setGeolocation (Geolocation geolocation ) {
591- withLogging ("BrowserContext.setGeolocation" , () -> {
592- JsonObject params = new JsonObject ();
593- if (geolocation != null ) {
594- params .add ("geolocation" , gson ().toJsonTree (geolocation ));
595- }
596- sendMessage ("setGeolocation" , params );
597- });
580+ JsonObject params = new JsonObject ();
581+ if (geolocation != null ) {
582+ params .add ("geolocation" , gson ().toJsonTree (geolocation ));
583+ }
584+ sendMessage ("setGeolocation" , params );
598585 }
599586
600587 @ Override
601588 public void setOffline (boolean offline ) {
602- withLogging ("BrowserContext.setOffline" , () -> {
603- JsonObject params = new JsonObject ();
604- params .addProperty ("offline" , offline );
605- sendMessage ("setOffline" , params );
606- });
589+ JsonObject params = new JsonObject ();
590+ params .addProperty ("offline" , offline );
591+ sendMessage ("setOffline" , params );
607592 }
608593
609594 @ Override
610595 public String storageState (StorageStateOptions options ) {
611- return withLogging ( "BrowserContext.storageState" , () -> storageStateImpl (options ) );
596+ return storageStateImpl (options );
612597 }
613598
614599 private String storageStateImpl (StorageStateOptions options ) {
@@ -633,10 +618,8 @@ public TracingImpl tracing() {
633618
634619 @ Override
635620 public void unrouteAll () {
636- withLogging ("BrowserContext.unrouteAll" , () -> {
637- routes .removeAll ();
638- updateInterceptionPatterns ();
639- });
621+ routes .removeAll ();
622+ updateInterceptionPatterns ();
640623 }
641624
642625 @ Override
@@ -687,10 +670,8 @@ public R get() {
687670 }
688671
689672 private void unroute (UrlMatcher matcher , Consumer <Route > handler ) {
690- withLogging ("BrowserContext.unroute" , () -> {
691- routes .remove (matcher , handler );
692- updateInterceptionPatterns ();
693- });
673+ routes .remove (matcher , handler );
674+ updateInterceptionPatterns ();
694675 }
695676
696677 private void updateInterceptionPatterns () {
0 commit comments