wOxxOm
unread,Jun 1, 2023, 1:20:52 AM6/1/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Chromium Extensions, Cuyler Stuwe, Amy Dev, Shailan Patel, Gomez Sanchez, Chromium Extensions
> will we ever get a good first-party solution for debugging an extension popup's bootup
While it's inconvenient, a minor alleviation is to press Ctrl-R or F5 inside devtools instead of typing location.reload().
Although it won't help extensions that need to check the focused window itself and not the tab, for which I have to use setTimeout(()=> location.reload(), 1000) and immediately minimize the devtools.
Things get uglier if the popup crashes or hangs during its startup phase because we can't open devtools at all. I have to comment out everything in the script to let the popup open (or add `throw 0` at the beginning), then restore the original code, set a breakpoint in devtools and reload the popup by pressing Ctrl-R or F5 inside devtools. This is especially inconvenient when debugging an extension from the web store, editing which in-place disables it in the browser due to content verification mismatch, so you would have to make a local copy of the extension first.
A proper solution would be to fix the "Inspect popup" command in the context menu of an extension icon so that it attaches devtools ***before*** running the popup and thus be able to stop at the existing breakpoints as well as exceptions.