RFR: 8356276: JavaScript error in script.js after JDK-8348282
Hannes Wallnöfer
hannesw at openjdk.org
Tue May 6 15:03:27 UTC 2025
Please review a simple fix to avoid a JavaScript error in API docs when syntax highlighting is not enabled.
The fix consists in replacing `(hljs)` with `(typeof hljs !== "undefined")` in the `if` statement as the former throws a `TypeError` if `hljs` is undefined. The `try-catch` wrapper around `hljs.highlightAll()` is just added to be on the safe side, and the change in `Head.java` is just cleanup to preserve the separateion of .css and .js files.
Labeled `noreg-hard` as we do not have a way to test the script in browser. I manually tested the fix in multiple browsers.
-------------
Commit messages:
- JDK-8356276: JavaScript error in script.js after JDK-8348282
Changes: https://git.openjdk.org/jdk/pull/25069/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25069&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8356276
Stats: 10 lines in 2 files changed: 7 ins; 1 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/25069.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25069/head:pull/25069
PR: https://git.openjdk.org/jdk/pull/25069
More information about the javadoc-dev
mailing list