google-chrome - Chrome 扩展程序 - 调试模式后清除信息栏标签
问题描述
在基于 Chrome 的浏览器的最新版本中,出于某种原因(可能不是错误,它是一项功能),在 debug mode is detached之后,Chrome 会留下此通知:
“程序开始调试此浏览器”
基本上,我运行这段代码
let debugee = {tabId: sender.tab.id};
chrome.debugger.attach(debugee, '1.2', ()=>{});
chrome.debugger.detach(debugee);
并见上图。detach
Chrome 在80 版(左右)之前删除了此通知。
我找到了问题的描述: https ://chromium.googlesource.com/chromium/src/+/HEAD/chrome/app/generated_resources.grd
<!-- DevTools attached infobar -->
<message name="IDS_DEV_TOOLS_INFOBAR_LABEL" desc="Label displayed in an infobar when external debugger is attached to the browser. The label does not disappear until the user dismisses it, even if the debugger is detached, and so should not imply that the debugger must still be debugging the browser, only that it was, and could still be.">
"<ph name="CLIENT_NAME">$1<ex>Extension Foo</ex></ph>" started debugging this browser
</message>
我正在寻找有关如何从 chrome 扩展中自动清除或禁用此消息的建议。
解决方案
TL; DR 没有这样的方法。
Chrome 中的新行为是对安全问题的尴尬修复的结果:恶意扩展程序可以通过 chrome.debugger API 快速造成大量破坏,即使工作完成时间也不长,没有人会知道发生了什么事情100 毫秒。
由于涉及安全问题,旧行为将不会恢复,但他们同意 UI 至少应反映当前调试器状态,请参阅https://crbug.com/1096262。他们目前的计划是如果扩展程序已分离并更新按钮/字符串以与状态同步,则在可见 >=5 秒后自动关闭信息栏。
--silent-debugger-extension-api
一种解决方法是使用命令行开关运行 chrome 。这是一个危险的开关,但从某种意义上说,您必须小心不要安装使用debugger
权限的恶意扩展程序,无论是立即使用还是在更新时使用。
推荐阅读
- javascript - 计数器点击保存 Cookie
- function - 按多列从 GBQ 表中删除重复项的最有效方法
- android - 如何在 Kotlin/Arrow.kt 中为 producer Channel 实现“铁路模式”
- python - VSCode Python 写入调试控制台
- .net-core - 如何在没有 App.runtimeconfig.json 的情况下构建 App?
- azure - 是否可以从另一个网络向服务器发出请求
- json - 在转换为 CSV 之前,使用 JQ 将 JSON 嵌套对象输出到数组中
- kubernetes - Kubeam 失败 | 服务已关闭
- c# - 为什么隐藏扩展器的所有标题不起作用?
- javascript - AJAXified Wordpress主题中的历史replaceState问题