Eclipse Wild Web Developer使用Chrome远程调试不会在JavaScript断点处停止

r6l8ljro  于 2022-11-04  发布在  Eclipse
关注(0)|答案(1)|浏览(209)

尽管通过端口9292与浏览器成功通信,但我无法在断点上获得Eclipse Wild Web Developer的最高停止点。
看看这个简单的页面:test.js

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html>
<head></head>
<body>
    <script src="test.js"></script>
</body>
</html>

和脚本,test.js

test = function() {
    console.log("############ this function was totally called!");
}

test();

我在Eclipse中安装了Chrome,它通过端口9292连接。在Eclipse控制台中,设置断点时,我看到以下内容:


############ this function was totally called!

....remove for brevity

From client: setBreakpoints({"source":{"name":"test.js","path":"/Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp/test.js"},"breakpoints":[{"line":4}],"lines":[4],"sourceModified":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"setBreakpointsRequest","data":{"Versions.DebugAdapterCore":"6.8.11","Versions.DebugAdapter":"4.13.0","Versions.Target.CRDPVersion":"1.3","Versions.Target.Revision":"@9f2101830b56fd2ea1408287f6c74e253ebcb7c6","Versions.Target.UserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","Versions.Target.V8":"10.6.194.18","Versions.Target.Project":"Chrome","Versions.Target.Version":"106.0.5249.119","fileExt":".js"}}}
SourceMaps.setBP: /Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp/test.js can't be resolved to a loaded script. It may just not be loaded yet.
Paths.setBP: No target url cached yet for client path: /Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp/test.js.
→ To target: "{\"id\":17,\"method\":\"DOMDebugger.setInstrumentationBreakpoint\",\"params\":{\"eventName\":\"scriptFirstStatement\"}}"
← From target: {"id":17,"result":{}}
To client: {"seq":0,"type":"response","request_seq":5,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1000,"verified":false,"message":"Breakpoint set but not yet bound"}]}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"ClientRequest/setBreakpoints","data":{"Versions.DebugAdapterCore":"6.8.11","Versions.DebugAdapter":"4.13.0","Versions.Target.CRDPVersion":"1.3","Versions.Target.Revision":"@9f2101830b56fd2ea1408287f6c74e253ebcb7c6","Versions.Target.UserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","Versions.Target.V8":"10.6.194.18","Versions.Target.Project":"Chrome","Versions.Target.Version":"106.0.5249.119","successful":"true","timeTakenInMilliseconds":"3.689982","requestType":"request"}}}

我这一行很关键:

SourceMaps.setBP: /Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp/test.js can't be resolved to a loaded script. It may just not be loaded yet

因为Eclipse基本上是告诉浏览器安装一个断点,但Chrome不知道该把它放在哪个文件中。
我不知道我需要做什么来让Chrome和Eclipse发现它们在谈论同一个文件。
我需要使用Eclipse JEE Developer Edition来解决这个问题,而不是WebClipse或其他平台。

quhf5bfb

quhf5bfb1#

我能够让这个工作,但不完全是“自动”的。像这些天的大多数事情一样,我们不再有模式定义,而是过度依赖于非结构化数据和示例。我读了很多它在vscode中是如何工作的,并且能够确定有一个名为pathMapping的设置。进一步深入了解源代码,我可以通过将此json放在Chrome Debug启动配置的Debug Adapter菜单下的Launch Parameters (Json):对话框中来使其工作:

{
   "pathMapping":{
      "pws-7.0.0.jsfc.js.jsf":"/Users/jonathan.fisher/dev/jsf-components/src/main/resources/META-INF/resources/js/pws-7.0.0.jsfc.js"
   }
}

json键是显示在浏览器中的文件名,值是指向工作区中打开的项目中的文件的完全限定路径。
chrome调试器并不提供JVM调试器所具有的所有功能(例如:条件断点),但是能够在一个地方完成所有的调试是很好的。

相关问题