### Question:
FXBrowsers { public static void runInBrowser(WebView webView, Runnable code) { Object ud = webView.getUserData(); if (ud instanceof Fn.Ref<?>) { ud = ((Fn.Ref<?>)ud).presenter(); } if (!(ud instanceof InitializeWebView)) { throw new IllegalArgumentException(); } ((InitializeWebView)ud).runInContext(code); } private  FXBrowsers(); static void load(
        final WebView webView, final URL url, 
        Class<?> onPageLoad, String methodName,
        String... args
    ); static void load(
        WebView webView, final URL url, Runnable onPageLoad
    ); static void load(
        WebView webView, final URL url, Runnable onPageLoad, ClassLoader loader
    ); static void load(
        WebView webView, final URL url, Runnable onPageLoad, ClassLoader loader,
        Object... context
    ); static void runInBrowser(WebView webView, Runnable code);  }### Answer:
@Test public void brwsrCtxExecute() throws Throwable { assertFalse(inJS(), "We aren't in JS now"); final CountDownLatch init = new CountDownLatch(1); final BrwsrCtx[] ctx = { null }; FXBrowsers.runInBrowser(App.getV1(), new Runnable() { @Override public void run() { assertTrue(inJS(), "We are in JS context now"); ctx[0] = BrwsrCtx.findDefault(FXBrowsersTest.class); init.countDown(); } }); init.await(); final CountDownLatch cdl = new CountDownLatch(1); class R implements Runnable { @Override public void run() { if (Platform.isFxApplicationThread()) { assertTrue(inJS()); cdl.countDown(); } else { ctx[0].execute(this); } } } new Thread(new R(), "Background thread").start(); cdl.await(); }