Firefox 开发工具是否能够捕获所有错误?
Is Firefox dev tools able to catch all the error?
自从 Firebug 停产后,我不得不开始使用开发工具。
我正在调试一个页面,当我点击一个按钮时它没有触发事件。我意识到一个函数没有定义,缺少 JS 文件引用,但是开发工具没有告诉我。
尝试安装我的旧版本 Firebug 它抛出类似 "ReferenceError: foo function is not defined" 的东西。
我需要为 Dev Tools 启用更多选项吗?还是开发工具无法捕获所有错误?
更新
测试用例
<script type="text/javascript">
function DoSomething(e){
e.preventDefault();
foo();
}
</script>
<a href="www.google.com" onclick="DoSomething(event)">Click me!</a>
您需要确保 "JS" 过滤器在 控制台 面板中启用。
如果这对查看错误没有帮助,您可以尝试新的控制台前端。在版本 55 之前的 Firefox 中,可以通过转到 about:config
并将首选项 devtools.webconsole.new-frontend-enabled
设置为 true
来启用此功能。在那个新 UI 中,确保过滤器 "Errors" 和 "Warnings" 已启用。
如果您仍然看不到记录的错误,则可能是 DevTools 中的错误。在那种情况下,您应该尝试是否可以在 new Firefox profile. If you can also reproduce it in the new profile, you should report the bug (if there isn't one already; bug 755553 中重现该问题似乎是相关的)并且可以将 URL 配置到发生错误的页面或附加简化的测试用例。
自从 Firebug 停产后,我不得不开始使用开发工具。
我正在调试一个页面,当我点击一个按钮时它没有触发事件。我意识到一个函数没有定义,缺少 JS 文件引用,但是开发工具没有告诉我。
尝试安装我的旧版本 Firebug 它抛出类似 "ReferenceError: foo function is not defined" 的东西。
我需要为 Dev Tools 启用更多选项吗?还是开发工具无法捕获所有错误?
更新
测试用例
<script type="text/javascript">
function DoSomething(e){
e.preventDefault();
foo();
}
</script>
<a href="www.google.com" onclick="DoSomething(event)">Click me!</a>
您需要确保 "JS" 过滤器在 控制台 面板中启用。
如果这对查看错误没有帮助,您可以尝试新的控制台前端。在版本 55 之前的 Firefox 中,可以通过转到 about:config
并将首选项 devtools.webconsole.new-frontend-enabled
设置为 true
来启用此功能。在那个新 UI 中,确保过滤器 "Errors" 和 "Warnings" 已启用。
如果您仍然看不到记录的错误,则可能是 DevTools 中的错误。在那种情况下,您应该尝试是否可以在 new Firefox profile. If you can also reproduce it in the new profile, you should report the bug (if there isn't one already; bug 755553 中重现该问题似乎是相关的)并且可以将 URL 配置到发生错误的页面或附加简化的测试用例。