开发者

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

开发者 https://www.devze.com 2023-01-29 10:38 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I'm running Google Chrome开发者_Python百科 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消