[英]Chrome Extension not loading/ code environment not selectable in Inspector/ Dev tools
[英]Go to source code line in Chrome dev tools extension?
我想制作一个开发工具Chrome扩展程序 ,让用户可以访问页面源代码中的特定点(每当页面的源代码调用我通过扩展内容脚本注入页面的某个全局函数foo
)。
我可以通过让函数foo
抛出异常然后捕获它来获得堆栈跟踪。
但是,如何告诉Chrome开发工具导航到源代码中的某一行? 是否有API调用?
有一个API函数, chrome.devtools.panels.openResource
。
请注意,此API的行号从零开始。
// Opens line 34 of file https://example.com/test.js, assuming this resource is present:
chrome.devtools.panels.openResource("https://example.com/test.js", 33, function() {
// Resource should be open, but no way to test that it succeeded
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.