void (@NotNull JBCefBrowserBase browser, @NotNull JBCefJSQuery jsQuery) { CountDownLatch latch = new CountDownLatch(1); jsQuery.addHandler(result -> { System.out.println("JBCefJSQuery result: " + result); latch.countDown(); return null; }); invokeAndWaitForLoad(browser, () -> { browser.loadURL("chrome:version"); }); invokeAndWaitForLatch(latch, () -> { System.out.println("Executing JBCefJSQuery..."); browser.getCefBrowser().executeJavaScript(jsQuery.inject("'hello'"), "about:blank", 0); }); }