Skip to content
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

Improved stability for chrome debugging #893

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/debug/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,13 @@ def chrome_setup
require_relative 'server_cdp'

@uuid = SecureRandom.uuid
unless @chrome_pid = UI_CDP.setup_chrome(@local_addr.inspect_sockaddr, @uuid)
DEBUGGER__.warn <<~EOS
With Chrome browser, type the following URL in the address-bar:
@chrome_pid = UI_CDP.setup_chrome(@local_addr.inspect_sockaddr, @uuid)
DEBUGGER__.warn <<~EOS
With Chrome browser, type the following URL in the address-bar:

devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=#{@local_addr.inspect_sockaddr}/#{@uuid}
devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=#{@local_addr.inspect_sockaddr}/#{@uuid}

EOS
end
EOS
end

def accept
Expand Down
9 changes: 7 additions & 2 deletions lib/debug/server_cdp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ def deactivate_bp
def cleanup_reader
super
Process.kill :KILL, @chrome_pid if @chrome_pid
rescue Errno::ESRCH # continue if @chrome_pid process is not found
end

## Called by the SESSION thread
Expand All @@ -680,7 +681,7 @@ def sock skip: false
yield $stderr
end

def puts result
def puts result=''
# STDERR.puts "puts: #{result}"
# send_event 'output', category: 'stderr', output: "PUTS!!: " + result.to_s
end
Expand Down Expand Up @@ -744,7 +745,11 @@ def process_protocol_request req
request_tc [:cdp, :scope, req, fid]
when 'global'
vars = safe_global_variables.sort.map do |name|
gv = eval(name.to_s)
begin
gv = eval(name.to_s)
rescue Errno::ENOENT
gv = nil
end
prop = {
name: name,
value: {
Expand Down