Backed out changeset 763cc10e0bb1 (bug 1144127) for B2G reftest bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 20 Mar 2015 12:23:11 -0400
changeset 263618 959062d4f6de56b7f53defd3ff6b2254167d0eae
parent 263617 9c23e8ee3aae53ae2f71afb38a2873adeed3c55e
child 263619 5be9842d5121963f6b338da7e897ec84575463e2
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1144127
milestone39.0a1
backs out763cc10e0bb1342e781a49a7c16c087a0aae9594
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 763cc10e0bb1 (bug 1144127) for B2G reftest bustage.
toolkit/xre/nsXREDirProvider.cpp
toolkit/xre/nsXREDirProvider.h
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -108,21 +108,22 @@ nsXREDirProvider::Initialize(nsIFile *aX
   mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
 #endif
 
   if (!mProfileDir) {
     nsCOMPtr<nsIDirectoryServiceProvider> app(do_QueryInterface(mAppProvider));
     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;
 }
 
 nsresult
 nsXREDirProvider::SetProfile(nsIFile* aDir, nsIFile* aLocalDir)
 {
   NS_ASSERTION(aDir && aLocalDir, "We don't support no-profile apps yet!");
 
@@ -638,16 +639,46 @@ nsXREDirProvider::LoadExtensionBundleDir
     RegisterExtensionInterpositions(parser);
     LoadExtensionDirectories(parser, "ExtensionDirs", mExtensionDirectories,
                              NS_COMPONENT_LOCATION);
     LoadExtensionDirectories(parser, "ThemeDirs", mThemeDirectories,
                              NS_SKIN_LOCATION);
   }
 }
 
+void
+nsXREDirProvider::LoadAppBundleDirs()
+{
+  nsCOMPtr<nsIFile> 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<nsISimpleEnumerator> e;
+  rv = dir->GetDirectoryEntries(getter_AddRefs(e));
+  if (NS_FAILED(rv))
+    return;
+
+  nsCOMPtr<nsIDirectoryEnumerator> files = do_QueryInterface(e);
+  if (!files)
+    return;
+
+  nsCOMPtr<nsIFile> subdir;
+  while (NS_SUCCEEDED(files->GetNextFile(getter_AddRefs(subdir))) && subdir) {
+    mAppBundleDirectories.AppendObject(subdir);
+
+    nsCOMPtr<nsIFile> manifest =
+      CloneAndAppend(subdir, "chrome.manifest");
+    XRE_AddManifestLocation(NS_COMPONENT_LOCATION, manifest);
+  }
+}
+
 static const char *const kAppendPrefDir[] = { "defaults", "preferences", nullptr };
 
 #ifdef DEBUG_bsmedberg
 static void
 DumpFileArray(const char *key,
               nsCOMArray<nsIFile> dirs)
 {
   fprintf(stderr, "nsXREDirProvider::GetFilesInternal(%s)\n", key);
--- a/toolkit/xre/nsXREDirProvider.h
+++ b/toolkit/xre/nsXREDirProvider.h
@@ -122,16 +122,19 @@ protected:
 
   // Internal helper that splits a path into components using the '/' and '\\'
   // delimiters.
   static inline nsresult AppendProfileString(nsIFile* aFile, const char* aPath);
 
   // Calculate and register extension and theme bundle directories.
   void LoadExtensionBundleDirectories();
 
+  // Calculate and register app-bundled extension directories.
+  void LoadAppBundleDirs();
+
   void Append(nsIFile* aDirectory);
 
   nsCOMPtr<nsIDirectoryServiceProvider> mAppProvider;
   // On OSX, mGREDir points to .app/Contents/Resources
   nsCOMPtr<nsIFile>      mGREDir;
   // On OSX, mGREBinDir points to .app/Contents/MacOS
   nsCOMPtr<nsIFile>      mGREBinDir;
   // On OSX, mXULAppDir points to .app/Contents/Resources/browser