Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to blackbox all VM scripts in chrome debugger?

I'm trying to debug quite a complicated module in my angular app. I've set a break point at the start of a particular method hoping I could follow it through and see where it's giving me back an error. However, it keeps bringing me into the VM scripts (VM28337, VM30559, etc). I can assume these all work as they should, so I have no interest in seeing them.

I know I can blackbox certain scripts in chrome debugger, but there seems to be an endless amount of these VM scripts. Does anyone have any suggestions on how to circumvent these scripts?

like image 629
abyrne85 Avatar asked Apr 27 '15 13:04

abyrne85


People also ask

What is Blackboxing a script?

Script blackboxing is the ability to mark a <script> in Web Inspector so that it is ignored by the JavaScript debugger, meaning that any JavaScript execution pauses that would happen in that <script> are instead deferred until JavaScript execution has continued outside of that <script> .

How do I debug JavaScript in Chrome compiled?

Open any web site. Open developer tools in chrome by pressing F12 /Ctrl + Shift + I/ right-click anywhere inside the web page and select Inspect/Inspect Element which will be mostly the last option. Go to Sources tab in developer tools and open any minified JS which you want to debug as shown in the image.

How do I debug a web service in Chrome?

If you want to debug it, you should press F12 on Chrome to open the developer mode. You can see that the JS code of the current page is under the Source menu, you can set a breakpoint directly at the beginning of the script. Then you can click on the UI button or menu to start debugging(both js and backend activity ).


2 Answers

This doesn't appear to be possible in any version of Chrome at the moment. However, I create a Chromium bug to request it get added: Chromium Issue 526239

like image 85
matpie Avatar answered Oct 09 '22 23:10

matpie


A development-time-only workaround can be to override eval in your page -

(function ()
 {
  var originalEval = eval;
  eval =
   function (script)
   {
    return originalEval(script + "\n//# sourceURL=blackbox-this.js");
   }
 }());

And then blackbox ^.*blackbox-this.js$

Same for setInterval/setTimeout when it gets a string (but that is a bad practice anyway, right? ;))

Does that work for you?

like image 2
PhistucK Avatar answered Oct 09 '22 23:10

PhistucK