Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
323 views
in Technique[技术] by (71.8m points)

javascript - JavaScript:有没有办法让Chrome破解所有错误?(JavaScript: Is there a way to get Chrome to break on all errors?)

I am looking for an equivalent in Chrome to the "break on all errors" functionality of Firebug.

(我正在寻找Chrome中与Firebug“破解所有错误”功能相同的功能。)

In the Scripts tab, Chrome has a "pause on all exceptions", but this is not quite the same as breaking on all errors.

(在“脚本”选项卡中,Chrome有一个“暂停所有异常”,但这与打破所有错误并不完全相同。)

For instance, when loading a page with the following code, I would like Chrome to break on the line foo.bar = 42 .

(例如,当使用以下代码加载页面时,我希望Chrome在foo.bar = 42foo.bar = 42 。)

Instead, even when enabling the "Pause on all exceptions", I don't get the expected result.

(相反,即使启用“暂停所有异常”,我也无法获得预期的结果。)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <script type="text/javascript">

            function doError() {
                foo.bar = 42;
            }

            window.onload = function() {
                try {
                    doError();
                } catch (e) {
                    console.log("Error", e);
                }
            }
        </script>
    </head>
    <body>
    </body>
</html>

You can try the code pasted above on this page or using this jsFiddle .

(您可以尝试在此页面上粘贴的代码或使用此jsFiddle 。)

  ask by avernet translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I got trouble to get it so I post pictures showing different options:

(我很难得到它所以我张贴了显示不同选项的图片:)

Chrome 75.0.3770.142 [29 July 2018](Chrome 75.0.3770.142 [2018年7月29日])

Very very similar UI since at least Chrome 38.0.2125.111 [11 December 2014]

(至少非常相似的用户界面至少Chrome 38.0.2125.111 [2014年12月11日])

In tab Sources :

(在标签Sources :)

在此输入图像描述

When button is activated, you can Pause On Caught Exceptions with the checkbox below:

(激活按钮后,您可以使用下面的复选框Pause On Caught Exceptions :)

在此输入图像描述

Previous versions(之前的版本)

Chrome 32.0.1700.102 [03 feb 2014]

(Chrome 32.0.1700.102 [2014年2月3日])

在此输入图像描述

在此输入图像描述在此输入图像描述在此输入图像描述

Chrome 27.0.1453.93 Stable

(Chrome 27.0.1453.93稳定)

调试选项


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...