Chrome webtools调试器自行恢复脚本执行 [英] Chrome webtools debugger resumes script execution on its own

查看:156
本文介绍了Chrome webtools调试器自行恢复脚本执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到Chrome devtools中出现了奇怪的行为。我在我的javascript中设置了一个断点,然后断点命中并停止执行。

代码窗口显示了我的代码中断点所在的位置(窗口的背景颜色为淡黄色),然后在5秒钟后自动恢复我告诉它。

以前有谁见过这个?这显然使我很难调试。



编辑:这是Chrome远程调试Android WebView应用程序。我没有在原帖中提及。



我记录了一个会话,在设置​​3个断点后重新加载页面。重新加载页面后,我没有触摸键盘或鼠标。您可以看到Chrome会自动恢复此处。 (对不起,对于非现场链接)在这种情况下,JS窗口的背景在某些情况下不会变成黄色。



谢谢

我终于弄清楚是什么导致调试器进入自动继续模式。我的Android应用程序使用Android的WebView loadUrl API在页面上执行一些JS。它使用这个调用每5秒调用一次计时器:

  webView.loadUrl(javascript:+ callBack +(''+ cbData.toString()+');); 

这显然会导致Chrome恢复执行,以便它可以执行应用程序请求的JS代码。



我很失望,因为我花了这么长时间来追踪这件事。



如果在任何时候运行时决定启动你,调试JS会有点困难IMO ...

我要做一些调查,看看我能否在Google上找到任何有关这方面的信息。


I'm seeing strange behavior out of Chrome devtools. I set a breakpoint in my javascript then the breakpoint hits and execution stops.

The code window shows the point in my code where the breakpoint is (the window has a yellowish background color to it) and then after 5 seconds execution auto-magically resumes without me telling it to.

Has anyone else seen this before? It's obviously making it very difficult for me to debug.

EDIT: This is Chrome remotely debugging an Android WebView application. I failed to mention that in the original post.

I recorded a session where I reload a page after having set 3 breakpoints. I did not touch the keyboard or the mouse after reloading the page. You can see Chrome automatically resuming here. (Sorry for the offsite link) In this instance the background of the JS window did not turn yellow for some instance.

Thanks

解决方案

I finally figured out what was causing the debugger to go into 'auto continue' mode. My Android app was using Android's WebView loadUrl API to execute some JS on the page. It was on a timer calling into the JS every 5 seconds using this call:

webView.loadUrl("javascript:" + callBack + "('" + cbData.toString() + "');");

That apparently causes Chrome to resume execution so that it can execute the JS code the app is requesting.

I'm disappointed that it took so long for me to track this down.

Makes debugging the JS a little difficult IMO if at any time the runtime decides to startup on you...

I'm going to do some research and see if I can find anything about this on the Googles.

这篇关于Chrome webtools调试器自行恢复脚本执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆