sto creando un'estensione per firefox ed ho alcuni problemi sul codice, diciamo che va un po' incasinato, ho commentato le parti da correggere. Chi mi aiuta?

//PER IL LOGIN
const username = "mr.galgano@gmail.com";
const password = "mrgalgano";
var auth_token;

// tipo di la function è????
var getObserverService = function() {
return Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverServic e);
}

var on_got_token = {
observe: function(subject, topic, data) {
auth_token = data;
getFeed();
}
}

//Dove prende i dati username e password????
function login() {
getAuthToken(username, password);
}

function getAuthToken(email, password) {
var options =
"Email=" + email +
"&Passwd=" + password +
"&service=" + "cl" +
"&source=" + "MyCompany-MyApp-0.1";

var url = "https://www.google.com/accounts/ClientLogin";

var xmlhttp = new XMLHttpRequest();

xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

// tipo di la function è?????
xmlhttp.onreadystatechange = function() {
if( xmlhttp.readyState == 4 ) {
if (xmlhttp.status == 200) {
var resp = xmlhttp.responseText;
var res = /SID=(.*)\nLSID=(.*)\nAuth=(.*)\n/(resp);

getObserverService().notifyObservers(
null, "got_token", res[3] );
} else {
window.alert("Errore\n" + xmlhttp.statusText);
}
}
}

xmlhttp.send(options);
}

function getFeed() {
window.alert("Il token e'" + auth_token);
}

//Qui va aggiunto qualcosa
//getObserverService().addObserver(on_got_token, "got_token", null);


Scusate se il codice lo inserisco così, ma non so come tagga