From 7162f4cdbb6653b4f1ca4861a4f8e8d7e8ecca63 Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Fri, 22 Oct 1999 06:32:26 +0000 Subject: [PATCH] bug# 9221 Fixing autoreg terminating on bad aliases. We now let it go as far as possible ignoring errors. r=sfraser git-svn-id: svn://10.0.0.236/trunk@51519 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/nsNativeComponentLoader.cpp | 44 +++++++------------ 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index 577f1a07187..2cff4185be2 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -302,35 +302,25 @@ nsNativeComponentLoader::RegisterComponentsInDir(PRInt32 when, while (more == PR_TRUE) { rv = dirIterator->GetCurrentSpec(&dirEntry); - if (NS_FAILED(rv)) return rv; - - rv = dirEntry->IsDirectory(&isDir); - if (NS_FAILED(rv)) return rv; - if (isDir == PR_TRUE) + if (NS_SUCCEEDED(rv)) { - // This is a directory. Grovel for components into the directory. - rv = RegisterComponentsInDir(when, dirEntry); + rv = dirEntry->IsDirectory(&isDir); + if (NS_SUCCEEDED(rv)) + { + if (isDir == PR_TRUE) + { + // This is a directory. Grovel for components into the directory. + rv = RegisterComponentsInDir(when, dirEntry); + } + else + { + PRBool registered; + // This is a file. Try to register it. + rv = AutoRegisterComponent(when, dirEntry, ®istered); + } + } + NS_RELEASE(dirEntry); } - else - { - PRBool registered; - // This is a file. Try to register it. - rv = AutoRegisterComponent(when, dirEntry, ®istered); - } - if (NS_FAILED(rv)) - { - // This means either of AutoRegisterComponent or - // SyncComponentsInDir failed. It could be because - // the file isn't a component like initpref.js - // So dont break on these errors. - - // Update: actually, we return NS_OK for the wrong file - // types, but we should never fail hard because just one - // component didn't work. - } - - NS_RELEASE(dirEntry); - rv = dirIterator->Next(); if (NS_FAILED(rv)) return rv; rv = dirIterator->Exists(&more);