Bug 1418536 - Port [Bug 1405670 - Stop importing old search settings from search-metadata.json] to SeaMonkey. r=frg a=IanN RELEASE_57_END
authorEdmund Wong <ewong@pw-wspx.org>
Mon, 20 Nov 2017 13:00:43 +0100
changeset 31436 ecee822dfb388aa02e9966b8f7aba59a02f7e119
parent 31435 e06e5e58f8f1e3908eef5b29d09db52b83f039a2
child 31437 519347a9ada9525062d7c588d48ec6dc0adcd08c
push id1
push userclokep@gmail.com
push dateMon, 07 May 2018 22:45:56 +0000
treeherdercomm-esr60@57eacde5ef40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrg, IanN
bugs1418536, 1405670
Bug 1418536 - Port [Bug 1405670 - Stop importing old search settings from search-metadata.json] to SeaMonkey. r=frg a=IanN
suite/profile/nsSuiteDirectoryProvider.cpp
--- a/suite/profile/nsSuiteDirectoryProvider.cpp
+++ b/suite/profile/nsSuiteDirectoryProvider.cpp
@@ -58,57 +58,29 @@ nsSuiteDirectoryProvider::GetFile(const 
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSuiteDirectoryProvider::GetFiles(const char *aKey,
                                    nsISimpleEnumerator* *aResult)
 {
-  if (strcmp(aKey, NS_APP_SEARCH_DIR_LIST))
-    return NS_ERROR_FAILURE;
-
   nsresult rv;
   nsCOMPtr<nsIProperties> dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMArray<nsIFile> baseFiles;
 
-  /**
-   * We want to preserve the following order, since the search service loads
-   * engines in first-loaded-wins order.
-   *   - extension search plugin locations (prepended below using
-   *     NS_NewUnionEnumerator)
-   *   - distro search plugin locations
-   *   - user search plugin locations (profile)
-   *   - app search plugin location (shipped engines)
-   */
-  AppendDistroSearchDirs(dirSvc, baseFiles);
-  AppendFileKey(NS_APP_USER_SEARCH_DIR, dirSvc, baseFiles);
-  AppendFileKey(NS_APP_SEARCH_DIR, dirSvc, baseFiles);
-
   nsCOMPtr<nsISimpleEnumerator> baseEnum;
   rv = NS_NewArrayEnumerator(getter_AddRefs(baseEnum), baseFiles);
   if (NS_FAILED(rv))
     return rv;
 
-  nsCOMPtr<nsISimpleEnumerator> list;
-  rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST,
-                   NS_GET_IID(nsISimpleEnumerator),
-                   getter_AddRefs(list));
-  if (NS_FAILED(rv))
-    return rv;
-
-  nsCOMPtr<nsISimpleEnumerator> extEnum =
-    new AppendingEnumerator(list, "searchplugins");
-  if (!extEnum)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  return NS_NewUnionEnumerator(aResult, extEnum, baseEnum);
+  return NS_ERROR_FAILURE;
 }
 
 void
 nsSuiteDirectoryProvider::EnsureProfileFile(const nsACString& aLeafName,
                                             nsIFile* aParentDir,
                                             nsIFile* aTarget)
 {
   nsCOMPtr<nsIFile> defaultsDir;
@@ -180,33 +152,16 @@ nsSuiteDirectoryProvider::AppendingEnume
 nsSuiteDirectoryProvider::AppendingEnumerator::AppendingEnumerator
     (nsISimpleEnumerator* aBase, const char* const aLeafName) :
   mBase(aBase), mLeafName(aLeafName)
 {
   // Initialize mNext to begin.
   GetNext();
 }
 
-void
-nsSuiteDirectoryProvider::AppendFileKey(const char *key, nsIProperties* aDirSvc,
-                                        nsCOMArray<nsIFile> &array)
-{
-  nsCOMPtr<nsIFile> file;
-  nsresult rv = aDirSvc->Get(key, NS_GET_IID(nsIFile), getter_AddRefs(file));
-  if (NS_FAILED(rv))
-    return;
-
-  bool exists;
-  rv = file->Exists(&exists);
-  if (NS_FAILED(rv) || !exists)
-    return;
-
-  array.AppendObject(file);
-}
-
 // Appends the distribution-specific search engine directories to the
 // array.  The directory structure is as follows:
 
 // appdir/
 // \- distribution/
 //    \- searchplugins/
 //       |- common/
 //       \- locale/