【问题标题】:Chrome paused on exception within a try/catch block, how to auto resume?Chrome 在 try/catch 块内因异常暂停,如何自动恢复?
【发布时间】:2012-04-03 16:02:07
【问题描述】:

我正在使用 PrimeFaces (3.2),但我认为这个问题与 Chrome 有关。

除非我打开 Chrome 调试窗口,否则一切正常。即,如果我关闭调试窗口,则没有发生错误,根本没有异常(见下文,异常是 try/catch-ed)。

但是,如果我打开 Chrome 调试窗口,并对网页执行某些操作,则调试器会在以下位置暂停:

if ( !Sizzle.isXML( node ) ) {
    try { 
        if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
            var ret = matches.call( node, expr ); <----- Paused here.

            // IE 9's matchesSelector returns false on disconnected nodes
            if ( ret || !disconnectedMatch ||
                    // As well, disconnected nodes are said to be in a document
                    // fragment in IE 9, so check for that
                    node.document && node.document.nodeType !== 11 ) {
                return ret;
            }
        }
    } catch(e) {}
}

这里 node=&lt;div ... 和 expr=:hidden。 查了jQuery源码,Chrome似乎不支持node.querySelectorAll(':hidden'),

为什么 Chrome 会在 try/catch 块中暂停?以及如何让它不再暂停?

Chrome 版本:17

【问题讨论】:

    标签: jquery debugging google-chrome


    【解决方案1】:

    您是否在开发者控制台的“脚本”选项卡中无意中启用了“异常暂停”选项?这是此屏幕截图中从左数第四个图标:

    如果图标突出显示为蓝色,则表示它已启用,任何异常都会导致脚本暂停,就像您在此处设置断点一样,因此您可以对其进行调试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-30
      • 1970-01-01
      • 2020-12-16
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 1970-01-01
      • 2015-04-18
      相关资源
      最近更新 更多