How to get an array of search engines added to Firefox? There is such a thing, but I do not know if it's just because e know how to use it: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Mozmill_tests/Shared_Modules/SearchAPI/engineManager
Use nsIBrowserSearchService
to enumerate nsISearchEngine
instances, aka. the search engines.
var bss = Cc["@mozilla.org/browser/search-service;1"].
getService(Ci.nsIBrowserSearchService);
bss.init(function() {
for (var e of bss.getEngines() /* nsISearchEngine */) {
console.log(e.name, e.description);
}
console.log("default:", bss.defaultEngine.name);
console.log("current:", bss.currentEngine.name);
});
If you're using the SDK, you may need to
let {Cc, Ci} = require("chrome");
browser.xul
overlays in XUL add-ons should be fine, otherwise a common pattern in XUL add-ons is something like:
let {classes: Cc, interfaces: Ci} = Components;