RFR: 8240969: WebView does not allow to load style sheet in modularized applications [v3]

Kevin Rushforth kcr at openjdk.java.net
Thu Aug 13 21:39:18 UTC 2020

On Sun, 2 Aug 2020 10:27:17 GMT, Tobias Diez <github.com+5037600+tobiasdiez at openjdk.org> wrote:

>> Currently, loading a style sheet file using `WebView.getEngine().setUserStyleSheetLocation(url)` fails if the url
>> start's with `jrt`, i.e. if the file is packaged in an application image using jlink. This is fixed with this PR.
> Tobias Diez has updated the pull request incrementally with one additional commit since the last revision:
>   Remove whitespace

Changes requested by kcr (Lead).

modules/javafx.web/src/test/java/test/javafx/scene/web/MiscellaneousTest.java line 478:

> 477:     @Test public void loadJrtCssFileSuccessfully() {
> 478:         getEngine().setUserStyleSheetLocation("jrt:/javafx.web/html/imported-styles.css");
> 479:     }

This won't run as is for a couple reasons. First it's on the wrong thread, but more importantly, you will not be able
to load anything from the unit test using a `jrt` URL, so I don't think a unit test in the `javafx.web` module itself
will work.

You will either need to provide a system test in `tests/system/` that creates a modular jar file (which is probably
overkill for this fix), or else a manual test in `tests/manual`. The latter seems sufficient for this bug and will be


PR: https://git.openjdk.java.net/jfx/pull/22

More information about the openjfx-dev mailing list