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:
Set resource tracking to always enabled.
Close the developer tools.
Refresh the page.
Open the developer tools, tab resources.
Set your breakpoint.
File a bugreport here because it is not normal behavior.
Post a link to this bugreport back on SO so we can all star it.
精彩评论