[Project_owners] Exit Fiefox
joe ertaba
belaviyo at gmail.com
Sat Sep 15 01:59:55 PDT 2007
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/74f78619/attachment-0001.html
More information about the Project_owners
mailing list