Reputation: 36473
Here are the versions:
When I run the site on localhost through Visual Studio, with IE set to IE8 mode and javascript enabled, the browser will crash when the page is reloaded. It doesn't crash when URL is changed or tab/window closed. The messages I get are:
VS JIT message:
An unhandled win32 exception occurred in iexplore.exe [some PID].
Error when debugging with VS:
Unhandled exception at 0x3fa078d8 in iexplore.exe: 0xC0000005: Access violation reading location 0x00000008.
Call stack location: mshtml.dll!3fa078d8()
3FA078D8 mov eax,dword ptr [ebx+8]
When I cancel out of debugging the page usually loads just fine in the tab. Every now and then I'll get the "We were unable to return you to the page you were viewing." message.
To make it even more fun, this only happens on the home page of the site, and isn't reproduceable on the DEV server. Switching to IE7 mode makes the crashes never occur. Or commenting out some of the javascript files loaded at the bottom of the page.
I've tried running IE8 with Addons disabled, and the crashes still happen. I tried running with Fiddler enabled and it still crashes.
Upvotes: 2
Views: 2496
Reputation: 36473
I think the crashes may have been related to the use of window.setTimeout()
and window.setInterval()
since they seem to be the only common functionality used across the different JS files that cause the project to stop crashing when commented out. In our global.js I've added this code to use instead:
(function (w) {
w.windowBind = function (eventName, handler) {
if (w.attachEvent) {
w.attachEvent("on" + eventName, handler);
} else if (w.addEventListener) {
w.addEventListener(eventName, handler, false);
}
};
var timeoutsToExpire = [],
expireTimeouts = function () {
for (var i = 0, l = timeoutsToExpire.length; i < l; i++) {
w.clearTimeout(timeoutsToExpire[i]);
}
timeoutsToExpire = [];
},
intervalsToExpire = [],
expireIntervals = function () {
for (var i = 0, l = intervalsToExpire.length; i < l; i++) {
w.clearInterval(intervalsToExpire[i]);
}
intervalsToExpire = [];
};
w.setExpiringTimeout = function (func, time) {
var id = w.setTimeout(func, time);
timeoutsToExpire.push(id);
return id;
};
w.setExpiringInterval = function (func, time) {
var id = w.setInterval(func, time);
intervalsToExpire.push(id);
return id;
};
w.windowBind("unload", function () {
// expire timers
expireTimeouts();
expireIntervals();
});
w.windowBind("beforeunload", function () {
// expire timers
expireTimeouts();
expireIntervals();
});
})(window);
Then I updated the previous window.setTimeout()
and window.setInterval()
references to use these helpers instead. This seems to fix it for now.
Update: maybe I posted too soon, it just crashed for me again. They seem to be very intermittent now though.
Update 2: ok, it seems to happen reliably when I shift+refresh now, ugh.
Update 3: tried out latest jQuery RC, and the crashes went away, the release notes mention 2 IE8 crashing bugs: http://blog.jquery.com/2011/08/29/jquery-1-6-3-rc1-released/
Upvotes: 5