Bug 295247 - Allow extensions to ship plugin DLLs, part 1 - r=darin a=shaver
This commit is contained in:
Родитель
ebde69a63b
Коммит
c137db3265
|
@ -283,6 +283,10 @@
|
|||
|
||||
#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 */
|
||||
|
||||
#define NS_ERROR_CANNOT_CONVERT_DATA NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 1)
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsLocalFile.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsStaticAtom.h"
|
||||
#include "nsEnumeratorUtils.h"
|
||||
|
||||
#if defined(XP_MAC)
|
||||
#include <Folders.h>
|
||||
|
@ -582,10 +583,25 @@ static PRBool FindProviderFile(nsISupports* aElement, void *aData)
|
|||
nsCOMPtr<nsIDirectoryServiceProvider2> prov2 = do_QueryInterface(aElement);
|
||||
if (prov2)
|
||||
{
|
||||
rv = prov2->GetFiles(fileData->property, (nsISimpleEnumerator **)&fileData->data);
|
||||
if (NS_SUCCEEDED(rv) && fileData->data) {
|
||||
fileData->persistent = PR_FALSE; // Enumerators can never be peristent
|
||||
return PR_FALSE;
|
||||
nsCOMPtr<nsISimpleEnumerator> newFiles;
|
||||
rv = prov2->GetFiles(fileData->property, getter_AddRefs(newFiles));
|
||||
if (NS_SUCCEEDED(rv) && newFiles) {
|
||||
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.
|
||||
* 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);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче