{"action":"created","issue":{"url":"https://api.github.com/repos/atom/brightray/issues/125","labels_url":"https://api.github.com/repos/atom/brightray/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/atom/brightray/issues/125/comments","events_url":"https://api.github.com/repos/atom/brightray/issues/125/events","html_url":"https://github.com/atom/brightray/issues/125","id":95766637,"number":125,"title":"ShowDevTools fired before debugger is ready","user":{"login":"JavaScriptDude","id":4992230,"avatar_url":"https://avatars.githubusercontent.com/u/4992230?v=3","gravatar_id":"","url":"https://api.github.com/users/JavaScriptDude","html_url":"https://github.com/JavaScriptDude","followers_url":"https://api.github.com/users/JavaScriptDude/followers","following_url":"https://api.github.com/users/JavaScriptDude/following{/other_user}","gists_url":"https://api.github.com/users/JavaScriptDude/gists{/gist_id}","starred_url":"https://api.github.com/users/JavaScriptDude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JavaScriptDude/subscriptions","organizations_url":"https://api.github.com/users/JavaScriptDude/orgs","repos_url":"https://api.github.com/users/JavaScriptDude/repos","events_url":"https://api.github.com/users/JavaScriptDude/events{/privacy}","received_events_url":"https://api.github.com/users/JavaScriptDude/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-17T23:48:51Z","updated_at":"2015-07-19T19:50:37Z","closed_at":null,"body":"As discussed in my [StackOverflow post](http://stackoverflow.com/questions/31306452/atom-electron-detect-dev-tools-ready), 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.\r\n\r\nI found a comment in the atom => devtools shim [/atom/brightray/blob/master/browser/inspectable_web_contents_impl.cc](https://github.com/atom/brightray/blob/master/browser/inspectable_web_contents_impl.cc) where in method `InspectableWebContentsImpl::ShowDevTools()` states the following:\r\n```\r\n  // Show devtools only after it has done loading, this is to make sure the\r\n  // SetIsDocked is called *BEFORE* ShowDevTools.\r\n```\r\n\r\nThe statement \"Show devtools only after it has done loading\" is not really satisfied IMO as the debugger is not ready to start asserting breakpoints.\r\n\r\nIs 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?"},"comment":{"url":"https://api.github.com/repos/atom/brightray/issues/comments/122697949","html_url":"https://github.com/atom/brightray/issues/125#issuecomment-122697949","issue_url":"https://api.github.com/repos/atom/brightray/issues/125","id":122697949,"user":{"login":"JavaScriptDude","id":4992230,"avatar_url":"https://avatars.githubusercontent.com/u/4992230?v=3","gravatar_id":"","url":"https://api.github.com/users/JavaScriptDude","html_url":"https://github.com/JavaScriptDude","followers_url":"https://api.github.com/users/JavaScriptDude/followers","following_url":"https://api.github.com/users/JavaScriptDude/following{/other_user}","gists_url":"https://api.github.com/users/JavaScriptDude/gists{/gist_id}","starred_url":"https://api.github.com/users/JavaScriptDude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JavaScriptDude/subscriptions","organizations_url":"https://api.github.com/users/JavaScriptDude/orgs","repos_url":"https://api.github.com/users/JavaScriptDude/repos","events_url":"https://api.github.com/users/JavaScriptDude/events{/privacy}","received_events_url":"https://api.github.com/users/JavaScriptDude/received_events","type":"User","site_admin":false},"created_at":"2015-07-19T19:50:37Z","updated_at":"2015-07-19T19:50:37Z","body":"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."}}