Skip to content

8260020: WebView does not render contents of locally stored MarkDown (*.md) files #1788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Gopalora
Copy link
Contributor

@Gopalora Gopalora commented Apr 22, 2025

Local markdown file mime type support is missing in the current JavaFX implementation. Hence, I have added a mime type for local Markdown files.

Verification:
The test program attached to the JBS passes with this change.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8260020: WebView does not render contents of locally stored MarkDown (*.md) files (Bug - P4) ⚠️ Issue is not open.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1788/head:pull/1788
$ git checkout pull/1788

Update a local copy of the PR:
$ git checkout pull/1788
$ git pull https://git.openjdk.org/jfx.git pull/1788/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1788

View PR using the GUI difftool:
$ git pr show -t 1788

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1788.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 22, 2025

👋 Welcome back Gopalora! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 22, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Ready for review label Apr 22, 2025
@Gopalora Gopalora changed the title JDK-8260020 Local Markdown files not shown in Webview 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. Apr 22, 2025
@mlbridge
Copy link

mlbridge bot commented Apr 22, 2025

Webrevs

@Gopalora Gopalora changed the title 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. 8260020: WebView does not render contents of locally stored MarkDown (*.md) files Apr 22, 2025
@openjdk openjdk bot changed the title 8260020: WebView does not render contents of locally stored MarkDown (*.md) files 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. Apr 22, 2025
@Gopalora Gopalora changed the title 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. 8260020: WebView does not render contents of locally stored MarkDown (*.md) files Apr 22, 2025
@openjdk openjdk bot changed the title 8260020: WebView does not render contents of locally stored MarkDown (*.md) files 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. Apr 22, 2025
@Gopalora Gopalora changed the title 8260020: WebView does not render contents of locally stored MarkDown (*.md) files. 8260020: WebView does not render contents of locally stored MarkDown (*.md) files Apr 22, 2025
@aghaisas
Copy link
Collaborator

I will let others to comment on the fix.
Is it possible to add an automated test?

@Gopalora Gopalora marked this pull request as draft April 22, 2025 13:43
@openjdk openjdk bot removed the rfr Ready for review label Apr 22, 2025
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test it later, but the fix looks reasonable as long it doesn't cause any side effects. It will need to be tested.

I did leave a couple inline comments.

Comment on lines +167 to +168
if (equalLettersIgnoringASCIICase(contentType, "application/octet-stream"_s))
return TextDocument::create(frame, settings, url, documentIdentifier);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this taken from upstream WebKit? If not, please enclose this in #if PLATFORM(JAVA)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +931 to +932
if (equalLettersIgnoringASCIICase(mimeType, "application/octet-stream"_s))
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to make this available via MIMETypeRegistry::isSupportedNonImageMIMEType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the comment "cross-site scripting vulnerabilities" there. So preferred this location.

@Gopalora Gopalora closed this May 14, 2025
@andy-goryachev-oracle
Copy link
Contributor

was this PR closed in favor of some other work?

@kevinrushforth
Copy link
Member

was this PR closed in favor of some other work?

No, it is on hold. When / if it is picked back up, a different solution will be explored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants