Chrome Dev Tools execute js whenever a certain function is Called

Viewed 114

Hi everyone I am doing a js code Debug in Chrome dev tools using Breakpoints etc.

So, there is this annoying function I don't want to be executed, to invalidate it, I set a breakpoint on it, so that every time the function is called I change the parameters used by this function to values which wont work for this last one.

I was wondering if there was a better way to do this(i.E: a script in the Dev Tools?)

1 Answers

The only way I can see to execute code automatically when the breakpoint is hit is with a Conditional Breakpoint.

Usually the condition expression will just return the value of a condition, but I think you could have the expression reassign the parameters and return false (so it won't actually stop).

Right-click on the line, select Add conditional breakpoint, and set the condition expression to something like:

param1 = value1, param2 = value2, ..., false
Related