简体   繁体   English

Chrome 断点停止工作 - 查看具有 VM 前缀的不同文件

[英]Chrome breakpoints stopped working - looking at different file with a VM prefix

All of a sudden, my breakpoints in Chrome stopped working entirely.突然之间,我在 Chrome 中的断点完全停止工作。 The weird thing is if I hit an error in the code and break that way, or if I add debugger;奇怪的是,如果我在代码中遇到错误并以这种方式中断,或者我添加了调试器; anywhere in my code, it does stop, but it opens a different file with a prefix like VM[number].在我的代码中的任何地方,它都会停止,但它会打开一个不同的文件,其前缀类似于 VM[number]。

The file that shows naturally in the development console that breakpoints don't work in is entitled main.js, but when I encounter an error or stop through the debugger command, it opens a new file called "VM113 main.js".在开发控制台中自然显示断点不起作用的文件名为 main.js,但是当我遇到错误或通过调试器命令停止时,它会打开一个名为“VM113 main.js”的新文件。 The even weirder thing is if I follow the code into a different file, like jquery.js, it also doesn't go into the jquery.js file but into a file called "VM97 jquery.js" or "VM98 jquery-ui.js".更奇怪的是,如果我按照代码进入一个不同的文件,比如 jquery.js,它也不会进入 jquery.js 文件,而是进入一个名为“VM97 jquery.js”或“VM98 jquery-ui”的文件。 js”。

What's going on and how do I get Chrome to look at the actual files rather than VM files?发生了什么以及如何让 Chrome 查看实际文件而不是 VM 文件?

In my personal research, this is caused by having an accented character in the file path of the file in which I'm attempting to place a breakpoint.在我个人的研究中,这是由于我试图在其中放置断点的文件的文件路径中有重音字符引起的。

Suppose you have two files, HäagenDazs/main.js and HaagenDazs/main.js (named for the sake of example) and they both contain (roughly) the same thing:假设您有两个文件, HäagenDazs/main.jsHaagenDazs/main.js (为了示例而命名)并且它们都包含(大致)相同的内容:

var x = function () {}; and var y = function () {};var y = function () {};

If you place a breakpoint in HäagenDazs/main.js , Chrome will delete it and set it in VM-### main.js at the same location.如果您在HäagenDazs/main.js放置断点,Chrome 将删除它并将其设置在VM-### main.js中的同一位置。 If you place a breakpoint in HaagenDazs/main.js , Chrome keeps it there in the original file.如果您在HaagenDazs/main.js放置断点,Chrome 会将其保留在原始文件中。

It seems to be the combination of an accented character anywhere in the path and having the keyword function present in that file.它似乎是路径中任何地方的重音字符和该文件中存在关键字function的组合。 I tested this in OS X 10.10 using Chrome Version 38.0.2125.122.我在 OS X 10.10 中使用 Chrome 版本 38.0.2125.122 对此进行了测试。

I completely uninstalled Chrome and reinstalled it and that seemed to fix the issue.我完全卸载了 Chrome 并重新安装了它,这似乎解决了这个问题。 I do not know what caused it to start this behavior, but a reinstall solved it.我不知道是什么原因导致它开始这种行为,但重新安装解决了它。

I've just experienced the same issue and got a solution, so I'll leave it here just for the record.我刚刚遇到了同样的问题并得到了解决方案,所以我将它留在这里仅供记录。

In my case, it was because that particular website used service workers, and they provided an additional level of JS caching 'ahead' of the local overrides where I had placed my breakpoints.就我而言,这是因为该特定网站使用了服务工作者,并且他们在我放置断点的本地覆盖“之前”提供了额外的 JS 缓存级别。

So the execution always stopped in a [VM] tab that did not contain any of the changes that I had in those overrides.因此,执行总是在 [VM] 选项卡中停止,该选项卡不包含我在这些覆盖中所做的任何更改。

The solution was to go into the Application menu.解决方案是进入应用程序菜单。 There, in the Service Workers section, I checked the 'Offline' and 'Bypass for network' options, then clicked on 'Unregister' on the far right side.在那里,在 Service Workers 部分,我选中了“离线”和“绕过网络”选项,然后单击最右侧的“取消注册”。

Chrome 开发控制台屏幕截图:应用程序菜单

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

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