Bug 342010: allow FTP for search-engine URIs and icons. r+a181=mconnor

This commit is contained in:
pamg.bugs%gmail.com 2006-06-20 21:53:09 +00:00
Родитель 83bff06fa8
Коммит 36b780bc28
3 изменённых файлов: 13 добавлений и 11 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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)