From 78913c43931a43f3fad4930a600f7e4e2fe7b516 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Fri, 20 Mar 2015 12:23:11 -0400 Subject: [PATCH] Backed out changeset 763cc10e0bb1 (bug 1144127) for B2G reftest bustage. --- toolkit/xre/nsXREDirProvider.cpp | 35 ++++++++++++++++++++++++++++++-- toolkit/xre/nsXREDirProvider.h | 3 +++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index b96ad43efe9..c496a14ce84 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -113,11 +113,12 @@ nsXREDirProvider::Initialize(nsIFile *aXULAppDir, if (app) { bool per = false; app->GetFile(NS_APP_USER_PROFILE_50_DIR, &per, getter_AddRefs(mProfileDir)); - NS_ASSERTION(per, "NS_APP_USER_PROFILE_50_DIR must be persistent!"); - NS_ASSERTION(mProfileDir, "NS_APP_USER_PROFILE_50_DIR not defined! This shouldn't happen!"); + NS_ASSERTION(per, "NS_APP_USER_PROFILE_50_DIR must be persistent!"); + NS_ASSERTION(mProfileDir, "NS_APP_USER_PROFILE_50_DIR not defined! This shouldn't happen!"); } } + LoadAppBundleDirs(); return NS_OK; } @@ -643,6 +644,36 @@ nsXREDirProvider::LoadExtensionBundleDirectories() } } +void +nsXREDirProvider::LoadAppBundleDirs() +{ + nsCOMPtr dir; + bool persistent = false; + nsresult rv = GetFile(XRE_APP_DISTRIBUTION_DIR, &persistent, getter_AddRefs(dir)); + if (NS_FAILED(rv)) + return; + + dir->AppendNative(NS_LITERAL_CSTRING("bundles")); + + nsCOMPtr e; + rv = dir->GetDirectoryEntries(getter_AddRefs(e)); + if (NS_FAILED(rv)) + return; + + nsCOMPtr files = do_QueryInterface(e); + if (!files) + return; + + nsCOMPtr subdir; + while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(subdir))) && subdir) { + mAppBundleDirectories.AppendObject(subdir); + + nsCOMPtr manifest = + CloneAndAppend(subdir, "chrome.manifest"); + XRE_AddManifestLocation(NS_COMPONENT_LOCATION, manifest); + } +} + static const char *const kAppendPrefDir[] = { "defaults", "preferences", nullptr }; #ifdef DEBUG_bsmedberg diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h index 46c74e3ac5f..490b5f8b20a 100644 --- a/toolkit/xre/nsXREDirProvider.h +++ b/toolkit/xre/nsXREDirProvider.h @@ -127,6 +127,9 @@ protected: // Calculate and register extension and theme bundle directories. void LoadExtensionBundleDirectories(); + // Calculate and register app-bundled extension directories. + void LoadAppBundleDirs(); + void Append(nsIFile* aDirectory); nsCOMPtr mAppProvider;