This commit is contained in:
aozhiwei 2019-10-12 14:04:07 +08:00
parent 87bd27537a
commit daf4976964
2 changed files with 18 additions and 2 deletions

View File

@ -1,6 +1,15 @@
def _b_cmd(browser, tab, scriptmgr, params):
pass
filename = params[0].split(':')[0]
line = int(params[0].split(':')[1])
url = scriptmgr.getUrl(filename)
print(params, url)
tab.call_method("Debugger.setBreakpointByUrl",
lineNumber=line,
url=url,
columnNumber=0,
condition=''
)
def _p_cmd(browser, tab, scriptmgr, params):
pass
@ -13,6 +22,7 @@ def _processCdbCmd(cmd_str, browser, tab, scriptmgr):
'b': _b_cmd,
'p': None,
}
print(cmdlist)
if cmdlist[0] in cmd_hash:
cmd_hash[cmdlist[0]](browser, tab, scriptmgr, cmdlist[1:])
else:
@ -25,7 +35,7 @@ def processCmd(browser, tab, scriptmgr):
if cmdline[0] == '!':
msg = eval(cmdline[1:])
else:
_processCdbCmd(cmdline[1:], browser, tab, scriptmgr)
_processCdbCmd(cmdline, browser, tab, scriptmgr)
except Exception as e:
print(e)

View File

@ -8,3 +8,9 @@ class ScriptMgr:
def debuggerOnScriptParsed(self, **kwargs):
self.scripts.append(kwargs)
def getUrl(self, filename):
for script in self.scripts:
if filename in script['url']:
return script['url']
return None