fix: Wrong Windows MIME types in regedit will cause browser to refuse execute the renderer bundle - #19
Merged
Conversation
… execute the renderer bundle.
Lucas1479
approved these changes
Aug 31, 2026
Lucas1479
left a comment
Member
There was a problem hiding this comment.
Verified at head 85a3ec6. I reproduced polluted Windows MIME mappings before importing render.server and confirmed that GET, HEAD, and mounted asset responses recover text/javascript for .js/.mjs and application/wasm for .wasm. The focused local bridge/security suite passes (3/3), and both required Windows CI checks are green. No blocking issues; approved for main.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
在
render/server.py中,Windows会从注册表中读取mimetypes。假如注册表中的.js值被某些软件错误改为了text/plain,那么bundle中的所有.js都会被解析为text/plain,而nosniff设置会导致浏览器拒绝执行,最终wallpaper会变成黑屏。解决方式是在代码中规定
.js被解析为text/javascript,避免被用户电脑本身的设置影响。In
render/server.py, Windows readsmimetypesfrom the registry. If the.jsvalue in the registry has been incorrectly changed totext/plainby some software, all.jsfiles in the bundle will be served astext/plain. Withnosniffenabled, the browser will refuse to execute these files, ultimately causing the wallpaper to display a black screen.The solution is to explicitly specify
text/javascriptas the MIME type for.jsfiles in the code, preventing the behavior from being affected by the user's local system configuration.Change class
Owning layer:
User-visible effect, or
none:Compatibility or migration impact, or
none:Evidence
Commands and manual journeys run:
npm run buildpasses when Electron code changedFinal check