Bug 295247 - Allow extensions to ship plugin DLLs, part 1 - r=darin a=shaver

This commit is contained in:
bsmedberg%covad.net 2005-06-02 13:29:04 +00:00
Родитель ebde69a63b
Коммит c137db3265
3 изменённых файлов: 26 добавлений и 5 удалений

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

@ -283,6 +283,10 @@
#define NS_SUCCESS_FILE_DIRECTORY_EMPTY NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_FILES, 1) #define NS_SUCCESS_FILE_DIRECTORY_EMPTY NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_FILES, 1)
/* Result codes used by nsIDirectoryServiceProvider2 */
#define NS_SUCCESS_AGGREGATE_RESULT NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_FILES, 2)
/* Result codes used by nsIVariant */ /* Result codes used by nsIVariant */
#define NS_ERROR_CANNOT_CONVERT_DATA NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 1) #define NS_ERROR_CANNOT_CONVERT_DATA NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 1)

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

@ -43,6 +43,7 @@
#include "nsLocalFile.h" #include "nsLocalFile.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsStaticAtom.h" #include "nsStaticAtom.h"
#include "nsEnumeratorUtils.h"
#if defined(XP_MAC) #if defined(XP_MAC)
#include <Folders.h> #include <Folders.h>
@ -582,10 +583,25 @@ static PRBool FindProviderFile(nsISupports* aElement, void *aData)
nsCOMPtr<nsIDirectoryServiceProvider2> prov2 = do_QueryInterface(aElement); nsCOMPtr<nsIDirectoryServiceProvider2> prov2 = do_QueryInterface(aElement);
if (prov2) if (prov2)
{ {
rv = prov2->GetFiles(fileData->property, (nsISimpleEnumerator **)&fileData->data); nsCOMPtr<nsISimpleEnumerator> newFiles;
if (NS_SUCCEEDED(rv) && fileData->data) { rv = prov2->GetFiles(fileData->property, getter_AddRefs(newFiles));
fileData->persistent = PR_FALSE; // Enumerators can never be peristent if (NS_SUCCEEDED(rv) && newFiles) {
return PR_FALSE; if (fileData->data) {
nsCOMPtr<nsISimpleEnumerator> unionFiles;
NS_NewUnionEnumerator(getter_AddRefs(unionFiles),
(nsISimpleEnumerator*) fileData->data, newFiles);
if (unionFiles)
unionFiles.swap(* (nsISimpleEnumerator**) &fileData->data);
}
else
{
NS_ADDREF(fileData->data = newFiles);
}
fileData->persistent = PR_FALSE; // Enumerators can never be persistent
return rv == NS_SUCCESS_AGGREGATE_RESULT;
} }
} }
} }

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

@ -90,7 +90,8 @@ interface nsIDirectoryServiceProvider2: nsIDirectoryServiceProvider
* *
* @return An enumerator for a list of file locations. * @return An enumerator for a list of file locations.
* The elements in the enumeration are nsIFile * The elements in the enumeration are nsIFile
* * @returnCode NS_SUCCESS_AGGREGATE_RESULT if this result should be
* aggregated with other "lower" providers.
*/ */
nsISimpleEnumerator getFiles(in string prop); nsISimpleEnumerator getFiles(in string prop);
}; };