7

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.

nikk wong
  • 8,059
  • 6
  • 51
  • 68
  • If you go into configure do you have *Add content scripts to ignore list* checked? – Felipe Plets Nov 19 '21 at 01:54
  • 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. – nikk wong Nov 19 '21 at 06:52
  • 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. – Felipe Plets Nov 19 '21 at 12:54
  • 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 (...) – brunoff Nov 23 '21 at 00:39
  • 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). – nikk wong Nov 23 '21 at 01:31
  • 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. – Cesar Varela May 06 '22 at 20:47
  • I'm not sure how this is not a bigger issue, and I still don't have a solution. – nikk wong Sep 27 '22 at 01:14

2 Answers2

2

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.

brunoff
  • 4,161
  • 9
  • 10
  • 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 :) – nikk wong Nov 24 '21 at 20:24
  • Don't worry, you're welcome – brunoff Nov 24 '21 at 21:10
-1
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

Transformer
  • 6,963
  • 2
  • 26
  • 52
  • 2
    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? – nikk wong Nov 23 '21 at 01:28