[Project_owners] Exit Fiefox

eric.jung at yahoo.com eric.jung at yahoo.com
Sat Sep 15 07:24:10 PDT 2007


Joe,

Look here:

http://developer.mozilla.org/en/docs/Code_snippets:Miscellaneous#Restarting_Firefox.2FThunderbird


----- Original Message ----
From: joe ertaba <belaviyo at gmail.com>
To: Mozdev Project Owners List <project_owners at mozdev.org>
Sent: Saturday, September 15, 2007 4:59:55 AM
Subject: [Project_owners] Exit Fiefox

hi

in my extension i like to exit Firefox after saving tabs url, how can exit Firefox? , i can exit from Firefox by this code



    var wm = Components.classes["@
mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
    var browserEnumerator = wm.getEnumerator("navigator:browser");
    var found = false;
    while (!found && 
browserEnumerator.hasMoreElements()) {
            var curBrowser = browserEnumerator.getNext();
            var browserInstance = curBrowser.getBrowser();

            var numTabs = browserInstance.tabContainer.childNodes.length
;
            for(var index=0; index<numTabs; index++) {
                  var currentTab = browserInstance.getBrowserAtIndex(index);
                  //Save URl :       currentTab.currentURI.spec
            }

            curBrowser.close();
      }

this code works good when there isn't any other windows, but when some other window is open (like download manager , option window,...) Firefox doest exit !


it is possible to close download manager, option window by enumerating on them and do above code again but what about unknown windows






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mozdev.org/pipermail/project_owners/attachments/20070915/56c8297d/attachment.html 


More information about the Project_owners mailing list