-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow debugger to be attached from Inspector page in Chrome #772
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ono-max
force-pushed
the
patch-77
branch
3 times, most recently
from
October 22, 2022 13:41
fd75728
to
4e7c600
Compare
ono-max
force-pushed
the
patch-77
branch
19 times, most recently
from
October 23, 2022 05:52
367dde6
to
4922b0c
Compare
ko1
reviewed
Oct 24, 2022
ono-max
force-pushed
the
patch-77
branch
4 times, most recently
from
October 24, 2022 11:45
c9fbb7d
to
deb3208
Compare
ko1
reviewed
Oct 25, 2022
lib/debug/server.rb
Outdated
Comment on lines
164
to
169
when /^GET \/json\/version HTTP\/1.1/ | ||
require 'json' | ||
|
||
@repl = false | ||
body = { | ||
Browser: "ruby/v#{RUBY_VERSION}", | ||
'Protocol-Version': "1.1" | ||
} | ||
send_http_res body | ||
raise RetryConnection | ||
|
||
when /^GET \/json HTTP\/1.1/ | ||
require 'json' | ||
|
||
@repl = false | ||
addr = @local_addr.inspect_sockaddr | ||
body = [{ | ||
description: "ruby instance", | ||
devtoolsFrontendUrl: "devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=#{addr}/#{@uuid}", | ||
id: @uuid, | ||
title: $0, | ||
type: "json", | ||
url: "file://#{File.absolute_path($0)}", | ||
webSocketDebuggerUrl: "ws://#{addr}/#{@uuid}" | ||
}] | ||
send_http_res body | ||
raise RetryConnection | ||
|
||
when /^GET \/#{@uuid} HTTP\/1.1/ | ||
require_relative 'server_cdp' | ||
|
||
self.extend(UI_CDP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
when /^GET \/json\/version HTTP\/1.1/ | |
require 'json' | |
@repl = false | |
body = { | |
Browser: "ruby/v#{RUBY_VERSION}", | |
'Protocol-Version': "1.1" | |
} | |
send_http_res body | |
raise RetryConnection | |
when /^GET \/json HTTP\/1.1/ | |
require 'json' | |
@repl = false | |
addr = @local_addr.inspect_sockaddr | |
body = [{ | |
description: "ruby instance", | |
devtoolsFrontendUrl: "devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=#{addr}/#{@uuid}", | |
id: @uuid, | |
title: $0, | |
type: "json", | |
url: "file://#{File.absolute_path($0)}", | |
webSocketDebuggerUrl: "ws://#{addr}/#{@uuid}" | |
}] | |
send_http_res body | |
raise RetryConnection | |
when /^GET \/#{@uuid} HTTP\/1.1/ | |
require_relative 'server_cdp' | |
self.extend(UI_CDP) | |
when /^GET \/json\/version HTTP\/1.1/, /^GET \/json HTTP\/1.1/, /^GET \/#{@uuid} HTTP\/1.1/ | |
require_relative 'server_cdp' | |
self.extend(UI_CDP) | |
self.cdp_launch g |
ko1
reviewed
Oct 25, 2022
lib/debug/server.rb
Outdated
@@ -4,6 +4,7 @@ | |||
require 'etc' | |||
require_relative 'config' | |||
require_relative 'version' | |||
require 'securerandom' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
load only on CDP.
ono-max
force-pushed
the
patch-77
branch
7 times, most recently
from
October 30, 2022 04:13
053144c
to
30586b7
Compare
ono-max
force-pushed
the
patch-77
branch
2 times, most recently
from
November 6, 2022 14:02
1f31fd5
to
9dba72b
Compare
ono-max
force-pushed
the
patch-77
branch
2 times, most recently
from
November 13, 2022 12:27
8ee6148
to
de34ceb
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Screen.Recording.2022-10-22.at.21.02.51.mov
When node.js users use Chrome DevTools debugging, they open
chrome://inspect
, then click the link on the page and start debugging it.https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27
This PR supports this feature.
How to use it
9229
is the default port on the Inspector page in chrome.chrome://inspect
, then target will be shown up.