Bug 352867, Cert Manager shows incorrect cert names if any twisty is closed

r=rrelyea
This commit is contained in:
kaie%kuix.de 2006-10-02 20:11:49 +00:00
Родитель c44354253e
Коммит 6e3768170d
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -261,7 +261,7 @@ nsCertTree::GetThreadDescAtIndex(PRInt32 index)
// //
// If the row at index is a cert, return that cert. Otherwise, return null. // If the row at index is a cert, return that cert. Otherwise, return null.
nsIX509Cert * nsIX509Cert *
nsCertTree::GetCertAtIndex(PRInt32 index) nsCertTree::GetCertAtIndex(PRInt32 index, PRInt32 *outAbsoluteCertOffset)
{ {
int i, idx = 0, cIndex = 0, nc; int i, idx = 0, cIndex = 0, nc;
nsIX509Cert *rawPtr = nsnull; nsIX509Cert *rawPtr = nsnull;
@ -273,6 +273,8 @@ nsCertTree::GetCertAtIndex(PRInt32 index)
nc = (mTreeArray[i].open) ? mTreeArray[i].numChildren : 0; nc = (mTreeArray[i].open) ? mTreeArray[i].numChildren : 0;
if (index < idx + nc) { // cert is within range of this thread if (index < idx + nc) { // cert is within range of this thread
PRInt32 certIndex = cIndex + index - idx; PRInt32 certIndex = cIndex + index - idx;
if (outAbsoluteCertOffset)
*outAbsoluteCertOffset = certIndex;
nsCOMPtr<nsISupports> isupport = nsCOMPtr<nsISupports> isupport =
dont_AddRef(mCertArray->ElementAt(certIndex)); dont_AddRef(mCertArray->ElementAt(certIndex));
nsCOMPtr<nsIX509Cert> cert = do_QueryInterface(isupport); nsCOMPtr<nsIX509Cert> cert = do_QueryInterface(isupport);
@ -723,9 +725,13 @@ nsCertTree::GetCellText(PRInt32 row, nsITreeColumn* col,
_retval.Truncate(); _retval.Truncate();
return NS_OK; return NS_OK;
} }
PRInt32 absoluteCertOffset;
nsCOMPtr<nsIX509Cert> cert = dont_AddRef(GetCertAtIndex(row, &absoluteCertOffset));
PRInt32 colIndex; PRInt32 colIndex;
col->GetIndex(&colIndex); col->GetIndex(&colIndex);
PRUint32 arrayIndex=row+colIndex*mNumRows; PRUint32 arrayIndex=colIndex+absoluteCertOffset*mNumRows;
PRUint32 arrayLength=0; PRUint32 arrayLength=0;
if (mCellText) { if (mCellText) {
mCellText->GetLength(&arrayLength); mCellText->GetLength(&arrayLength);
@ -737,7 +743,7 @@ nsCertTree::GetCellText(PRInt32 row, nsITreeColumn* col,
return NS_OK; return NS_OK;
} }
} }
nsCOMPtr<nsIX509Cert> cert = dont_AddRef(GetCertAtIndex(row));
if (cert == nsnull) return NS_ERROR_FAILURE; if (cert == nsnull) return NS_ERROR_FAILURE;
if (NS_LITERAL_STRING("certcol").Equals(colID)) { if (NS_LITERAL_STRING("certcol").Equals(colID)) {
rv = cert->GetCommonName(_retval); rv = cert->GetCommonName(_retval);

Просмотреть файл

@ -119,7 +119,7 @@ private:
nsCOMPtr<nsINSSComponent> mNSSComponent; nsCOMPtr<nsINSSComponent> mNSSComponent;
treeArrayEl *GetThreadDescAtIndex(PRInt32 _index); treeArrayEl *GetThreadDescAtIndex(PRInt32 _index);
nsIX509Cert *GetCertAtIndex(PRInt32 _index); nsIX509Cert *GetCertAtIndex(PRInt32 _index, PRInt32 *outAbsoluteCertOffset = nsnull);
void FreeCertArray(); void FreeCertArray();
nsresult UpdateUIContents(); nsresult UpdateUIContents();