public JBCefClient addRequestHandler(@NotNull CefRequestHandler handler, @NotNull CefBrowser browser) {
    return myRequestHandler.add(handler, browser, () -> {
      myCefClient.addRequestHandler(new CefRequestHandler() {
        @Override
        public boolean onBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, boolean user_gesture, boolean is_redirect) {
          return myRequestHandler.handleBooleanReturnAnyOf(browser, handler -> {
            return handler.onBeforeBrowse(browser, frame, request, user_gesture, is_redirect);
          });
        }

        @Override
        public boolean onOpenURLFromTab(CefBrowser browser, CefFrame frame, String target_url, boolean user_gesture) {
          return myRequestHandler.handleBooleanReturnAnyOf(browser, handler -> {
            return handler.onOpenURLFromTab(browser, frame, target_url, user_gesture);
          });
        }

        @Override
        public @Nullable CefResourceRequestHandler getResourceRequestHandler(CefBrowser browser,
                                                                             CefFrame frame,
                                                                             CefRequest request,
                                                                             boolean isNavigation,
                                                                             boolean isDownload,
                                                                             String requestInitiator,
                                                                             BoolRef disableDefaultHandling)
        {
          return myRequestHandler.handleFirst(browser, handler -> {
            return handler.getResourceRequestHandler(browser, frame, request, isNavigation, isDownload, requestInitiator, disableDefaultHandling);
          });
        }

        @Override
        public boolean getAuthCredentials(CefBrowser browser,
                                          String origin_url,
                                          boolean isProxy,
                                          String host,
                                          int port,
                                          String realm,
                                          String scheme,
                                          CefAuthCallback callback)
        {
          return myRequestHandler.handleBooleanFirst(browser, handler -> {
            return handler.getAuthCredentials(browser, origin_url, isProxy, host, port, realm, scheme, callback);
          });
        }

        @Override
        public boolean onCertificateError(CefBrowser browser,
                                          CefLoadHandler.ErrorCode cert_error,
                                          String request_url,
                                          CefSSLInfo sslInfo,
                                          CefCallback callback) {
          List<CefRequestHandler> handlers = myRequestHandler.get(browser);
          if (handlers == null) {
            return false;
          }

          boolean result = false;
          for (CefRequestHandler handler: handlers) {
            result |= handler.onCertificateError(browser, cert_error, request_url, sslInfo, callback);
          }

          return result;
        }

        @Override
        public void onRenderProcessTerminated(CefBrowser browser, TerminationStatus status) {
          myRequestHandler.handleAll(browser, handler -> {
            handler.onRenderProcessTerminated(browser, status);
          });
        }
      });
    });
  }
public JBCefClient addRequestHandler(@NotNull CefRequestHandler handler, @NotNull CefBrowser browser)