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

Continue the debuggee after detaching to Chrome #381

Merged
merged 1 commit into from
Nov 25, 2021
Merged
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
7 changes: 7 additions & 0 deletions lib/debug/server_cdp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ module DEBUGGER__
module UI_CDP
SHOW_PROTOCOL = ENV['RUBY_DEBUG_CDP_SHOW_PROTOCOL'] == '1'

class Detach < StandardError
end

class WebSocket
def initialize s
@sock = s
Expand Down Expand Up @@ -56,7 +59,9 @@ def extract_data
first_group = @sock.getbyte
fin = first_group & 0b10000000 != 128
raise 'Unsupported' if fin

opcode = first_group & 0b00001111
raise Detach if opcode == 8
raise "Unsupported: #{opcode}" unless opcode == 1

second_group = @sock.getbyte
Expand Down Expand Up @@ -229,6 +234,8 @@ def process
@q_msg << req
end
end
rescue Detach
@q_msg << 'continue'
end

def get_source_code path
Expand Down