зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1393805 - Part 1 - Add XRE_USER_SYS_EXTENSION_DEV_DIR XRESysExtDev Key. r=bobowen,gcp
Adds a new directory provider key "XRESysExtDev" to be used by system extension developers needing to load system extensions from a directory readable by sandboxed content processes. MozReview-Commit-ID: 4BKOZoPzCC3 --HG-- extra : rebase_source : 452db8d53a1f0248a080f858c48492978b5db808
This commit is contained in:
Родитель
c970a23771
Коммит
6da29eda0b
|
@ -478,6 +478,9 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(aProperty, XRE_USER_SYS_EXTENSION_DEV_DIR)) {
|
||||||
|
return GetSysUserExtensionsDevDirectory(aFile);
|
||||||
|
}
|
||||||
else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) {
|
else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) {
|
||||||
bool persistent = false;
|
bool persistent = false;
|
||||||
rv = GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(file));
|
rv = GetFile(NS_GRE_DIR, &persistent, getter_AddRefs(file));
|
||||||
|
@ -1522,6 +1525,23 @@ nsXREDirProvider::GetSysUserExtensionsDirectory(nsIFile** aFile)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsXREDirProvider::GetSysUserExtensionsDevDirectory(nsIFile** aFile)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIFile> localDir;
|
||||||
|
nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), false);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = AppendSysUserExtensionsDevPath(localDir);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = EnsureDirectoryExists(localDir);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
localDir.forget(aFile);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(XP_UNIX) || defined(XP_MACOSX)
|
#if defined(XP_UNIX) || defined(XP_MACOSX)
|
||||||
nsresult
|
nsresult
|
||||||
nsXREDirProvider::GetSystemExtensionsDirectory(nsIFile** aFile)
|
nsXREDirProvider::GetSystemExtensionsDirectory(nsIFile** aFile)
|
||||||
|
@ -1629,6 +1649,39 @@ nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsXREDirProvider::AppendSysUserExtensionsDevPath(nsIFile* aFile)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aFile);
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
#if defined (XP_MACOSX) || defined(XP_WIN)
|
||||||
|
|
||||||
|
static const char* const sXR = "Mozilla";
|
||||||
|
rv = aFile->AppendNative(nsDependentCString(sXR));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
static const char* const sExtensions = "SystemExtensionsDev";
|
||||||
|
rv = aFile->AppendNative(nsDependentCString(sExtensions));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
#elif defined(XP_UNIX)
|
||||||
|
|
||||||
|
static const char* const sXR = ".mozilla";
|
||||||
|
rv = aFile->AppendNative(nsDependentCString(sXR));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
static const char* const sExtensions = "systemextensionsdev";
|
||||||
|
rv = aFile->AppendNative(nsDependentCString(sExtensions));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Don't know how to get XRE system extension dev path on your platform"
|
||||||
|
#endif
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
|
nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
|
||||||
|
|
|
@ -104,6 +104,7 @@ protected:
|
||||||
nsresult GetFilesInternal(const char* aProperty, nsISimpleEnumerator** aResult);
|
nsresult GetFilesInternal(const char* aProperty, nsISimpleEnumerator** aResult);
|
||||||
static nsresult GetUserDataDirectoryHome(nsIFile* *aFile, bool aLocal);
|
static nsresult GetUserDataDirectoryHome(nsIFile* *aFile, bool aLocal);
|
||||||
static nsresult GetSysUserExtensionsDirectory(nsIFile* *aFile);
|
static nsresult GetSysUserExtensionsDirectory(nsIFile* *aFile);
|
||||||
|
static nsresult GetSysUserExtensionsDevDirectory(nsIFile* *aFile);
|
||||||
#if defined(XP_UNIX) || defined(XP_MACOSX)
|
#if defined(XP_UNIX) || defined(XP_MACOSX)
|
||||||
static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
|
static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
|
||||||
#endif
|
#endif
|
||||||
|
@ -118,6 +119,7 @@ protected:
|
||||||
bool aLocal);
|
bool aLocal);
|
||||||
|
|
||||||
static nsresult AppendSysUserExtensionPath(nsIFile* aFile);
|
static nsresult AppendSysUserExtensionPath(nsIFile* aFile);
|
||||||
|
static nsresult AppendSysUserExtensionsDevPath(nsIFile* aFile);
|
||||||
|
|
||||||
// Internal helper that splits a path into components using the '/' and '\\'
|
// Internal helper that splits a path into components using the '/' and '\\'
|
||||||
// delimiters.
|
// delimiters.
|
||||||
|
|
|
@ -128,6 +128,12 @@
|
||||||
*/
|
*/
|
||||||
#define XRE_USER_SYS_EXTENSION_DIR "XREUSysExt"
|
#define XRE_USER_SYS_EXTENSION_DIR "XREUSysExt"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A directory service key which specifies a directory where temporary
|
||||||
|
* system extensions can be loaded from during development.
|
||||||
|
*/
|
||||||
|
#define XRE_USER_SYS_EXTENSION_DEV_DIR "XRESysExtDev"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A directory service key which specifies the distribution specific files for
|
* A directory service key which specifies the distribution specific files for
|
||||||
* the application.
|
* the application.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче