9

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

10
  • Screenshot? This question is technically off-topic because it's not reproducible. Commented Jul 11, 2016 at 21:37
  • Might be a silly question but does this happen in plain vanilla Chrome/with no extensions enabled? Commented Jul 21, 2016 at 12:05
  • The video really helped. Look, what if you try wrapping the suspicious code with a try/catch block and try logging any possible error? I'm really uncomfortable with the idea that Chrome is causing this issue. Try logging any error and if there isn't any, place a "debugger;" instruction in another part of the code. Then we can find out if it's Chrome or not. Commented Jul 21, 2016 at 12:05
  • @kb I tried with no extensions, same thing. This is bizarre. I did have an extension loaded that was something like 'ADB Tools" or something that Chrome said was deprecated. I removed that ext from Chrome and that didn't do anything then I disabled everything and same problem. Commented Jul 21, 2016 at 12:57
  • @n0m4d I'm with you RE comfort level about a bug in Chrome but I have tried 'debugger' and same result. There are no exceptions being thrown. In the vid I have BPs set on like 3 sequential lines. Each hits then robotically resumes. Hard to believe but it's really happening. Never seen anything like this. Commented Jul 21, 2016 at 13:00

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.