With jpm you can get the XUL window. For instance this gets the most recent window:
const { getMostRecentWindow } = require(“sdk/window/utils”);
let win = getMostRecentWindow(‘navigator:browser’);
Then you can access the panel GUI of that window. However the panelui loads lazily. So it wont all be there until you open the menu once.
After that you can access all the goods at win.PanelUI
. You want to be looking at the footer section. I get that below at PUIf
This is an example of how to deal with it:
var getPUIMembers = function(aDOMWindow) {
// returns null if DNE or the object
var PUI = aDOMWindow.PanelUI;
if (!PUI) {
return {
PUI: null,
PUIp: null,
PUIf: null
}
}
var PUIp;
if (!PUI._initialized) {
PUIp = aDOMWindow.document.getElementById('PanelUI-popup'); // have to do it this way, doing PanelUI.panel does getElementById anyways so this is no pref loss
} else {
PUIp = PUI.panel; // PanelUI-popup
}
// console.log('PUI.mainView:', PUI.mainView, PUI.mainView.childNodes);
var PUIf = PUI.mainView ? PUI.mainView.childNodes[1] : null; // PanelUI-footer // aDOMWindow.PanelUI.mainView.childNodes == NodeList [ <vbox#PanelUI-contents-scroller>, <footer#PanelUI-footer> ]
return {
PUI: PUI,
PUIp: PUIp,
PUIf: PUIf
};
};
var {PUI, PUIp, PUIf} = getPUIMembers(aDOMWindow);
if (PUIp.state == 'open' || PUIp.state == 'showing') {
insertProfilistBox({view:aDOMWindow});
} else {
PUIp.addEventListener('popupshowing', insertProfilistBox, false);
}