Chrome devtools erroneously pauses on exception in ignored script
Asked Answered
F

4

19

enter image description here

Image speaks for itself; this script is on the debugger's ignore list; yet every time I trigger this exception it is paused upon. I cannot uncheck Pause on caught exceptions because I am trying to pause on a caught exception in another startup script.

Devtools says The debugger will skip stepping through this script, and will not stop on exceptions, but it's doing just that, it is not skipping this script.

I've tried several things, like unignoring/reignoring. Using canary, etc. I have this problem on both my windows and osx machines; so it doesn't seem to be particularly related to my environment.

I am wondering if anyone else has run into this and found a workaround. Thank you.

Faydra answered 3/11, 2021 at 2:16 Comment(7)
If you go into configure do you have Add content scripts to ignore list checked?Lip
Yeah, that's been checked but does not resolve the problem. This bug has plagued me forever. I'm surprised others have not run into it. Thank you for the attention.Faydra
I’m actually seeing the same as you when I try to ignore a script it still break on the exception. And the checkbox does not seem to have any effect. I’m wondering if chrome has a bug filled for this.Lip
Are you on windows? How did you ignore it? Was it on specific file basis (right click on script then ignore) or was it set on a regex list? Here in Linux Chromium 84 it works as expected, but Firefox doesn't. The difference: chromium is not set specifically by file but by regex pattern in settings screen (btw it is called blackbox instead of ignore list). In firefox it is on a file basis. Maybe regex is stronger in a sense it wont lost its reference, idk those files may lost reference somewhere (...)Rhoden
I'm on OSX. It's ignored in the "Ignore list". I've even tried adding a match everything regex, i.e /.\*/ to the ignore list and it still stops on the black boxed scripts. Thank you for the help though. I wish I could use firefox instead, but this is happening with a node script, which firefox can't attach itself to. (Although it happens in browser scripts as well, in my case).Faydra
Did you find a solution for this? It doesn't work and it is so frustrating...I think most people don't even use the debugger otherwise this would get more visibility.Corticosteroid
I'm not sure how this is not a bigger issue, and I still don't have a solution.Faydra
R
3

Problem remains unsolved. Leaving this post here with some unsucessfull tentatives of mine, so someone can build something based on them.

1. Devtools extension API

It is possible to create an add-on that can reach the Developer Tools window and even reach the Sources tab, but once there all I could do was creating new sidepanels or attaching a listener to code text selection changes: chrome.devtools.panels.sources.onSelectionChanged.addListener((x)=>{console.log("onselectionchanged");console.dir(x);});

This API was not enough, could not reach debug status or any interesting sidepanel.

2. Debugging the debugger with a JS debugger

By hitting ctrl-shift-i or ctrl-shift-j over a devtools debug window it is possible to open another devtools debug window, debuging the first one. From there it is possible to write code that detects the banner informing that the file was supposed to be ignored and then click on the continue button:

function breakpointskipper() {
    bnr = document.getElementById("sources-panel-sources-view").querySelector("div.vbox.flex-auto > div > div > div > div.flex-none > div");
    if (!bnr) return;
    bnr = bnr.shadowRoot;
    if (!bnr) return;
    bnr = bnr.querySelector("div");
    if (bnr.ariaLabel != "This script is blackboxed in the debugger") return;
    btn = document.querySelector("div.scripts-debug-toolbar.toolbar");
    if (!btn) return;
    btn = btn.shadowRoot;
    if (!btn) return;
    btn = btn.querySelector("div > button[aria-label=\"Resume script execution\"]");
    if (!btn) return;
    btn.click();
}

It is possible to even attach this breakpontskipper() button presser to an event in the devtools window and automate things, but as soon as you close the debugger being debugged window, it is all over and you have to recreate the code and reattach again. As said before, I wasn't able to make any add-on reach here.

3. Debugging the debugger with a native debugger

One last available option would be using GDB to debug the DevTools and change its behavior, in the chromium documentation it is shown that they have debug symbols available but I didn't try this approach.

Rhoden answered 23/11, 2021 at 3:39 Comment(6)
I appreciate the help! I would love to award this as the answer but since none of the solutions are actually a fix I think I will leave it open until maybe someone hopefully comes across this and knows what's going on :)Faydra
Don't worry, you're welcomeRhoden
Upvoted. I am having the same problem. It seems that Chrome DevTools has begun a noticeable decline in stability and reliability the last 2 years. I got now several times a week the "Awww snap, something went wrong" debugger crash, randomly resurrected breakpoints stopping my code, and other issues.Hillock
SAME problem here! This is still very much an issue. Windows 11 Pro 23H2 Chrome Version 119.0.6045.124 (Official Build) (64-bit) uBlock Origin (subscriber.js) WakaTimje (wakatimeScript.js)Hemimorphite
It's probably time to switch to Firefox. It's better than chrome now (even the developer tools) in many ways.Faydra
it also pissme of am work on nwjs and elector based on chromium and some native script use try catch ! hope a fix soon !Carton
P
1

Two possible solutions to this:

  1. Make sure every script on the call stack when the exception is thrown is on the ignore list. Chrome will stop if any of the code the exception will interrupt is code you want to debug; it doesn't only look at the file where the exception is thrown.

  2. You may be able to silence a specific throw statement by right clicking on the line number in the gutter and selecting Never pause here.

Pelagi answered 12/1, 2024 at 12:58 Comment(0)
W
0
Please try the troubleshooting help, and share some feedback. Also it would help greatly if you pasted some script here.
    1. Please check if your script black boxed like here
    1. Did you accidentally turn on - break on all exceptions see here reset break all exceptions in chrome browser debugger
    1. Force a hard refresh, i.e. clear you cache like here
    1. Turn off all break points, then do a restore, try again.

More from ref. on chromium bug site


Update 1: Can you please verify/double check that your file to ignore is actually added to the ignore list.

If you know upfront which files to ignore, head over to Developer Tools > Settings (Cog Icon) > Ignore List. Then add a file name or regex pattern you wish to exclude.

You should see something like

How to ignore file in chrome

Wherever answered 23/11, 2021 at 1:5 Comment(1)
Thanks. 1. The script is black boxed as it should be. 2. It's enabled; and it's not enabled by accident. I do want to break on exceptions; but it should not break on exceptions in ignored scripts (see my original screenshot - "...debugger will skip stepping through this script, and will not pause on exceptions") -- that's the behavior that it claims is enabled; but is not. 3 & 4. Tried both, neither work, thank you though! It happens in Canary as well. What script do you want me to paste?Faydra
R
0

@Transformer You were on the right track, it's not the ignore function in general that doesn't work right, its the ignore function you can use through rightclick on the file in the debugger tab AND the automatic ignoring of Content scripts.

It works when you add the file manually in the Ignore List in the Settings of the devtools.

Very annoying endeed and incredible that google is not seeing this.

Role answered 28/5, 2024 at 21:4 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.