调试AngularJS Internet Explorer的禁售AngularJS、Internet、Explorer

2023-09-13 02:41:03 作者:我与地狱同欢

我已经得到了与IE10的一个问题,我可以很容易地复制。通过几页我的应用程序蹦跳着后,IE完全锁定了(没有长时间运行脚本的警告,只是完全冻结)。我必须从任务管理器杀死它。我已禁用所有加载项,并有一个干净的石板。我在一个相当大的工作站(Win7的,16GB内存,i7处理器,脚本非常重要)上运行。

I've got a problem with IE10 that I can duplicate readily. After bouncing around in my app through a few pages, IE entirely locks up (no "long running script" warning, just entirely frozen). I have to kill it from the Task Manager. I've disabled all add-ons and have a clean slate. I'm running on a sizeable workstation (Win7, 16GB ram, i7, yadda yadda).

它不会在Chrome或Firefox冻结。只有IE10和IE11。

It doesn't freeze in Chrome or Firefox. Only IE10 and IE11.

关于我的应用

我与工业控制系统集成,以显示我的系统的工作状态。我有很多XHR轮询回事(将被转移到WebSocket的,但现在,这很容易与我的API集成)。从每500ms的端点,它在页面上更新了一堆字段刷新数据。

I'm integrating with an industrial control system to show the active status of my system. I have a lot of XHR polling going on (will be moving to WebSocket, but for now, this is easy to integrate with my API). Refreshing data from an endpoint every 500ms, which updates a bunch of fields on the page.

当应用程序不结冰,很高兴,爽快导航通过。无法找到导致冻结的任何具体情况。

When the app isn't frozen, it's nice and snappy to navigate through. Can't find any specific condition that causes the freeze.

在任何给定的时间,我的应用程序有75手表之间$ 400(计算使用this回答)。

At any given time, my app has between 75 and 400 $watches (counted using this answer).

目前运行AngularJS V1.3.0-rc.4。在1.2.25也有类似的锁定。

Currently running AngularJS v1.3.0-rc.4. Had similar lockups on 1.2.25.

所以,我的问题

我怎么连去有关调试呢?我试过离开F12开发工具开放,并没有被输出到控制台。行书分析器(Batarang不是在IE可用)显示,我花了200ms左右(含)每10秒在$摘要。做什么我尝试下?

How do I even go about debugging this? I've tried leaving F12 Developer Tools open, and nothing gets outputted to the console. Running script profiler (Batarang not available in IE) shows that I spend about 200ms (inclusive) every 10s in the $digest. What do I try next?

推荐答案

哎哟,我产生共鸣。

你能分开的关注?测试你的前端与服务的模拟不使用XHR(以 NG-重复的DOM部分),看看你是否遇到同样的问题。您也可以尝试没有它钩住你的前端测试XHR服务。 (例如,你可以有,只有具有类似℃的测试视图;跨度> {{myDataArray}}< / SPAN> ,避免了NG-重复的问题,用于测试目的)。基本上,尝试在一半分裂问题,看看你是否仍然可以重复的问题。

Can you separate the concerns? Test your frontend (the DOM portion with ng-repeat) with a mock of your service that doesn't use XHR, and see if you run into the same issue. You can also try testing the XHR service without hooking it to your frontend. (For instance, you could have a test view that only has something like <span>{{myDataArray}}</span>, to avoid the ng-repeat issue, for testing purposes.) Basically, try to split the issue in half and see if you can still duplicate the problem.

基本上,我的推理是这样的;如果你嘲笑你的服务,仍然轮询每500毫秒,你碰到的问题,您可以与IE浏览器的DOM更新的问题。如果不碰到的问题,但您测试真正的服务和IE冻结,然后在某个地方与XHR一个问题(也许你的投票时间?)或者一个问题与角度的观测系统。

Basically, my reasoning is this; if you mock your service and still poll every 500ms, and you run into the problem, you may have an issue with IE's DOM updates. If you don't run into the problem, but you test the real service and IE freezes, then there's a problem with XHR somewhere (perhaps your polling time?) or perhaps an issue with Angular's watch system.

我希望能有更多的帮助在这里,但是这就是我想要开始。试图通过剔除一些code,以缩小问题。这不会是乐趣,但如果你已经采用了棱角分明的最佳实践(即依赖注入和关注点分离),这将是痛苦少写你的申请。

I wish I could be of more help here, but this is where I'd start. Attempt to narrow down the problem by culling some code. It won't be fun, but if you've written your application using Angular's best practices (namely, dependency injection and separation of concerns) it'll be less painful.

的 TL; DR - 那我试下?你将不得不开始扑杀聪明一些code,看看什么可行,什么不可行。的