Bug 623110 - prioritise the loading of user-installed search engines over app-shipped engines. r=dolske, a=blocker
authorGavin Sharp <gavin@gavinsharp.com>
Thu, 27 Jan 2011 18:56:29 -0500
changeset 61770 a55b45fb3d7c3753c4e240ccd2f239795abec46d
parent 61769 76b361ae1c3a5c78d59dc6c911d8de2be71ef41f
child 61771 1c2d53a2dcfb5c347564c51fc021fb656f1f95f8
push id18480
push userjdolske@mozilla.com
push dateWed, 02 Feb 2011 03:46:14 +0000
treeherdermozilla-central@a55b45fb3d7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, blocker
bugs623110
milestone2.0b11pre
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
Bug 623110 - prioritise the loading of user-installed search engines over app-shipped engines. r=dolske, a=blocker
browser/components/dirprovider/DirectoryProvider.cpp
--- a/browser/components/dirprovider/DirectoryProvider.cpp
+++ b/browser/components/dirprovider/DirectoryProvider.cpp
@@ -243,19 +243,28 @@ DirectoryProvider::GetFiles(const char *
   if (!strcmp(aKey, NS_APP_SEARCH_DIR_LIST)) {
     nsCOMPtr<nsIProperties> dirSvc
       (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     if (!dirSvc)
       return NS_ERROR_FAILURE;
 
     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);
-    AppendFileKey(NS_APP_USER_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,