javascript 为什么 Chrome 会在 jQuery 中的某行上暂停?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5174968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is Chrome pausing on some line inside jQuery?
提问by Andrew Arrow
Every time I refresh my web app with the Chrome Inspector open it pauses and takes me to the sources tab with a big red arrow icon pointing to some weird line inside jQuery.
每次我用 Chrome Inspector 打开它刷新我的网络应用程序时,它都会暂停并带我到源选项卡,其中有一个大红色箭头图标指向 jQuery 中的一些奇怪的行。
I see
我明白
Paused in debugger
在调试器中暂停
in the top-middle of the window, and
在窗口的顶部中间,以及
Paused on exception: DOMException
因异常而暂停:DOMException
in the Call Stack on the sources tab.
在源选项卡上的调用堆栈中。
As far as I'm aware, I haven't set any breakpoints and this code wasn't throwing exceptions before - so what's going on?
据我所知,我没有设置任何断点,这段代码之前也没有抛出异常 - 那么发生了什么?
回答by Andrew Arrow


That little pause icon in the lower left. Should be black in color. Click it to cycle through several breakpoint options.
左下角的那个小暂停图标。颜色应该是黑色。单击它可循环浏览多个断点选项。
回答by Karson
I had been debugging and forgotten to remove a breakpoint.
我一直在调试并忘记删除断点。


回答by Jeremy Warne
Also check that you haven't ticked "Any XHR" under XHR Breakpoints.
还要检查您是否没有在 XHR Breakpoints 下勾选“Any XHR”。
回答by blue-sky
To disable this on On Windows for Chrome.
在 Windows 上为 Chrome 禁用此功能。
In "Script" button circled in red below, cycle to same state ("Don't pause on Exceptions")
在下面红色圈出的“脚本”按钮中,循环到相同的状态(“不要暂停异常”)


回答by solarstrings
Solution for Visual Studio debugging
Visual Studio 调试解决方案
I had the same problem with the "Paused in debugger" showing up when I was building a website with MVC 5 and razor.
当我使用 MVC 5 和 razor 构建网站时,我遇到了与“在调试器中暂停”相同的问题。
What solved the problem for me was to:
对我来说解决问题的是:
Remove all breakpoints in the code (some were set in JavaScript code).
Start debugging the project, click the "Exception settings" tab, and deselected "JavaScript (Chrome) Exceptions" checkbox.
Stop debugging - Settings will apply first after a restart
Start debugging - no more "Paused in debugger"
删除代码中的所有断点(有些是在 JavaScript 代码中设置的)。
开始调试项目,单击“异常设置”选项卡,并取消选中“JavaScript (Chrome) 异常”复选框。
停止调试 - 重新启动后将首先应用设置
开始调试 - 不再“在调试器中暂停”
Somewhere along the line, I must have checked the "JavaScript (Chrome) Exceptions" checkbox, and forgot about it.
沿着这条线的某个地方,我一定是检查了“JavaScript (Chrome) Exceptions”复选框,然后忘记了它。
回答by Yassine Safraoui
for me this was the problem:
I had to uncheck the any XHR or fetch checkbox
对我来说,这就是问题所在:
我必须取消选中 any XHR 或 fetch 复选框
Conclusion: I don't know if you if this will fix the problem but I guess that if you have any checkbox checked in any tab that has Breakpoints in its name just uncheck it and see if it works, and uncheck breakpoint symbol in the top left bar till it's grey, and then you will need to hit the pause or play button in the top left bar and nothing should appear any more.
结论:我不知道这是否能解决问题,但我想如果您在名称中包含 Breakpoints 的任何选项卡中选中了任何复选框,请取消选中它并查看它是否有效,并取消选中顶部的断点符号左栏直到它变灰,然后您需要点击左上栏中的暂停或播放按钮,并且不会再出现任何内容。
回答by Asif Asghar
This can also cause the issue
这也可能导致问题
Break Point icon at top left should be blue like this(For Deactivate BreakPoints)
左上角的断点图标应该是蓝色的(对于停用断点)


Should not grey like this
不应该像这样变灰


回答by mibawork
I was able to clear a phantom breakpoint I had while using Chrome by closing developer tools, refreshing the page, and then opening developer tools.
通过关闭开发人员工具,刷新页面,然后打开开发人员工具,我能够清除我在使用 Chrome 时遇到的幻像断点。

