Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome how to disable debugger keyword or disable pause

I know there is a Never pause here, but it's not works for code like this

setInterval(function(){
  eval('debugger;'+Math.random())
},1000)

If I can't find the setInterval, I can not disable the pause, it's very annoying.

Is there any flag or somehow to disable this ?

EDIT

I found this issues(DevTools: impossible to disable a breakpoint caused by "debugger" statement) relate to this problem, in the test code I found a flag --expose-debug-as debug, but how can I use this flag for headless,

chrome --expose-debug-as debug --headless --disable-gpu '<URL>' --repl
[0610/020053.677043:ERROR:headless_shell.cc(459)] Open multiple tabs is only supported when the remote debug port is set.
like image 453
wener Avatar asked Oct 24 '25 01:10

wener


1 Answers

Well the only choice you really have is to inject code into the page that overrides eval and removes it.

(function () {
  var _eval = window.eval;
  window.eval = function (str) {
    _eval(str.replace(/debugger;/,""));
  };
}());
eval("debugger;alert('a');")
like image 103
epascarello Avatar answered Oct 25 '25 15:10

epascarello



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!