protected void dispose(@Nullable Runnable subDisposer) {
    myDisposeHelper.dispose(() -> {
      if (subDisposer != null) subDisposer.run();

      if (myLoadHandler != null) getJBCefClient().removeLoadHandler(myLoadHandler, getCefBrowser());
      if (myRequestHandler != null) getJBCefClient().removeRequestHandler(myRequestHandler, getCefBrowser());
      if (myHrefProcessingRequestHandler != null) getJBCefClient().removeRequestHandler(myHrefProcessingRequestHandler, getCefBrowser());
      if (myContextMenuHandler != null) getJBCefClient().removeContextMenuHandler(myContextMenuHandler, getCefBrowser());
      // There is also a CefLifeSpanHandler(see the class constructor) that has to remove himself at onBeforeClose()

      CertificateManager.getInstance().getCustomTrustManager().removeListener(myCertificateListener);

      myCefBrowser.stopLoad();
      myCefBrowser.setCloseAllowed();
      myCefBrowser.close(true);

      if (myDefaultCefClient) Disposer.dispose(myCefClient);

      myCefClient.removeKeyboardHandler(myKeyboardHandler, myCefBrowser);
    });
  }
protected void dispose(@Nullable Runnable subDisposer)