views:

186

answers:

0

This is for a dialog in a Firefox extension. How can I make the following code work, so that when the listener callback is called, it can reference external function onSave2(). I keep getting function onSave2() is not defined. Also, I noticed that when confirm is called I get this:

Error: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.confirm]

function onSave2() {
 blah 
 blah

 return true;
}

onSave is assigned to ondialogaccept in the dialog xul

function onSave() {
 var listener = {
  finished : function(data) {
   if (data != "OK") {
    var answer = confirm("Continue with saving?");
    if (!answer) {
     return false;
    }
   }

   onSave2(); 
  }   
 }

 readAllFromSocket("127.0.0.1", HTTP_PORT, "GET /?command=check HTTP/1.0\n\n", listener);
}