Skip to content

侧边栏:浏览器关了扩展侧边栏时,打开失败说「当前浏览器不支持扩展侧边栏」 - #437

Merged
PathGao merged 1 commit into
mainfrom
fix/sidepanel-unavailable-text
Oct 27, 2026
Merged

PathGao merged 1 commit into
mainfrom
fix/sidepanel-unavailable-text

Conversation

@PathGao

@PathGao PathGao commented Oct 27, 2026

Copy link
Copy Markdown
Owner

改了什么

浏览器关掉扩展侧边栏功能时,Chromium 的 sidePanel.open 会回英文的 API Unavailable,页面上就显示「打开侧边栏失败:API Unavailable」。现在四个入口(弹窗和播放器的 AI 总结、专注模式、摘读记录、分拣台)都改走 MdgErrors.openSidepanel:没有这个接口,或者接口被关掉,都显示「打开侧边栏失败:当前浏览器不支持扩展侧边栏」。其他错误照原样显示。

验证

  • node scripts/selftest.mjs,39 个自检全部通过。errors.selftest.js 新加了四种情况:打开成功、API Unavailable、没有接口、其他错误。
  • Chrome 156 无头模式,用临时配置加载这个分支的扩展。在摘读记录页里,带用户手势调 openSidepanel 能打开侧边栏。传一个不存在的 tabId,Chrome 回的「No tab with id」照原样显示。把后台的 sidePanel.open 换成返回 API Unavailable 后,发 player-ai-quick-action(弹窗点 AI 总结走的就是这条)回 {ok:false, error:"当前浏览器不支持扩展侧边栏"}。

没测到:手头没有真正关掉侧边栏的浏览器,API Unavailable 是模拟出来的。

关联 issue

Related to #430。只改了提示语。报告人用的是什么浏览器,还在等他回复。

Chromium 关掉侧边栏功能时 sidePanel.open 回英文的 API Unavailable,原样显示给用户(#430)。
四个入口改走 MdgErrors.openSidepanel,没有接口和接口被关说同一句话。
@PathGao
PathGao merged commit 3b2f8e3 into main Oct 27, 2026
2 checks passed
@PathGao
PathGao deleted the fix/sidepanel-unavailable-text branch October 27, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant