Skip to content

Commit

Permalink
8240969: WebView does not allow to load style sheet in modularized ap…
Browse files Browse the repository at this point in the history
…plications

Reviewed-by: kcr, ajoseph
  • Loading branch information
tobiasdiez authored and kevinrushforth committed Aug 14, 2020
1 parent 1c54e61 commit 2aed5ad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public final BooleanProperty javaScriptEnabledProperty() {
* Location of the user stylesheet as a string URL.
*
* <p>This should be a local URL, i.e. either {@code 'data:'},
* {@code 'file:'}, or {@code 'jar:'}. Remote URLs are not allowed
* {@code 'file:'}, {@code 'jar:'}, or {@code 'jrt:'}. Remote URLs are not allowed
* for security reasons.
*
* @defaultValue null
Expand Down Expand Up @@ -562,6 +562,7 @@ public final StringProperty userStyleSheetLocationProperty() {
dataUrl = url;
} else if (url.startsWith("file:") ||
url.startsWith("jar:") ||
url.startsWith("jrt:") ||
url.startsWith("data:"))
{
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,4 +472,18 @@ void waitForCompletion() {
assertNull(getEngine().executeScript("window.xmlDoc.body"));
});
}

@Test public void jrtCssFileIsNotRejected() {
submit(() -> {
try {
getEngine().setUserStyleSheetLocation("jrt:/javafx.web/html/imported-styles.css");
} catch (IllegalArgumentException e) {
// A jrt file is supposed to be a valid argument
throw new AssertionError(e);
} catch (RuntimeException e) {
// The css file cannot be loaded in the tests (since they are not modularized).
// We thus simply ignore this exception here
}
});
}
}

0 comments on commit 2aed5ad

Please sign in to comment.