简体   繁体   English

Chrome调试器中的这个十六进制值是多少?

[英]What is this hex value for in the Chrome debugger?

I am just curious as to why there appears to be a hex number associated with each source in this Chrome debugger output here ... 我很好奇为什么在这个Chrome调试器输出中出现与每个源相关联的十六进制数字...

WebSocket is already in CLOSING or CLOSED state.
(anonymous) @ websocket.js?13d9:192
exports.encodePacket @ browser.js?9636:123
(anonymous) @ websocket.js?13d9:170
WS.write @ websocket.js?13d9:202
Transport.send @ transport.js?87a5:110
Socket.flush @ socket.js?1006:565
Socket.sendPacket @ socket.js?1006:625
Socket.ping @ socket.js?1006:529
(anonymous) @ socket.js?1006:516
setTimeout (async)
Socket.setPing @ socket.js?1006:514
Socket.onPacket @ socket.js?1006:445
(anonymous) @ socket.js?1006:273
Emitter.emit @ index.js?ea2f:133
Transport.onPacket @ transport.js?87a5:145
Transport.onData @ transport.js?87a5:137
ws.onmessage @ websocket.js?13d9:147

For example, the source websocket.js correlates to 13d9 . 例如,source websocket.js13d9相关13d9

Where does this hex value come from and what is it used for? 这个十六进制值来自何处以及它用于什么?

I am not concerned with the actual error in this case, I'm just using it for an example. 我不关心这种情况下的实际错误,我只是用它作为一个例子。

This is part of your file's URL. 这是文件URL的一部分。

Can't tell for sure what does set it in this case, but it's a common way to avoid caching when updating a js file. 无法确定在这种情况下设置它是什么,但这是在更新js文件时避免缓存的常用方法。

Chrome's console output doesn't expose the column number, so what you have after the : is the line number. Chrome的控制台输出不会公开列号,因此您拥有的是:行号。

 const script = document.createElement('script'); const blob = new Blob([`const foo = "bar"; // should throw at line 3 throw new TypeError('not a baz');`], {type: "application/javacript"}); script.src = URL.createObjectURL(blob); document.head.appendChild(script); 

Results in 结果是

Uncaught TypeError: not a baz            blob:null/96273a46-9...a3b1-12d1f1f3355c:3
   at 96273a46-9f81-4eed-a3b1-12d1f1f3355c:3

来自Chrome控制台的错误消息

As you can see, only the line number is shown here, even though, the Error.stack message does expose the column number in the form script_url:lineno:colno 如您所见,此处仅显示行号,即使Error.stack消息确实以script_url:lineno:colno形式公开列号script_url:lineno:colno

 const script = document.createElement('script'); const blob = new Blob([`console.log(new Error('foo').stack);`], {type: "application/javacript"}); script.src = URL.createObjectURL(blob); document.head.appendChild(script); /* Error: foo at blob:null/[random-blob-url]:1:13 */ 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM