JavaFX deja de abrir la URL en WebView, abre en su navegador

El navegador WebView integrado que estoy usando necesita un manejo especial para URL particulares, para abrirlos en el navegador predeterminado nativo en lugar de WebView. La parte de navegación real funciona bien, pero también tengo que evitar que la vista web muestre esa página. Puedo pensar en varias maneras de hacerlo, pero ninguna de ellas funciona. Aquí está mi código:

this.wv.getEngine().locationProperty().addListener(new ChangeListener<String>() {
    @Override
    public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue)
    {
        Desktop d = Desktop.getDesktop();
        try
        {
            URI address = new URI(observable.getValue());
            if ((address.getQuery() + "").indexOf("_openmodal=true") > -1)
            {
                // wv.getEngine().load(oldValue); // 1
                // wv.getEngine().getLoadWorker().cancel(); // 2
                // wv.getEngine().executeScript("history.back()"); // 3
                d.browse(address);
            }
        }
        catch (IOException | URISyntaxException e)
        {
            displayError(e);
        }
    }
});

Un poco más de información sobre lo que sucede en cada uno de los tres casos.

1. Cargando la dirección anterior
wv.getEngine().load(oldValue);

Esto mata a la JVM. Curiosamente, la página se abre bien en el navegador nativo.

# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005b8fef38, pid=7440, tid=8000
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [jfxwebkit.dll+0x2fef38]  Java_com_sun_webpane_platform_BackForwardList_bflItemGetIcon+0x184f58
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Greg Balaga\eclipse\Companyapp\hs_err_pid7440.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
2. Cancelando al trabajador
wv.getEngine().getLoadWorker().cancel();

No hace nada, la página se carga tanto en la vista web como en el navegador nativo.

3. Usando history.back ()
wv.getEngine().executeScript("history.back()");

Igual que el anterior, sin efecto.

4. Reaccionar a los cambios de etapa en su lugar.

También he intentado en lugar de mirar ellocationProperty deWebEngine, escucha en chenges parastateProperty delWorker y disparar el mismo código de apertura sinewState == State.SCHEDULED. No hubo diferencia en el resultado del método anterior (aparte de que en realidad no se puede usar el número 1).

Actualizar

El código que estoy usando ahora todavía bloquea la JVM:

this.wv.getEngine().locationProperty().addListener(new ChangeListener<String>() {
    @Override
    public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue)
    {
        Desktop d = Desktop.getDesktop();
        try
        {
            URI address = new URI(newValue);
            if ((address.getQuery() + "").indexOf("_openmodal=true") > -1)
            {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run()
                    {
                        wv.getEngine().load(oldValue);
                    }
                });
                d.browse(address);
            }
        }
        catch (IOException | URISyntaxException e)
        {
            displayError(e);
        }
    }
});
Solución

Ok, logré hacer que funcionara al demoler la vista web y reconstruirla.

this.wv.getEngine().locationProperty().addListener(new ChangeListener<String>() {
    @Override
    public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue)
    {
        Desktop d = Desktop.getDesktop();
        try
        {
            URI address = new URI(newValue);
            if ((address.getQuery() + "").indexOf("_openmodal=true") > -1)
            {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run()
                    {
                        grid_layout.getChildren().remove(wv);
                        wv = new WebView();
                        grid_layout.add(wv, 0, 1);
                        wv.getEngine().load(oldValue);
                    }
                });
                d.browse(address);
            }
        }
        catch (IOException | URISyntaxException e)
        {
            displayError(e);
        }
    }
});

Respuestas a la pregunta(8)

Su respuesta a la pregunta