Skip to content

Commit a6fc579

Browse files
ono-maxko1
authored andcommitted
Use file scheme instead of http scheme in Page pane
1 parent 4eaa725 commit a6fc579

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/debug/server_cdp.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,14 +393,13 @@ def process
393393
@q_msg << req
394394
when 'Debugger.setBreakpointByUrl'
395395
line = req.dig('params', 'lineNumber')
396-
url = req.dig('params', 'url')
397-
if url.match /http:\/\/debuggee(.*)/
398-
path = $1
396+
if regexp = req.dig('params', 'urlRegex')
397+
path = regexp.match(/(.*)\|/)[1].gsub("\\", "")
399398
cond = req.dig('params', 'condition')
400399
src = get_source_code path
401400
end_line = src.lines.count
402401
line = end_line if line > end_line
403-
b_id = "1:#{line}:#{path}"
402+
b_id = "1:#{line}:#{regexp}"
404403
if cond != ''
405404
SESSION.add_line_breakpoint(path, line + 1, cond: cond)
406405
else
@@ -412,11 +411,18 @@ def process
412411
req['params']['lineNumber'] = line
413412
req['params']['breakpointId'] = b_id
414413
@q_msg << req
415-
else
414+
elsif url = req.dig('params', 'url')
416415
b_id = "#{line}:#{url}"
417416
send_response req,
418417
breakpointId: b_id,
419418
locations: []
419+
elsif hash = req.dig('params', 'scriptHash')
420+
b_id = "#{line}:#{hash}"
421+
send_response req,
422+
breakpointId: b_id,
423+
locations: []
424+
else
425+
raise 'Unsupported'
420426
end
421427
when 'Debugger.removeBreakpoint'
422428
b_id = req.dig('params', 'breakpointId')
@@ -643,7 +649,6 @@ def cdp_event args
643649
end
644650
frame[:location][:scriptId] = s_id
645651
frame[:functionLocation][:scriptId] = s_id
646-
frame[:url] = "http://debuggee#{path}"
647652
@ui.fire_event 'Debugger.scriptParsed',
648653
scriptId: s_id,
649654
url: frame[:url],

0 commit comments

Comments
 (0)