Bug 330887: try to fix Ts regression from bug 317107, r=mano

This commit is contained in:
gavin%gavinsharp.com 2006-03-18 22:23:02 +00:00
parent f959c1bf09
commit 75b95b7e99

View File

@ -34,7 +34,7 @@
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK ***** */
# ***** END LICENSE BLOCK *****
const Ci = Components.interfaces;
const Cc = Components.classes;
@ -1121,32 +1121,32 @@ Engine.prototype = {
*/
_parseAsOpenSearch: function SRCH_ENG_parseAsOS() {
var doc = this._data;
for (var i = 0; i < doc.childNodes.length; ++i) {
var child = doc.childNodes[i];
switch (child.localName) {
case "ShortName":
this._name = child.textContent;
break;
case "Description":
this._description = child.textContent;
break;
case "Url":
this._parseURL(child);
break;
case "Image":
this._parseImage(child);
break;
case "Alias":
this._alias = child.textContent;
break;
case "InputEncoding":
this._queryCharset = child.textContent.toUpperCase();
break;
}
}
ENSURE(this.name && (this._urls.length > 0),
"_parseAsOpenSearch: No name, or missing URL!",
Cr.NS_ERROR_FAILURE);
// Required elements
var nameEl = doc.getElementsByTagName("ShortName")[0];
ENSURE(nameEl, "_parseAsOpenSearch: No name!", Cr.NS_ERROR_FAILURE);
this._name = nameEl.textContent;
var urlEl = doc.getElementsByTagName("Url")[0];
ENSURE(urlEl, "_parseAsOpenSearch: No url!", Cr.NS_ERROR_FAILURE);
this._parseURL(urlEl);
// Optional elements
var descEl = doc.getElementsByTagName("Description")[0];
if (descEl)
this._description = descEl.textContent;
var aliasEl = doc.getElementsByTagNameNS(kMozSearchNS_10, "Alias")[0];
if (aliasEl)
this._alias = aliasEl.textContent;
var encEl = doc.getElementsByTagName("InputEncoding")[0];
if (encEl)
this._queryCharset = encEl.textContent.toUpperCase();
var imageEl = doc.getElementsByTagName("Image")[0];
if (imageEl)
this._parseImage(imageEl);
},
/**
@ -1704,10 +1704,6 @@ SearchService.prototype = {
_loadEngines: function SRCH_SVC_loadEngines(aDir) {
LOG("_loadEngines: Searching in " + aDir.path + " for search engines.");
ENSURE_WARN(aDir.exists(),
"Can't loadEngines from " + aDir.path + ", it doesn't exist!",
Cr.NS_ERROR_FAILURE);
// Check whether aDir is the user profile dir
var isInProfile = aDir.equals(getDir(NS_APP_USER_SEARCH_DIR));