extension error logs

676 views
Skip to first unread message

Shailan Patel

unread,
May 31, 2023, 11:15:11 AM5/31/23
to Chromium Extensions
does anybody know whether its possible to see error logs regarding extensions? i have loaded my extension but its not working so it needs to be debugged.
Message has been deleted

Shailan Patel

unread,
May 31, 2023, 11:32:54 AM5/31/23
to Chromium Extensions, Gomez Sanchez, Chromium Extensions, Shailan Patel
were you meant to write something as your message was null

On Wednesday, May 31, 2023 at 4:22:23 PM UTC+1 Gomez Sanchez wrote:
On Wed, May 31, 2023, 4:15 PM Shailan Patel <shail...@gmail.com> wrote:
does anybody know whether its possible to see error logs regarding extensions? i have loaded my extension but its not working so it needs to be debugged.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/262fa64a-40fe-4e73-90a4-ab7aa8c3e378n%40chromium.org.

Amy Dev

unread,
May 31, 2023, 12:10:07 PM5/31/23
to Chromium Extensions, Shailan Patel, Gomez Sanchez, Chromium Extensions
Debugging extensions is an excellent place to learn how to find logs and errors in your extension.

I hope this helps! 🙂
Amy

Cuyler Stuwe

unread,
May 31, 2023, 1:24:22 PM5/31/23
to Chromium Extensions, Amy Dev, Shailan Patel, Gomez Sanchez, Chromium Extensions
Speaking of "debugging extensions", will we ever get a good first-party solution for debugging an extension popup's bootup seqeuence?

Something similar to Firefox's ability to "start the popup with devtools open" (so that breakpoints can be triggered).

The "workarounds" of trying to use location.reload() or loading the popup in a separate tab often just don't cut it.

wOxxOm

unread,
Jun 1, 2023, 1:20:52 AM6/1/23
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.

Simeon Vincent

unread,
Jun 1, 2023, 1:23:24 AM6/1/23
to Cuyler Stuwe, Chromium Extensions, Amy Dev, Shailan Patel, Gomez Sanchez
You can right click the extension's action and select "Inspect Popup." This will open the popup and a DevTools session for it. From there, you can set a breakpoint in the sources panel, then press F5/Command+R to reload the popup.

While Chrome will remember breakpoint set on the popup across invocations of this flow, it takes a moment for DevTools to attach so it won't break on initial load. You'll still have to hit F5/Command+R to capture those breakpoints.

Simeon - @dotproto


Simeon Vincent

unread,
Jun 1, 2023, 1:24:35 AM6/1/23
to Cuyler Stuwe, Chromium Extensions, Amy Dev, Shailan Patel, Gomez Sanchez
+1 to wOxxOm's request to attach before opening the popup.

Simeon - @dotproto

Oliver Dunk

unread,
Jun 1, 2023, 5:06:16 AM6/1/23
to Simeon Vincent, Cuyler Stuwe, Chromium Extensions, Amy Dev, Shailan Patel, Gomez Sanchez
If there isn't a bug for this, please do open one! It sounds like a reasonable request.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


Reply all
Reply to author
Forward
0 new messages