Firefox says could not download the search plugin from



Backstory:

I'm trying to dynamically generate a search plugin for Firefox based on user entered values. I'm not including the forms and cruft surrounding it, because I've narrowed it down to a simple failing test case trying to import any XML.


Code:

Simplified JS



var browserSearchService = Components
.classes["@http://ift.tt/1nSxH3Q"]
.getService(Components.interfaces.nsIBrowserSearchService);

var EngineProperties = {
xml : 'http://localhost/search.xml',
dataType: 3,
iconURL : 'http://localhost/logo.png',
confirm : false,
callback : function addEngineCallback(){
console.log('Jason is the greatest');
}
}

browserSearchService.addEngine( EngineProperties.xml,
EngineProperties.dataType,
EngineProperties.iconURL,
EngineProperties.confirm,
EngineProperties.callback);


Actual XML



<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://ift.tt/LMPdQR"
xmlns:moz="http://ift.tt/1jZxGJz">
<ShortName>Jason</ShortName>
<Description>Powered By Jason</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://localhost/logo.png</Image>

<URL method="get" type="text/html" template="http://ift.tt/1nSxHkd}" />
<URL method="get" type="application/x-moz-keywordsearch"
template="http://ift.tt/1ogQT6y}" />
<Url method="get" type="application/x-suggestions+json"
template="http://ift.tt/1nSxGwG"/>

<moz:SearchForm>http://ift.tt/1ogQQYk;
</OpenSearchDescription>


From what I've seen the error should indicate an invalid XML file, but for the life of me I can't find anything wrong with this. I've loaded it in Firefox fixed all the typos and syntactical errors I found (used to have & instead of &amp;, and the browser displays and parses it fine, but yet it won't load as an open search search engine.


Does FF not support localhost, maybe? I'm drawing a blank here.


Thanks in advance for any insight!


No comments:

Post a Comment