If you're not familiar with the addon sdk, here's how I would approach it using a bootstrap addon.
Firstly, I would utilize Services.wm.addEventListener
to add and listen for the window load event of
chrome://mozapps/content/downloads/unknownContentType.xul
var windowListener = {
//DO NOT EDIT HERE
onOpenWindow: function(aXULWindow) {
// Wait for the window to finish loading
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
aDOMWindow.addEventListener('load', function() {
aDOMWindow.removeEventListener('load', arguments.callee, false);
windowListener.loadIntoWindow(aDOMWindow);
}, false);
},
onCloseWindow: function(aXULWindow) {},
onWindowTitleChange: function(aXULWindow, aNewTitle) {},
register: function() {
// Load into any existing windows
let DOMWindows = Services.wm.getEnumerator(null);
while (DOMWindows.hasMoreElements()) {
let aDOMWindow = DOMWindows.getNext();
windowListener.loadIntoWindow(aDOMWindow);
}
// Listen to new windows
Services.wm.addListener(windowListener);
registered = true;
},
unregister: function() {
// Unload from any existing windows
let DOMWindows = Services.wm.getEnumerator(null);
while (DOMWindows.hasMoreElements()) {
let aDOMWindow = DOMWindows.getNext();
windowListener.unloadFromWindow(aDOMWindow);
}
for (var u in unloaders) {
unloaders[u]();
}
//Stop listening so future added windows dont get this attached
Services.wm.removeListener(windowListener);
},
//END - DO NOT EDIT HERE
loadIntoWindow: function(aDOMWindow) {
if (!aDOMWindow) {
return;
}
if (aDOMWindow.location == 'chrome://mozapps/content/downloads/unknownContentType.xul'); {
//check file type
var fileName = aDOMWindow.document.getElementById('location').value;
var fileType = fileName.substr(fileName.lastIndexOf('.'));
if (fileType == 'zip') {
var myxul = document.createElementNS('xul namescpae here look it up','element you want');
aDOMWindow.document.insertBefore(elementToInsertBefore, myXul);
}
}
},
unloadFromWindow: function(aDOMWindow) {
if (!aDOMWindow) {
return;
}
}
}
};