283640 - Cookies window hangs browser when items are expanded or collapsed. Ensure that nsITreeView implementation of getParentIndex always returns -1 for rows that are at the top level of the hierarchy. (Folders were actually returning "0" as their parent index, which is incorrect).

git-svn-id: svn://10.0.0.236/trunk@170220 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ben%bengoodger.com 2005-03-05 22:43:48 +00:00
parent 1896509c92
commit efd8a62b87

View File

@ -313,7 +313,11 @@ var gCookiesWindow = {
{
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
if (!item) return -1;
// If an item has no parent index (i.e. it is at the top level) this
// function MUST return -1 otherwise we will go into an infinite loop.
// Containers are always top level items in the cookies tree, so make
// sure to return the appropriate value here.
if (!item || item.container) return -1;
return item.parentIndex;
}
return -1;
@ -379,7 +383,7 @@ var gCookiesWindow = {
var delta = multiplier * item.cookies.length;
this._rowCount += delta;
item.open = !item.open;
gCookiesWindow._tree.treeBoxObject.rowCountChanged(aIndex, delta);
gCookiesWindow._tree.treeBoxObject.rowCountChanged(aIndex + 1, delta);
gCookiesWindow._tree.treeBoxObject.invalidateRow(aIndex);
}
},