зеркало из https://github.com/mozilla/pjs.git
Bug 333505: nsLocalFileOSX crash. Original patch by Shane Caraveo <shanec@ActiveState.com>, review nits addressed by me. Unit test by Callek. r=mentovai, r/sr=bsmedberg, a1.9=damons
This commit is contained in:
Родитель
9abd52aca7
Коммит
6035bcb6e0
|
@ -183,6 +183,11 @@ class nsDirEnumerator : public nsISimpleEnumerator,
|
|||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (!mIterator || !mFSRefsArray) {
|
||||
*result = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mNext == nsnull) {
|
||||
if (mArrayIndex >= mArrayCnt) {
|
||||
ItemCount actualCnt;
|
||||
|
@ -201,6 +206,7 @@ class nsDirEnumerator : public nsISimpleEnumerator,
|
|||
mArrayIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (mArrayIndex < mArrayCnt) {
|
||||
nsLocalFile *newFile = new nsLocalFile;
|
||||
if (!newFile)
|
||||
|
@ -212,9 +218,11 @@ class nsDirEnumerator : public nsISimpleEnumerator,
|
|||
mNext = newFile;
|
||||
}
|
||||
}
|
||||
|
||||
*result = mNext != nsnull;
|
||||
if (!*result)
|
||||
Close();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
function run_test()
|
||||
{
|
||||
var dirEntries = do_get_file("xpcom/tests/unit/").directoryEntries;
|
||||
|
||||
while (dirEntries.hasMoreElements())
|
||||
dirEntries.getNext();
|
||||
|
||||
// We ensure there is no crash
|
||||
dirEntries.hasMoreElements();
|
||||
}
|
Загрузка…
Ссылка в новой задаче