In recent versions of Chrome-based browsers, for some reason (probably, not a bug, it's a feature), after debug mode is detached, Chrome leaves this notification:
"Programm started debugging this browser"
Screenshot
Basically, I run this code
let debugee = {tabId: sender.tab.id};
chrome.debugger.attach(debugee, '1.2', ()=>{});
chrome.debugger.detach(debugee);
And see the picture above. Chrome removed this notification on detach
until version 80 (or so).
I've found the description of the issue: 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>
I'm looking for a suggestion on how to clear or disable this message automatically, from the chrome extension.
TL;DR there's no such method.
The new behavior in Chrome is the consequence of an awkward fix for a security problem: a malicious extension can quickly do a lot of damage via chrome.debugger API and no one will know that something even happened if the work was performed in less than say 100ms.
Since a security problem was involved, the old behavior won't be restored, but they agreed the UI should at least reflect the current debugger state, see https://crbug.com/1096262. Their current plan is to auto-close the infobar after being visible for >=5s if the extension has detached and update the buttons/strings to be in sync with state.
A workaround is to run chrome with --silent-debugger-extension-api
command line switch. It's a dangerous switch though in the sense that you'll have to be careful not to install a malicious extension that uses debugger
permission either right away or upon an update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With