Skip to content

Commit

Permalink
[ISSUE-#19208] If scaladocs on file protocol don't do SPA routing. (#…
Browse files Browse the repository at this point in the history
…22013)

If we detect scaladocs are being served locally
(i.e page on the "file" protocol)
then we let the link click event go back to normal handling.

Otherwise unless a user has allowed pages on the file protocol to access
other files

https://github.com/chromium/chromium/blob/b6c23ba2056e65081f8a5bcbf73b176baaa42645/content/public/common/content_switches.cc#L15
for example with the allow-file-access-from-files flag in chrome then
SPA routing won't work.

Fixes #19208.
  • Loading branch information
Math-ias authored Nov 26, 2024
1 parent 0afabd6 commit 75ddad2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scaladoc/resources/dotty_res/scripts/ux.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ function attachAllListeners() {
if (url.origin !== window.location.origin) {
return;
}
// ISSUE-19208, treat as normal link when lacking HTTP server,
// otherwise GET request blocked by CORS protections.
if (window.location.protocol.startsWith("file")) {
return;
}
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) {
return;
}
Expand Down

0 comments on commit 75ddad2

Please sign in to comment.