diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 53760486a87..358aa26cc45 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2957,7 +2957,7 @@ const BrowserSearch = { var etitle = target.title; var ehref = target.href; const searchRelRegex = /(^|\s)search($|\s)/i; - const searchHrefRegex = /^https?:\/\//i; + const searchHrefRegex = /^(https?|ftp):\/\//i; if (!etype) return; diff --git a/browser/components/search/nsSearchService.js b/browser/components/search/nsSearchService.js index 1d352fafe7e..16428208d68 100755 --- a/browser/components/search/nsSearchService.js +++ b/browser/components/search/nsSearchService.js @@ -99,7 +99,7 @@ const OPENSEARCH_NS_11 = "http://a9.com/-/spec/opensearch/1.1/"; // Although the specification at http://opensearch.a9.com/spec/1.1/description/ // gives the namespace names defined above, many existing OpenSearch engines -// are using the former versions. We therefore allow either. +// are using the following versions. We therefore allow either. const OPENSEARCH_NAMESPACES = [ OPENSEARCH_NS_11, OPENSEARCH_NS_10, "http://a9.com/-/spec/opensearchdescription/1.1/", "http://a9.com/-/spec/opensearchdescription/1.0/"]; @@ -845,6 +845,7 @@ function Engine(aLocation, aSourceDataType, aIsReadOnly) { switch (aLocation.scheme) { case "https": case "http": + case "ftp": case "data": case "file": case "resource": @@ -1046,10 +1047,10 @@ Engine.prototype = { * Sets the .iconURI property of the engine. * * @param aIconURL - * A URI string pointing to the engine's icon. Must have a http[s] or - * data scheme. Icons with HTTP[S] schemes will be downloaded and - * converted to data URIs for storage in the engine XML files, if - * the engine is not readonly. + * A URI string pointing to the engine's icon. Must have a http[s], + * ftp, or data scheme. Icons with HTTP[S] or FTP schemes will be + * downloaded and converted to data URIs for storage in the engine + * XML files, if the engine is not readonly. * @param aIsPreferred * Whether or not this icon is to be preferred. Preferred icons can * override non-preferred icons. @@ -1068,7 +1069,7 @@ Engine.prototype = { LOG("_setIcon: Setting icon url \"" + uri.spec + "\" for engine \"" + this.name + "\"."); - // Only accept remote icons from http[s] + // Only accept remote icons from http[s] or ftp switch (uri.scheme) { case "data": this._iconURI = uri; @@ -1077,6 +1078,7 @@ Engine.prototype = { break; case "http": case "https": + case "ftp": // No use downloading the icon if the engine file is read-only // XXX could store the data: URI in a pref... ew? if (!this._readOnly) { diff --git a/browser/components/sidebar/src/nsSidebar.js b/browser/components/sidebar/src/nsSidebar.js index 33b9df9daa0..6a889356f14 100644 --- a/browser/components/sidebar/src/nsSidebar.js +++ b/browser/components/sidebar/src/nsSidebar.js @@ -191,16 +191,16 @@ function (engineURL, expectedSuffix, iconURL) { try { - // make sure using HTTP or HTTPS and refering to the expected kind of file + // make sure using HTTP, HTTPS, or FTP and refering to the expected kind of file // for the engine. - const engineRegexp = new RegExp("^https?:\/\/.+\." + expectedSuffix + "$", "i"); + const engineRegexp = new RegExp("^(https?|ftp):\/\/.+\." + expectedSuffix + "$", "i"); if (! engineRegexp.test(engineURL)) throw "Unsupported search engine URL"; - // make sure using HTTP or HTTPS and refering to a + // make sure using HTTP, HTTPS, or FTP and refering to a // .gif/.jpg/.jpeg/.png/.ico file for the icon. if (iconURL && - ! /^https?:\/\/.+\.(gif|jpg|jpeg|png|ico)$/i.test(iconURL)) + ! /^(https?|ftp):\/\/.+\.(gif|jpg|jpeg|png|ico)$/i.test(iconURL)) throw "Unsupported search icon URL."; } catch(ex)