Bug 392771: Load distribution-specific search engines at startup. r=gavin, r=bsmedberg, a=beltzner

This commit is contained in:
thunder@mozilla.com 2007-09-11 08:55:56 -07:00
parent cde460cf95
commit 1ee157150d
2 changed files with 15 additions and 6 deletions

View File

@ -41,6 +41,7 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsIFile;
interface nsIInputStream;
[scriptable, uuid(58e4f602-a7c8-4cd1-9dca-716705e826ef)]
@ -162,9 +163,17 @@ interface nsISearchEngine : nsISupports
};
[scriptable, uuid(8307b8f2-08ea-45b8-96bf-b1dc7688fe3b)]
[scriptable, uuid(c2e8ae4f-9fea-4a24-81e3-c94cdc055c1b)]
interface nsIBrowserSearchService : nsISupports
{
/**
* Loads all the engines in the supplied directory.
*
* @param enginesDir
* The directory containing the engine description files.
*/
void loadEngines(in nsIFile enginesDir);
/**
* Adds a new search engine from the file at the supplied URI, optionally
* asking the user for confirmation first. If a confirmation dialog is

View File

@ -2222,7 +2222,7 @@ SearchService.prototype = {
while (locations.hasMoreElements()) {
var location = locations.getNext().QueryInterface(Ci.nsIFile);
this._loadEngines(location);
this.loadEngines(location);
}
// Now that all engines are loaded, build the sorted engine list
@ -2298,8 +2298,8 @@ SearchService.prototype = {
}
},
_loadEngines: function SRCH_SVC_loadEngines(aDir) {
LOG("_loadEngines: Searching in " + aDir.path + " for search engines.");
loadEngines: function SRCH_SVC_loadEngines(aDir) {
LOG("loadEngines: Searching in " + aDir.path + " for search engines.");
// Check whether aDir is the user profile dir
var isInProfile = aDir.equals(getDir(NS_APP_USER_SEARCH_DIR));
@ -2338,7 +2338,7 @@ SearchService.prototype = {
addedEngine = new Engine(file, dataType, !isWritable);
addedEngine._initFromFile();
} catch (ex) {
LOG("_loadEngines: Failed to load " + file.path + "!\n" + ex);
LOG("loadEngines: Failed to load " + file.path + "!\n" + ex);
continue;
}
@ -2347,7 +2347,7 @@ SearchService.prototype = {
try {
this._convertSherlockFile(addedEngine, fileURL.fileBaseName);
} catch (ex) {
LOG("_loadEngines: Failed to convert: " + fileURL.path + "\n" + ex);
LOG("loadEngines: Failed to convert: " + fileURL.path + "\n" + ex);
// The engine couldn't be converted, mark it as read-only
addedEngine._readOnly = true;
}