Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

ShowDevTools fired before debugger is ready #125

Open
JavaScriptDude opened this issue Jul 17, 2015 · 3 comments
Open

ShowDevTools fired before debugger is ready #125

JavaScriptDude opened this issue Jul 17, 2015 · 3 comments

Comments

@JavaScriptDude
Copy link

As discussed in my StackOverflow post, the DevTools is shown before the debugger is ready to start executing breakpoints. This makes it difficult to debug breakpoints in the boot code of an electron app. The only workaround is to add an adhoc timeout to wait until the devtools debugger "should" be ready assert breakpoints in client code.

I found a comment in the atom => devtools shim /atom/brightray/blob/master/browser/inspectable_web_contents_impl.cc where in method InspectableWebContentsImpl::ShowDevTools() states the following:

  // Show devtools only after it has done loading, this is to make sure the
  // SetIsDocked is called *BEFORE* ShowDevTools.

The statement "Show devtools only after it has done loading" is not really satisfied IMO as the debugger is not ready to start asserting breakpoints.

Is it possible to look at updating this method so the Dev Tools is tested to see if its ready to start asserting breakpoints before the dev tools is actually shown? Maybe we can add a flag in the package.json that the ShowDevTools method looks for to assert that the debugger is fully ready?

@JavaScriptDude
Copy link
Author

I was reviewing the code and was thinking that it may be more agreeable to all if we were to conditionally spawn a new thread that watches for Dev Tools debugger to be read and once the ready state is detected emit an event back to the user in JavaScript. This way we can turn this on only if specified in package.json and the code will not interrupt the existing execution chain.

@JavaScriptDude
Copy link
Author

Please find a simplified test case for this issue in Electron.

@zcbenz zcbenz added the bug label Aug 4, 2015
@zcbenz
Copy link
Contributor

zcbenz commented Aug 4, 2015

I can confirm this bug, the time devtools-opened is emitted is actually when devtools is loaded completely, but debugger only works after a few time later, which I guess is when devtools has setup connection with the inspected page. Chromium didn't expose an event for this, I think it is because people usually open the devtools and then reload to stop at the breakpoint.

@stale stale bot added the wontfix label Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants