[Firefox] Markdown Preview fails to load workspace CSS via markdown.styles (NS_ERROR_UNKNOWN_HOST for vscode-resource.vscode-cdn.net)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
在 Firefox 中将 markdown.styles 设置为 test.css,重现 Markdown 预览,然后检查 Service Worker 注册、Network 面板和控制台,以查找对 vscode-resource.vscode-cdn.net 的请求。完成的标准是 workspace CSS 在 Firefox 中被拦截并应用,同时不破坏 code-server 初始化或 IndexedDB。
由索引模型根据 Issue 内容生成。
描述
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: Firefox
firefox-151.0-2.fc42.x86_64
- Local OS: Fedora 42
- Remote OS: Fedora 42
- Remote Architecture: amd64
code-server --version: 4.105.1 811ec6c1d60add2eb92446161ca812828fdbaa7f with Code 1.105.1
Steps to Reproduce
Bug Description
When opening a Markdown preview in Firefox, local CSS files referenced in markdown.styles fail to load. The browser attempts to resolve the virtual vscode-resource.vscode-cdn.net domain via DNS instead of intercepting it via the Service Worker, resulting in NS_ERROR_UNKNOWN_HOST.
This issue is specific to Firefox and its implementation of Service Worker / iframe isolation (dFPI).
Looks close to coder/code-server#7892 … BUT!!! The same setup works for me perfectly in Chromium-based browsers.
So I hope some workaround (custom settings, hacks) exists that can make work it with Firefox.
Steps to Reproduce
-
Run
code-serverand access it via Firefox. -
In a workspace, create a file
test.cssin the root directory. -
Add the following to
.vscode/settings.json:{ "markdown.styles": ["test.css"] } -
Open any
.mdfile and open the Markdown Preview. -
Check the developer tools Network and Console panels.
Expected
The Service Worker intercepts the request for test.css and serves the local workspace file, applying the custom styles to the preview (as it does in Chromium).
Actual
The preview renders without the custom CSS. In the Developer Tools Console:
Could not load 'markdown.styles': test.css
In the Network panel, the request for test.css fails:
- Host:
vscode-remote+<punycode>.vscode-resource.vscode-cdn.net - Error:
NS_ERROR_UNKNOWN_HOST - DNS Resolution: System
Investigation Details
Based on HAR exports and console logs:
- The Service Worker is registered and active.
- Extension resources inside the webview (e.g.,
index.bundle.jsfrom extensions) are successfully intercepted and returnHTTP/2 200. - However, the dynamically injected
<link rel="stylesheet">formarkdown.stylesbypasses the Service Worker and goes directly to the network. - Setting
privacy.partition.serviceWorkerstofalseinabout:configcompletely breakscode-serverinitialization (Error: IndexedDB database 'vscode-web-db' is closed), so it cannot be used as a workaround.
It appears to be a race condition or a cross-origin iframe isolation bug specific to Firefox, where the Service Worker fails to control the CSS fetch request initiated by the Markdown preview webview.
Attachments
Please find the attached console.log and .har (har.zip) network export demonstrating the bypassed Service Worker.
console-export-2026-7-30_12-31-17.log
xn--80ach2ae.xn--80apqgfe.xn--p1ai_Archive [26-07-30 12-32-00].har.zip
Logs
Screenshot/Video
No response
Does this bug reproduce in native VS Code?
Yes, this is also broken in native VS Code
Does this bug reproduce in VS Code web?
Yes, this is also broken in VS Code web
Does this bug reproduce in GitHub Codespaces?
Yes, this is also broken in GitHub Codespaces
Are you accessing code-server over a secure context?
- I am using a secure context.
Notes
No response
- 主要语言
- TypeScript
- 星标
- 79.4k
- 派生
- 6.9k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 39
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/code-server 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 92/100
coder/code-server#8017 · 2 条评论 ·
-
security
难度 2/5 1-3 小时 新手友好度 74/100
coder/code-server#8013 · 4 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7976 · 2 条评论 ·
-
enhancement
难度 5/5 一周以上 新手友好度 35/100
coder/code-server#7962 · 3 条评论 ·
-
bug needs-investigation
难度 4/5 3-5 天 新手友好度 55/100
coder/code-server#7955 · 1 条评论 ·
查看 coder/code-server 的全部 Issue
相似的 Issue
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
supermomonga/zcode-acp#24 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
growthbook/growthbook#7100 ·
-
triage
难度 1/5 1-3 小时 新手友好度 88/100