I cannot debug, DevTools crashes and closes itself.

299 views
Skip to first unread message

C R

unread,
May 25, 2023, 4:36:21 PM5/25/23
to Chromium Extensions
I developed a Firefox extension, which fully works on Firefox.

I'm the the process of porting it to Chrome. 

I managed to load my extension, now without errors in chrome://extensions/
To achieve that I had to change the manifest file and some function calls.

If I right click on extension button -> Inspect pop-up, it works, until I open the pop-up normally, and then the DevTools closes itself instantly.

If I left click on extension button, without DevTools open, the popup opens normally.

Setting debugger; statements in code or breakpoints in DevTool, also crashes the DevTools.


I had no issues with Firefox's Developer Tools.

Is it the code of my extension which causes the crash? Does DevTools have a reputation for crashing? Should I downgrade browser version or what could I do? 

I don't want to go all barbarian and console.log() may way through.

Version 113.0.5672.127 (Official Build) (64-bit)

wOxxOm

unread,
May 26, 2023, 12:38:19 AM5/26/23
to Chromium Extensions, C R
I've tried your extension and devtools doesn't crash here, so it may be a bug in the browser. However maybe devtools doesn't actually crash and just closes when you close or re-open the popup? This is the expected behavior, because the popup is a separate window, so it has its own separate devtools, just like any window in Chrome, so when it closes the associated devtools also closes.

C R

unread,
May 26, 2023, 7:20:36 AM5/26/23
to Chromium Extensions, wOxxOm, C R
thank you, this solves my problem.

just closes when you close or re-open the popup?

I was under the impression it just crashes very smoothly.

expected behavior, because the popup is a separate window, so it has its own separate devtools

In Firefox we can have multiple equivalents of "devtools" open at the same time. I thought the same will be the case on Chrome too, as it's rather useful?
If the popup were to open only for a few milliseconds, and then crash, wouldn't it be hard to attach "devtools" to it?

wOxxOm

unread,
May 26, 2023, 7:58:43 AM5/26/23
to Chromium Extensions, C R, wOxxOm
Indeed, debugging of popup's startup phase is inconvenient in Chrome - you need to open devtools of the popup, set a breakpoint, then press Ctrl-R or F5 inside devtools to reload the popup.

Worse, just as you mentioned, this won't help in case the popup crashes or hangs during its startup phase. The ugly workaround I use is 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 so that this instance of devtools handles the breakpoint properly. This is particularly 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.

Note that in Chrome you can also open devtools of an already visible popup: right-click inside the popup page and then select "inspect" in the menu. Aside from the abovementioned problem, which is rare, I find this much more convenient than jumping through the hoops of about:debugging in Firefox.
Reply all
Reply to author
Forward
0 new messages