首页 > 解决方案 > 插件中的全局错误处理程序阻止页面在 Firefox 中加载

问题描述

我有一个 Firefox 插件,它onerror在脚本中有一个全局处理程序,content.js如下所示:

window.onerror = error => {
  console.log('On Error Handler');
  console.log(error);
}

这在任何其他站点似乎都不是问题。但是当我尝试登录https://www.mint.com时,登录后它不会加载页面。这仅在 Firefox 中发生,并且仅适用于该网站(据我所知)。如果我注释掉onerror处理程序,它会起作用。

当页面未加载时,我看到这两个错误:

Error: Permission denied to access property "apply"

TypeError: window.ADRUM.events.VPageView is not a constructor

有没有人遇到过这个问题,或者知道为什么onerror处理程序会导致问题?

这是我为测试问题而创建的一个简单的 Firefox 插件:ff-addon-example

标签: javascripterror-handlingfirefox-addononerror

解决方案


推荐阅读