简体   繁体   中英

Chrome webtools debugger resumes script execution on its own

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM