我公司开发了一个Web应用程序。用户控件,当点击某个部分(以及执行相应的js)时,IE(7)完全崩溃(但不是8)。我查看了内存转储,并在iexplore中获得了c00000fd堆栈。可能是javascript递归?有趣的是,在同一台机器上,这只会发生在某些用户帐户(即那些不是开发人员的帐户)上。提出了一个案例来审查用户的组策略(每个用户存在差异)。
js看起来像这样(我认为相关的部分):
function expandNode(content, divID)
{
var ids = divID.split("|");
// if (ids.length == 4) {
var level = ids[0];
var div = document.getElementById(ids[1]);
var img = document.getElementById(ids[2]);
var connector = document.getElementById(ids[3]);
var connectorId = ids[4];
// }
if (div != null && img != null)
{
if (content != "")
{
div.style.display = "";
div.innerHTML = content;
var imgParent = img.parentNode;
var imgID = img.id;
imgParent.innerHTML = "<img src='/_layouts/images/minus.gif' id='" + imgID + "' alt='" + img.alt + "' class='" + img.className + "'></img>";
if (connector != null)
{
connector.style.display = "";
}
if (level == 1)
{
var level2HorizontalConnector = document.getElementById(connectorId);
if (level2HorizontalConnector != null)
{
level2HorizontalConnector.style.display = "";
}
}
var anchor = imgParent;
anchor.onclick = function () { expandCollapseSubordinates(div.id, imgID, connectorId); }
}
else
{
div.style.display = "none";
// var occur = (level > 1) ? 2 : 1;
var parentRow = findParent(img, "div", 1);
if (parentRow != null)
{
parentRow.style.display = "none";
}
}
}
else if (img != null)
{
var parentRow = findParent(img, "div", 1);
if (parentRow != null)
{
parentRow.style.display = "none";
}
}
}
点击下方调用以下函数:
function expandCollapseSubordinates(groupId, imgId, connectorId)
{
var group = document.getElementById(groupId);
var connector = document.getElementById(connectorId);
var img = document.getElementById(imgId);
if ((group == null) || (img == null) || browseris.mac)
return;
if (group.style.display != "none")
{
group.style.display = "none";
var imgParent = img.parentNode;
imgParent.innerHTML = "<img src='/_layouts/images/plus.gif' id='" + img.id + "' alt='" + img.alt + "' class='" + img.className + "'></img>";
if (connector != null)
{
connector.style.display = "none";
}
}
else
{
group.style.display = "";
var imgParent = img.parentNode;
imgParent.innerHTML = "<img src='/_layouts/images/minus.gif' id='" + img.id + "' alt='" + img.alt + "' class='" + img.className + "'></img>";
if (connector != null)
{
connector.style.display = "";
}
}
}
知道要检查什么?我试过procmon等但他们给了一些误报。 :(
编辑:
function findParent(obj, tag, occerances)
{
if (obj.parentNode != null)
{
while (obj.parentNode != null)
{
if (obj.nodeName.toLowerCase() == tag.toLowerCase())
{
occerances--;
if (occerances == 0)
return obj;
}
obj = obj.parentNode;
}
}
return null;
}