JQuery 和IE8崩溃检测
最近,我被要求帮助调试一个导致 IE8 在某些条件下崩溃的网站问题。拥有该网站的公司无法重现该问题,但他们收到了受影响用户的许多报告。
我能够重现该问题,并最终发现它是由 此 jQuery/IE 8 问题< /a>.当使用 CSS 将背景图像应用到 body
标记并加载 jQuery 时,就会出现此问题。关于 jQuery bug 票证评论的帖子提供了这个 jsFiddle 示例,至少对我来说,一致地重现问题。
- 使用 IE8 访问 http://fiddle.jshell.net/ZKPZq/6/。
- 右键单击结果屏幕,然后刷新 - IE8 将崩溃
我遇到的问题是在测试环境中可靠地重现这一点。任何人都可以建议测试此类事情的方法吗?尽管复制了 jsFiddle 示例使用的确切代码,但我无法在本地一致地重现问题 - 它可能依赖于特定的时间,但我不确定。我想在自动化测试套件中添加一些内容来检查此问题(之前已应用了 jQuery 修复,但在后续版本中意外删除)。
如何测试浏览器崩溃情况?该站点是用 Perl 编写的,一些自动化测试是使用 Selenium 和 WWW::Mechanize 进行的。
I was recently asked to help debug an issue with a website that caused IE8 to crash under certain conditions. The company that owns the website was unable to reproduce the problem, but they were receiving many reports from affected users.
I was able to reproduce the problem, and eventually found that it was being caused by this jQuery/IE 8 issue. The problem occurs when a background image is applied to the body
tag using CSS, and jQuery is loaded. A post on the jQuery bug ticket comments provided this jsFiddle example, which, for me at least, reproduces the problem consistently.
- Go to http://fiddle.jshell.net/ZKPZq/6/ with IE8.
- Right click in the result screen, and make it refresh - IE8 will crash
The problem I have is reproducing this reliably in a test environment. Can anyone suggest methods to test for this sort of thing? Despite copying the exact code used by the jsFiddle example, I am unable to consistently reproduce the problem locally - it may rely on particular timing, but I'm not sure. I would like to add something to the automated test suite that checks for this problem (the jQuery fix had been applied previously, and accidentally removed in a later version).
How can I test for browser crashes? The site is written in Perl, and some automated tests are carried out using Selenium and WWW::Mechanize.
Note: I considered posting this on Pro Webmasters, but having read the FAQ, I think it is more suited to SO.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为除了使用尽可能广泛的因素组合来运行单元测试和压力测试之外,您别无选择。
这就是所谓的“Mandelbugs”的本质。
I don't think you can do anything other than run both unit tests and stress tests with as wide a variety of combinations of factors as possible.
This is the nature of so-called "Mandelbugs".
鉴于唯一一致的事情似乎是,如果在样式声明之前加载 JQ 不会有问题,我会尝试将 JQ 设置为在 CSS 声明/链接的 CSS 文件加载后以不同的时间间隔加载。
从样式刚建立之后到 DOM 准备好之后。我的猜测是 JQ 引用了 IE8 已经可以访问的东西,但由于 DOM 加载过程中发生了一些非常愚蠢的事情,它还没有准备好共享。
我见过多次开发人员工具在 IE8 中永久崩溃的事件,即使您重新打开应用程序也是如此。如果不是这样,我认为此类错误不太可能出现。
编辑:公平地说,JQ 可能在 1.62 中做了一些奇怪的事情,否则这个错误通常会更广为人知。 IE8 已经发布几年了。
Given that the only consistent thing appears to be that there's not a problem if you load JQ before the style declaration, I would try setting the JQ to load at different intervals after the CSS declaration/linked CSS file loads.
From immediately after the style is established to well after DOM ready. My guess would be that JQ references something IE8 has made accessible that it wasn't ready to share just yet as a result of something really silly going on in its DOM-loading process.
I've seen multiple incidents of developer tools crashing permanently in IE8 even after you re-open the app. If not for that I'd consider such bugs unlikely.
Edit: To be fair, JQ is probably doing something odd in 1.62 or this bug would be more well-known in general. IE8 has been out a few years now.
您可以尝试使用一些提供跨平台、跨浏览器测试的
SauceLabs
产品进行测试能力。You can try testing with some of
SauceLabs
offerings which provide cross-platform, cross-browser testing capabilities.