void () { var client = JBCefApp.getInstance().createClient(); client.setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 1); var browser = new JBCefBrowserBuilder().setUrl("about:blank").setClient(client).build(); showAndWaitForLoad(browser, JBCefJSQueryPoolSlotReuseTest.class.getSimpleName()); /* * Create and use a JS query. */ var jsQuery1 = JBCefJSQuery.create((JBCefBrowserBase)browser); var funcName = jsQuery1.getFuncName(); doTest(browser, jsQuery1); Disposer.dispose(jsQuery1); // should return the query function to the free slot /* * Make sure the query is invalid. */ boolean isIllegal = false; try { jsQuery1.inject(""); } catch (IllegalStateException ex) { isIllegal = true; } assertTrue(isIllegal); /* * Create and use a JS query again and make sure it reuses the same function under the hood. */ var jsQuery2 = JBCefJSQuery.create((JBCefBrowserBase)browser); assertEquals(funcName, jsQuery2.getFuncName()); doTest(browser, jsQuery2); Disposer.dispose(client); }