Bug 852962 - Bad optionsURL will show 'options' header but no options r=margaret

This commit is contained in:
Mark Finkle 2013-03-20 15:30:24 -04:00
parent fa1c295631
commit 100f42a912

View File

@ -328,22 +328,28 @@ var Addons = {
if (xhr.responseXML) {
// Only allow <setting> for now
let settings = xhr.responseXML.querySelectorAll(":root > setting");
for (let i = 0; i < settings.length; i++) {
var setting = settings[i];
var desc = stripTextNodes(setting).trim();
if (!setting.hasAttribute("desc"))
setting.setAttribute("desc", desc);
box.appendChild(setting);
if (settings.length > 0) {
for (let i = 0; i < settings.length; i++) {
var setting = settings[i];
var desc = stripTextNodes(setting).trim();
if (!setting.hasAttribute("desc"))
setting.setAttribute("desc", desc);
box.appendChild(setting);
}
// Send an event so add-ons can prepopulate any non-preference based
// settings
let event = document.createEvent("Events");
event.initEvent("AddonOptionsLoad", true, false);
window.dispatchEvent(event);
// Also send a notification to match the behavior of desktop Firefox
let id = aListItem.getAttribute("addonID");
Services.obs.notifyObservers(document, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, id);
} else {
// No options, so hide the header and reset the list item
detailItem.setAttribute("optionsURL", "");
aListItem.setAttribute("optionsURL", "");
}
// Send an event so add-ons can prepopulate any non-preference based
// settings
let event = document.createEvent("Events");
event.initEvent("AddonOptionsLoad", true, false);
window.dispatchEvent(event);
// Also send a notification to match the behavior of desktop Firefox
let id = aListItem.getAttribute("addonID");
Services.obs.notifyObservers(document, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, id);
}
} catch (e) { }