JBCefJSQuery (@NotNull JBCefBrowserBase browser) { Function<Void, JBCefJSQuery> create = (v) -> { return new JBCefJSQuery(browser, new JSQueryFunc(browser.getJBCefClient())); }; if (!browser.isCefBrowserCreateStarted()) { return create.apply(null); } JSQueryPool pool = browser.getJBCefClient().getJSQueryPool(); JSQueryFunc slot; if (pool != null && (slot = pool.useFreeSlot()) != null) { return new JBCefJSQuery(browser, slot); } Logger.getInstance(JBCefJSQuery.class). warn("Set the property JBCefClient.Properties.JS_QUERY_POOL_SIZE to use JBCefJSQuery after the browser has been created", new IllegalStateException()); // this query will produce en error in JS debug console like: "Uncaught TypeError: window.cefQuery_0123456789_1 is not a function" return create.apply(null); }