Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't Google Chrome's script debugger let me set a breakpoint? [closed]

I'm running Google Chrome 8.0.552.215 on Windows 7 x64 Ultimate. I have a simple jQuery inline script much like any I've successfully debugged in the past:

<script type="text/javascript">
  $(document).ready(function () {
    // do stuff here
    // but reduced to a simple
    alert('here!');
  });
</script>

I'm browsing to the secure (https) section of the site I'm working on.

There are no script errors, the scripts all run just fine, but I can't set a breakpoint.

I tried debugging this in Firefox's Firebug and and can set and hit breakpoints just fine.

Why would this happen?

like image 497
Kev Avatar asked Dec 05 '10 13:12

Kev


2 Answers

This bug was fixed yesterday (February 3) with the introduction of a new api for managing JavaScript breakpoints: http://code.google.com/p/chromium/issues/detail?id=69988

I downloaded the most recent Chromium nightly from http://build.chromium.org/f/chromium/snapshots/ and was able to successfully set breakpoints in JavaScript, which I had been unable to do using the current stable/beta/dev builds of Chrome.

Hopefully this fix will be incorporated into the next releases of Chrome. Until then, adding debugger; statements to your code is a decent workaround for setting breakpoints.

like image 96
Patrick Lewis Avatar answered Oct 02 '22 09:10

Patrick Lewis


Does this happen when you refresh the page when the developer tools are already open? It happened to me too in that case.

Workaround:

  1. Set resource tracking to always enabled.

  2. Close the developer tools.

  3. Refresh the page.

  4. Open the developer tools, tab resources.

  5. Set your breakpoint.

  6. File a bugreport here because it is not normal behavior.

  7. Post a link to this bugreport back on SO so we can all star it.

like image 45
Jan Avatar answered Oct 02 '22 10:10

Jan